Jump to content
  • Advertisement
Sign in to follow this  
altich88

Zombie Game: zombie collision avoidance/response ideas needed

This topic is 2505 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

I'm making a top-down zombie shooter and I'm not sure on how best to implement the collision response of the zombies. As you can see in the video, zombies are tested for collision with each other and the main player using circle-circle collision. When two zombies are found to be overlapping, they are "pushed apart" by translating them in opposite directions using the direction vector between their two centres.

This however makes the zombies rather "slippery" as you can see and does not look quite right. What would people suggest as a superior algorithm for zombie-zombie collision avoidance/response?

I have tried only allowing a zombie to step forwards if it does not cause a collision with another zombie, but this can cause a single zombie to block an entire crowd of zombies that are trying to follow the player.

Share this post


Link to post
Share on other sites
Advertisement
Perhaps if the zombies took a path of least resistance toward the player with the condition that they were not traveling any further from the player. Have a vector facing toward the player from the zombie's current position. Find a vector which would have a positive dot product with the facing vector to traverse closer to the goal. That may cause tighter grouping around the player.

Share this post


Link to post
Share on other sites
_Tinker's suggestion is a simple, principled and "politically correct" zombie control system, but it could look too dumb with concave obstacles: the player could herd zombies into a dead end from beyond a wall, leaving them there until he passes in front of the opening.
In an urban setting, the typical concave obstacle is a room with a door: quite close to the worst case and presumably very common.

You could use preprocessing to identify dead ends that should only the be entered if the target is inside, or you could make individual zombies detect that they are walled in and repel each other, and themselves from the walls, with progressively increasing force or desired distance (with the intended effect of "wasting" a few zombies to sparsely fill dead ends and repelling and rerouting others that would enter the dead end).

Share this post


Link to post
Share on other sites
If I'm understanding your scenario correctly, the zombies push each other around to navigate, but this is resulting in a jittery effect.

I'm sure you know why this is happening because each force is "fighting back" on the other force like a constant struggle. This does not allow for a smooth movement.

What you could do is implement some sort of neighbor steering A.I. Each zombie has the ability to create a group by adding neighbors. Whenever a zombie B enters another zombie A's "neighboring radius" , that zombie B is added to zombie A's neighbor list. In the case of multiple zombies, the zombie with a lower neighbor count is instantly added to the bigger neighbor group.

Note: this neighbor list should not be represented by just a list, but by a data structure that controls the steering behavior of your zombies. Each zombie should have a reference to this class.

So with each zombie in a proper neighboring group, the steering behavior's task is to keep the heading direction of each zombie in such a manner that there will be a specific distance of each other all the while moving toward the target (player).

Breakdown:

  1. Steering AI class -> NeighborSteering (or something of that sort)
  2. For all Zombies, each one should reference this NeighborSteering class.
  3. This class will also set each zombie's neighboring radius size.
  4. Whenever a zombie A enters another zombie B's radius, determine if zombie A's neighbor size is larger than B's. If so, add all of zombie B's neighbors. And vice-versa. However, if the size is equal, simply add to whichever one.
  5. The steering class will know how many zombies are in a group and where (because they are referenced in this neighboring class). With this information, we can calculate the heading vector of each zombie to the target while keeping each one in a specific distance from each other. (look up "flocking")
  6. You can even implement behavior so that a zombie can detach itself from its neighbors and go on its own path. Also, you can control if the zombie leaves, so does its original neighboring group. (i.e. big zombie group splits into two smaller groups instantaneously. )


There's a lot you can do. Hope it helps generating ideas.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!