Jump to content

Flocking Zombies - Boid behavior for zombies


Morry

Recommended Posts

Hello, I am currently working on a mod which aims to put the 'boid' in zomboid, to make zombies act more like herd animals by implementing boid behavior. Boids is an artificial life program that simulates the flocking behavior of birds.

 

There's now a version available to try it if you want to. This is very much a work in progress, the mod can currently handle around 100 concurrent flocking zombies. Put the zombie rally group size on 0 or else zombies will probably start flocking all the time.

 

How it currently works / What is implemented:

  • Only basic separation, cohesion and alignment at this moment.
  • Whether a zombie starts to flocks depends on:
    • the density of zombies in its local area, a random value which becomes less significant the higher the zombie density
    • A timer that that triggers every few real seconds, every zombie has its own timer
  • A zombie stops flocking when the zombie density in its area decreases to a certain value.
  • A grid that ensures that for each zombie only nearby zombies are checked.
  • Every ten in-game minutes there is a chance a zombie will start wandering around through steering behavior.
  • Anticipation / interception of player during lunge state.

 

Issues / To be fixed / To be added:

  • During flocking & wandering zombies will not start thumping on things they walk against.
  • Improve the wandering
  • Probably a lot more that I forgot right now.

 

Video of current work:

 

 

I based the zombie density thing on locust that start marching in the same direction when reaching a certain density, if it works that way for simple creatures such as locust than it probably should work that way for zombies too. Link

 

More on boids

flocking zombies.zip

Edited by Morry
Uploaded wip version of mod, messed up the post by pressing tab.
Link to comment
Share on other sites

Do you mean the rally group? That uses leaders that other zombies gather around right? As far as I can tell the current system in zomboid does not take other zombies into account while walking around, if it does please show me where.

 

In the video I turned off the grouping behavior from the advanced zombie settings. Boids does not use leaders, just local behavior with neighboring boids.

Link to comment
Share on other sites

I think i get the concept, but does that mean they stop at anytime after having reached the specified density?, and the meta events still works on them?,and the sandbox setting like urban and uniform distribution.

 

Most of the time i play are on ways i make a far away base, and then hunt the zombies (i set respawn to 0), if the dont stop at any given time, its gonna be hard to do that, altough kinda thrilling if you lay it on a nomad scavenger way.
 

Link to comment
Share on other sites

@Ragno

When they reach the a low density they won't always immediately stop. For each zombie there is a unique timer, when that timer triggers and a random value between 0&1 is larger than 0.5 then the zombie check if it needs to change it's flocking behavior. So they probably will stop but it might take a bit longer because of the randomness.

 

Meta events should still work, because certain behavior is hard coded in the update function of zombies. Urban / uniform should still work, I don't see a reason why it should not. Only thing that does not work currently is thumping against objects while flocking/wandering, because the function responsible for that has some hard coded silly state checks in it

 

Zombies only flock when they are 'real' zombies, which means they're in the same cell as you. I can't adjust 'virtual' zombie behavior as far as I know. So they should not be able to flock too far away from you.

Edited by Morry
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...