Don't simulate what the player does not see !

Started by
6 comments, last by Ashaman73 13 years, 3 months ago
Don't simulate what the player does not see !

Well, this seems to be the tenor of some AAA developers (FEAR,Halo ?). In my game (RPG) the first attempt was to simluate the world on an per entity level, but due to performance issues, I want to move away from a per entity simulation to a per area simulation with an abstract AI controlling entity population and spawning entities on-the-fly.

Now I got a design question: should a entity has a persistent character or is it just a feature no player will really recognise. I just talk about common monsters (some spiders, zombies etc), not about special npcs.

So, what I mean is the following (it is similar to L4D):
When the player enters a area, new creatures will be spawned according to the area profile. The player is able to interact and fight these creature, once he left the area, the creature will be removed again.
The big question is, should I save the characteristic of each creature for the next time the player will reenter the area, or is it just unneccessary overhead and I should respawn a new creature ?
Sure, there will be some obvious characteristics (species, size etc.) which will be saved in the area profile, but what about details like health or equipment ?
Advertisement
There is a compromise: store info about the state of a area for a period of time, and then discard it.
The advantage of this is that it resolves another silliness. If I enter a cave, slaughter all but one goblin, who I beat down to a tiny sliver of health and then leave, it is just as jarring to find the cave in exactly the same state three years later as it is to find it completely replenished three seconds later.
Here's my suggestion: As Sandman said, store the data for a time. So for a few minutes, or until the player gets far enough away from the area for it to be considered free to operate without him, hold it in memory and don't let enemies spawn inexplicably or anything like that.

After that time passes, though, and it's out of the player's view, don't worry too much about simulating everything that's there. Don't just reset it, either. Give each area some abstract stats that can be modeled with very light resource consumption. Say a player loots and burns a village, then wanders away. Give that village 2% "Structure" and have it slowly increase back up to 100%. If the player comes back when it's at 15%, some of the buildings will have started to be repaired, and the villagers will be actively engaged in rebuilding. At 50% spawn an area that's partially functional, maybe a shop or two are up and running. At 87% there's still evidence that it's been damaged, but it's pretty much all there, and at 100% it's a new, complete zone. A town might have stats for wealth, structure, population, military presence etc. and a player's actions toward it can cause it to get richer, more or less military presence, higher or lower population. In this way you not only present a world that feels like it's operating when you aren't looking at it, but which responds correctly to events in the world. You don't have to save the location of every dropped sword and burned tree, just make sure that it looks about right every time you go there.
@Sandman and Iron Chef

I think that it will not hurt to save some profiles of creatures when despawning. I dont need to save all data, but some characteristics most obviously to the player (race,class,size,hp,equipment ect.)

@Iron Chef
I already thought about a meta-simulation. Hives(my game setting is a dungeon-world) expanding into new regions, conquering weaker hives, or rebuilding/regrowing when the player does not destory all nests or food/water resources. Abstraction of single creatures would help a lot at this level, but I see that atleast for a few minutes it is necessary to hold some characteristics of met creatures to keep the illusion of a persistent world.

I think that I will heed to your advices.

There is a compromise: store info about the state of a area for a period of time, and then discard it.
The advantage of this is that it resolves another silliness. If I enter a cave, slaughter all but one goblin, who I beat down to a tiny sliver of health and then leave, it is just as jarring to find the cave in exactly the same state three years later as it is to find it completely replenished three seconds later.


One way to implement this is to save the entire zone state and the time that the player exited the zone.

When the player re-enters the area, you can quickly simulate passing of time in a blink of an eye before handing control back to the player.

To keep immersion when the player quickly exits and re-enters you'll need to save everything including monsters' health, position, etc. Apart from that the exit time is the only other thing you need to save. The rest involves designing your game-state engine so that you can advance it arbitrarily. If too much time has elapsed, instead of advancing time, simply reset and repopulate the entire zone.

One way to implement this is to save the entire zone state and the time that the player exited the zone.

When the player re-enters the area, you can quickly simulate passing of time in a blink of an eye before handing control back to the player.

To keep immersion when the player quickly exits and re-enters you'll need to save everything including monsters' health, position, etc. Apart from that the exit time is the only other thing you need to save. The rest involves designing your game-state engine so that you can advance it arbitrarily. If too much time has elapsed, instead of advancing time, simply reset and repopulate the entire zone.


There is a big problem with this. Pop into Oblivion or Fallout 3 and wait for a day. That isn't a blink of an eye, its a noticeable pause that will happen every time you enter an area. A day is short enough that you really do need to remember something about how you left it or it will seem odd, but its long enough that a complete simulation will cause some trouble. It only gets worse with more time to simulate too.

The suggestion to save some general stats about the zone, a profile to turn those generalities into specifics, and maybe a current loot list should be all you need.


Lets say there is a goblin village with 30 Goblins in it. There is a loot list for the zone and a profile of the structures and population. You partially raid the village and leave, but come back the next day. The general stats plus the profile should be able to keep track of and model rebuilding of the structures and healing of the population. The loot list should be up to date with what is left after you left. The items left aren't necessarily where you left them, but they don't need to be.

Lists of everything in a zone can get big and modeling the changes is not a quick feat, but faking it in many ways is all that is needed.
I kind of hoped that using a top down approach to the world would help me a lot with this kind of thing.

Basically instead of working up from dungeoncrawlers to a village around the dungeon to something outside the village my plan has been to take a whole world mapped out using Freeciv then zoom in on desired areas having all that surrounding info already in existence.

I was abstracting the monsters more, using just two monster type units, "monsters" and "flying mounts" aka "flying monsters" but it would be equally possible to use the Fantasy Modpack that has various different kinds of monsters.

Then if you wanted your individual character scale slaughtering to actually show up on the larger scale you'd simply put a point or two of damage onto the monster unit in that Freeciv scale tile of the Freeciv scale map so that next time that tile was zoomed in on a slightly damaged unit of monsters would be presented on the small scale instead of an entirely intact unit of monsters.

My hope is that this top down approach will neatly help not only with that kind of persistence but also in things like providing a huge number of "implicit" quests implied by all the things a Freeciv player would be able to do on the Freeciv scale, such as causing that unit of monsters to move to a different tile of the large scale map. There's a quest right there: figure out as an individual character how to cause that Freeciv scale move to happen. Every single option a player using the Freeciv client instead of the individual character client could do becomes implicitly an at least potential quest, and can be an actual quest as simply as by having someone who can log in using Freeciv so that the quest becomes "find the character whose player can do that and convince their player to do it"...
@loom_weaver

When the player re-enters the area, you can quickly simulate passing of time in a blink of an eye before handing control back to the player.

It is always the question how detailed should be this simulation. I try to archive some ad-hoc spawning to avoid performance issue, simulation of a long duration will most probably introduce new performance problems.


@JasRonq

Lets say there is a goblin village with 30 Goblins in it. There is a loot list for the zone and a profile of the structures and population. You partially raid the village and leave, but come back the next day. The general stats plus the profile should be able to keep track of and model rebuilding of the structures and healing of the population. The loot list should be up to date with what is left after you left. The items left aren't necessarily where you left them, but they don't need to be.

Lists of everything in a zone can get big and modeling the changes is not a quick feat, but faking it in many ways is all that is needed.

This is it, we are making games not world simulations. Adding an (low detail) abstraction layer which will be simulated during the time the player is absent (zone state, population count etc.) seems to be more promising than saving every information about items, npcs,equipement,health etc. over a long time.

This topic is closed to new replies.

Advertisement