Zombie spawning OR Procedurally Populated Environment

Posted By: Zapan@work

Zombie spawning OR Procedurally Populated Environment - 03/31/10 19:16

Hi,

we want to create many zombies at runtime for our current game project (zombie-fps). These zombies should spawn always in regions which the player can not see at the current position. We want to do it like Left4Dead did it.

Valve published a nice paper how they did it here: http://www.valvesoftware.com/publications/2009/ai_systems_of_l4d_mike_booth.pdf

There is a so-called "AAS" Active Area Set which we should also use. But how do we create such a thing? Has anyone a good idea besides "entity-trace-test"-things? laugh
Posted By: Wicht

Re: Zombie spawning OR Procedurally Populated Environment - 04/01/10 07:44

Divide your Level into small cubes.

Example:


Use the position of the camera and the look-vector to determine the hit cubes. Each spawnpoint can create the enemies except the spawnpoints inside of the hit cubes.

The calculation could be multithreaded.
Posted By: Damocles_

Re: Zombie spawning OR Procedurally Populated Environment - 04/01/10 09:28

Its easy if you have doors seperating the areas.

By passing a door or other "plane" you can always determine wich room
was entered and which one was left.
Then you only spwan into rooms that are not the current
or the one adjacent to the current.
(hence the invisible rooms)
Posted By: EvilSOB

Re: Zombie spawning OR Procedurally Populated Environment - 04/01/10 11:29

My idea kindof depends on the process you use to decide what co-ordinate to spawn at.

Let say you just have a function that picks random locations throughout your level to spawn at.
This function can choose a random co-ordinate (at ground level),
check to see if th co-ordinate is inside the view fustrum,
and abort this co-ordinate if it IS inside the view area.

The check you can use to see if the co-ordinate is in view is this,
Code:
...
   VECTOR tmp_vec;   vec_set(tmp_vec, spawn_vector);
   if(!vec_to_screen(tmp_vec, camera))
   {
       //create a zombie at vector "spawn_vector"
       //it cannot be seen by the camera because of angle
   }
   else if(tmp_vec.z >= clip_far)
   {
       //create a zombie at vector "spawn_vector"
       //it cannot be seen by the camera because of distance
   }
   else
   {
       //DONT create a zombie because vector "spawn_vector"
       //CAN be seen by camera
   }
...


This is just an idea. Untested concept and coding...
Posted By: Zapan@work

Re: Zombie spawning OR Procedurally Populated Environment - 04/01/10 12:22

How can I decide where to place a zombie? Should we place hundreds of spawn_points in the level or create some regions (2D shapes with a Z-Height). I like the idea behind the region but how can we create such a thing?
Posted By: Wicht

Re: Zombie spawning OR Procedurally Populated Environment - 04/01/10 12:58

You have to "connect" a spawnpoint with such a little cube. I would do it with a special data structure. Maybe some connected arrays.
Posted By: EvilSOB

Re: Zombie spawning OR Procedurally Populated Environment - 04/01/10 13:49

There will probably be many opinions on this, its up to you.
IMHO, hundreds of little spawns will be 'messy' at map design time,
and possibly CPU hungry, but it may be suitable in some cases...

My preferred option is yours. Create some invisible & passable 2d models that
"fit" various sections of flat/open ground.
This includes inside buildings etc. By open I mean no furniture, walls, etc.
These are your spawn regions.
Their actions will spawn zombies in random locations within that region.
One action per region spawning random numbers of zombies based on the region size.
As each zombies is 'spawning', you can use something like my previous code to see if its 'safe' to spawn there.
If it passes the "in-sight" test, then spawn the sombie and instantly get it to do
a c_rotate of 360 degrees. If it hits anything, UN-spawn that zombie.
Posted By: PrenceOfDarkness

Re: Zombie spawning OR Procedurally Populated Environment - 04/24/10 14:41

to be honest this seems sort of easy to me... I would setup spawn points where the zombies would be allowed to spawn through out the level. Then I'd have the player emit a c_scan. All the spawn points would be some sort of invisible block or something and when scanned it would check if:

A) It can see the player
B) If it's to far away (B could be eliminated by adjusting the c_scan.

I'm going to be using something like this for my RPG. I will have a bunch of spawn spots through out my level, or just 1 spawn spot per room.
Posted By: darkinferno

Re: Zombie spawning OR Procedurally Populated Environment - 04/25/10 16:51

agree with PrenceOfDarkness, i dont see why this is so difficult
Posted By: Machinery_Frank

Re: Zombie spawning OR Procedurally Populated Environment - 04/26/10 06:38

.. as long as it takes scene management into account. Otherwise it can slow the system down in bigger levels.
© 2024 lite-C Forums