Ecosystem simulation

Racer1Racer1 Join Date: 2002-11-22 Member: 9615Members
With all this discussion of ecosystem issues, the question comes of how to handle the ecosystem on a large scale. One problem is that currently, only a small area around the player-visible world is ever in memory and being "run" at any given time. This is likely no more than a few hundred meters around the player, and possibly much less. Whenever a player leaves an area, it is effectively "pausing" that area, making the lifeforms in that world no longer move or interact at all.

With current CPUs/memory, it would be impossible load the entire world (even in the unrendered background) using the full game engine. So, the question is, how do you make an ecosystem work if only part of it is available at a time? The options I can think of are:
1. Limit to doing stuff only within the loaded world (currently how it works)
2. Provide a macro-simulation of the whole world, with much more limited interactions, that syncs with the player-visible world as needed (this would require a relatively low CPU/Memory overhead, so it would have minimal impact on player game performance)

One simple implementation of #2 would be to store details of the quantity (and other attributes) for each type of species in all areas, but only display some of them in the player-visible world (for performance reasons). When an event occurs (such as a fish dying), the game could check the details to determine if another can replace it (out of player view). The simulation would also periodically calculate if each lifeform are born, move, die, etc. in a very generic way, based on needs (e.g. presence of prey species, etc).

Comments

  • Captain_PyroCaptain_Pyro Germany Join Date: 2015-05-31 Member: 205116Members
    edited June 2015
    I think option 1 should do the trick, right?
    Wouldn't an ecosystem be stable on it's own. Lets say stable enough for the sake of making it not too complicated.
    So the only change comes through actions of the player and to take action you must be in the loaded Biome. Greater changes like infestations of some kind or a giant swarm of migratory predators moving could technically be RNG'd and loaded while netering the biome (a total guess on my side here) Neighboring biome then check what has changed and balance themselves out, as soon as they load.
    So, no offscreen computing required?

    At least that's how it looks to my simple mind.

    Edit: But i have to admit, all the talk about ecosystems went kind of over my head. How complex of a simulation are we talking here?


  • Simking124Simking124 Canada Join Date: 2015-05-16 Member: 204542Members
    I don't see why pausing the simulation while the player is away from the area would be unsuitable. Also, random ecological events could be possible with this system. Like condition A (Huge number of fish deaths in an area) plus condition 2 (unusual underwater currents, storm) = Red Tide event for example.
  • sayerulzsayerulz oregon Join Date: 2015-04-15 Member: 203493Members
    Option 2 seems best, as with option one, a player could do something catastrophic to an area, but then leave it before it sets in and have it reset, so there are no real consequences. Even if they make it so it will pick up where it left off when a player returns, it will still prevent changes having far-reaching effects. Something that the player dose in an area can never leave that area, no matter how serious it is.
  • conscioussoulconscioussoul Canada Join Date: 2015-05-17 Member: 204607Members, Subnautica Playtester
    I don't think option 2 would be difficult to put in place, honestly, from a programming perspective. What's "in memory" is all those heavy textures, the rendering, the creatures etc.  When you leave an area, the state you left the area in are still saved, right? so nothing prevents the program from changing them without rendering them.
    Ecology only makes sense when the whole map / planet is taken into account.

    But I think the challenge is only to think of the proper model to use; implementing it is fairly simple, since you only need to take care of the rendering when the player is actually present.

    Here is a first draft:

    Each area records:
    • Biome
    • Average temperature
    • Average acidity level
    • Average radiation level
    • Average volume of sand
    • Average salinity level
    • Quantity and type of each flora present
    • Quantity and type of each fauna already spawned and saved when the player left
    • Special elements present (such as a base, aurora, pod, sub etc)
    • Adjacent areas

    Effect of these parameters:
    • Each Fauna has a favorite temperature, acidity level, salinity level, etc. Spawn x2 when it's just the right conditions. Flora respawn rate is also doubled
    • Tolerable - a few parameters off but not too bad. Regular spawn level.  No changes to flora.
    • Below or above tolerable for several parameter - half spawn level. Flora will spawn less items (less acid mushroom on a patch, etc) and start to die
    • In red zone (cannot live in that parameter, will die) - no spawn anymore, player will see dead fish spawning if fauna already present when temperature reached critical level for that creature. Flora will wither and die in the red zone

    Effect of each Flora and Fauna on these parameters:
    • Since all is interrelated, each fauna and flora may change back these parameters
    • More kelp may lower the acidity level. More mushroom will raise it.
    • More airsacks may mean less salt if they filter it
    • More sand may mean more eggs and spawn rate for fish but more sand digger may mean less eggs as they are disturbed in the sand
    • Radiation spreads if left unattended
    • More of certain flora type = more spawn rate for the fishes that eat them
    • More of certain type of fishes = more spawn rate for the larger fishes that eat them
    • etc etc

    Now it's a question of creating rules about all these parameters and how they relate:

    Some examples:

    Temperature:  Take biome base temperature, then add:
    +1 degree for each power generator, motor, turbine etc. present
    -1 degree for each 10m of depth (cannot go lower than 1 or 2 degree)
    +10 degree for each unit of lava present
    +1 degree for each unit of hot current present
    -1 degree for each unit of cold current present
    -1 degree for each 10m closer to poles and closer to surface (can lead to below zero degree, causing surface to ice)

    Acidity level:  Take biome base acidity, then add:
    +10 acidity for each patch of acid mushroom present
    +5 acidity for each acid mushroom slashed open or thrown / broken in the water by the player
    -10 acidity for each patch of acid mushroom fully emptied of all mushroom or ripped out of its socket by the propulsion cannon

    Radiation level: Take area current radiation level, then add:
    -1 radiation every hour of gaming with no source of radiation in the biome
    +1 radiation for every adjacent area that is radiated
    +10 radiation as long as a radiation source is present in the biome

    Salinity level: Take biome salinity level then add:
    +1 for each salt crystal present
    -1 for each salt crystal collected by the player
    +1 for each unit of coral present in the area
    -1 for each air sack present, as they are filtering the water
    (each fauna that contributes to salinity or that filters it away would have to also add to this)

    Finally, the game now has to regularly "adjust" all these parameters.
    Every few seconds, it goes back in the database of parameters and it calculates the new values based on how many flora, fauna, and parameters are present. It then "kills" or "adds" some fauna and flora (all virtually while you are not present).
    Each time it goes through all the virtual areas, it changes parameters very slightly, but after a while it will start to be very apparent.

    The only hard part actually, is to decide if/how the environment should change WHEN YOU ARE IN IT. That's when it's hard, because it's being rendered.
    That's why all the magic of spawning etc. happens outside of the player usually.
  • FalcoFalco Germany Join Date: 2015-06-05 Member: 205271Members
    Shouldn't changes to the water's content like acidity and such things dissipate over time? I think it would be hard to imagine that with your proposal the world doesn't get taken over by acid mushrooms in a few minutes :P
    Also if the player slashes a mushroom, then there would be no way to reverse it, which is silly. It would be temporary effect.
  • conscioussoulconscioussoul Canada Join Date: 2015-05-17 Member: 204607Members, Subnautica Playtester
    Yes i agree indeed, its part of the rules of modeling an ecosystem : it has to find a homeostasis (a balanced, self balancing state)
Sign In or Register to comment.