Ecosystem simulation
Racer1
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).
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
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?
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:
Effect of these parameters:
Effect of each Flora and Fauna on these parameters:
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.
Also if the player slashes a mushroom, then there would be no way to reverse it, which is silly. It would be temporary effect.