I haven't played the last SimCity, but I remember from the old games (i.e. SimCity 2000) that you had these maps showing pollution, wealth, energy, water, etc. And I guess other games like GTA used the same technique. Now from a first person perspective, the entities that the player finds in the city will reflect the conditions given by these statistical maps. For example in a polluted zone there will be more garbage or fog in the streets, and a wealthy zone will have more luxury houses and cars. I'm exploring ways to use this concept to simulate a massive ecosystem. If there is a river and mountains in a map, the influence of water on vegetation could be mapped so that there will be higher tree densities. Then vegetation levels will influence density of herbivores. Now, resources are static and rather easy to map, but then vegetation could be harvested or catch fire, then it will be dynamic. And animals could migrate and increase/reduce population due to mating seasons and plagues. It's like a complex version of Conway's Game of Life, and not all "masses" have the same pattern. What techniques exist to process such system? What optimizations could be performed, having in mind that the system could have no constrains?
Mass simulation with statistical maps
Crossbones+ - Reputation: 2134
Posted 02 August 2013 - 08:43 AM
you had these maps showing pollution, wealth, energy, water, etc. And I guess other games like GTA used the same technique
GTA is more of an open world shooter. there's no real simulation going on behind the scenes, like in SIMCity, to generate the info displayed on the maps in SIMCity.
If there is a river and mountains in a map, the influence of water on vegetation could be mapped so that there will be higher tree densities. Then vegetation levels will influence density of herbivores. Now, resources are static and rather easy to map, but then vegetation could be harvested or catch fire, then it will be dynamic. And animals could migrate and increase/reduce population due to mating seasons and plagues. It's like a complex version of Conway's Game of Life, and not all "masses" have the same pattern. What techniques exist to process such system?
in the open world fps/ rpg / person sim i'm working on (CAVEMAN), elevations on the world map determine the path taken by flowing water during generation of the world map at new game start. vegetation is influenced by both elevation and water. resources are modeled, both animals and vegetation. so vegetation can come and go from harvesting, wild fires, and climate / environmental change. animals can be temporarily hunted out in a given area. and of course, it uses encounter tables based on terrain type, which models the influence of environment on what you find there in the way of critters.
no special techniques are used. world generation uses an "elevation splatting" technique. this elevation map then influences the generation of water on the map. water and elevation both influence the initial generation of vegetation coverage, which is generated next.
for resources, i give every 5x5 mile world map square 1000 resource points. harvesting resources or hunting animals in the map square reduces the resource points. resource points can be replenished when "the gods change the map" (see below).
at this time, the resources points in a map square do not influence the chance of encounters, until resources go to zero in the map square. then the chance of encounters goes to zero until "the gods change the map".
once per game day at midnight, the god change the map. this has a chance to replenish resource points, and models changes in water and vegetation based on climate conditions. so the weather engine and water table modeling controls the filling and drying out of creeks and waterholes etc. as the weather turns hot and dry or cold and wet, vegetation coverage can change. the general progress from cold/dry to hot/wet is: sand, dirt, scrub, prairie, tallgrass, savanna, woods, jungle. bands of cavemen come and go too, as do the animals occupying caves.
here are some other ways the world map in CAVEMAN influences the simulation:
the number and distance of hostile NPC bands determines the chance of your shelter being raided.
the number and distance of any NPC band determines resource point depletion due to nearby bands in the area. IE each band depletes resources in a given radius from their shelter.
there are probably others too that don't come to mind at the moment.
about the only thing that didn't run fast at first was changing the map. i was looping through 250,000 map squares for each type of change (such as prairie to tall grass). i switched to looping through the map once, and doing all the changes for a map square at once. ran so fast, i didn't even need to display a "The gods are changing the map..." message, which is what was done in the original version of the game (first written in 2000).
Rockland Software Productions
"Building PC games since 1988"
Members - Reputation: 1463
Posted 12 August 2013 - 12:28 PM
What optimizations could be performed, having in mind that the system could have no constrains?
You could simulate every object, aka a squirrel eats a nut and there is one less nut in the forest, maybe a bird dies of starvations that would otherwise have eaten the nut.
In such a system it would be very easy to implement player-interaction thus making it a game.
If you want a better answer you 'll have to explain what you're trying to make, and where you get into trouble.
Members - Reputation: 755
Posted 12 August 2013 - 03:30 PM
You could simulate every object
Members - Reputation: 812
Posted 12 August 2013 - 04:58 PM
Looks like SimEarth, which is probably a graphically crude by computationally interesting version of what you're describing is up for download with a quick google search. Also, things like dwarf fortress sound right up your alley.
Members - Reputation: 755
Posted 23 August 2013 - 02:34 PM
This is my second attempt to simulate masses, in Unity I started creating something similar to a Game of Life with different rules. But now I have to tweak the code to perform calculations on population densities, instead of two-state cells. The GoL is a cellular automation, but this will be a population automaton. Also, there will be map layers, and population will interact with other maps.
Members - Reputation: 755
Posted 27 August 2013 - 12:27 PM
Members - Reputation: 245
Posted 02 September 2013 - 02:41 PM
I really like where you're going with your project. I myself have been interested in the concept of employing a comprehensive simulation to manage NPC interaction, world population, and physical modelling, but the Math involved is way beyond me.
Do you have any links to to video game research relating to statistical maps, because most of the links found by Google are related to neuroscience?
Members - Reputation: 755
Posted 02 September 2013 - 06:44 PM
Hi BarefootPhilosopher, cool name, I actually do philosophy myself
Well, in the past I have read a few artificial intelligence and robotics articles/books, and implemented my own algorithm finding ordered paths to wire protoboards with electronic components in place. Now I quickly searched for mass simulation algorithms too but couldn't find anything useful, just like you did. So I'm just programming everything that I need, learning and creating tools from this experience. This resulted to be similar to image processing, on which I experimented several years ago (from CGA/EGA days to DX/OGL).
My inspiration is based on how "species" are controlled in a game like GTA, which is static, and trying to make it as massive and dynamic as a sim game. I have this moving image of how water, garbage, vegetation, herbivores, predators, people, transit, clouds, etc. interact in realtime... living in a third world city surrounded by jungle this isn't difficult When the player navigates this world, the game instantiates agents of each "species" for his first person interaction. If the player follows an agent it will behave individually, and once he gets out of view the instance will disappear.
Feel free to tweak the code or come with your own methods. I would love to share ideas with others on how to achieve this simulation. I'll take my algorithm to the point that it roughly controls most behaviors and interactions, then I'll put it on hold for several months. My actual goal is not this system, since it is just a part of the communication layer, but I need to develop it because it will be a foundation for several mechanics of the option layer:
Members - Reputation: 554
Posted 12 September 2013 - 07:19 PM
Also, there will be map layers, and population will interact with other maps.
This provokes in my mind the idea of heat maps and hill climbing. There was a college paper on crowd movement modelling that used a score system for possible destinations. That score system was a three layer heat map of Distance, Time and Discomfort.