Event Driven Cage Match: Predator/Prey

So I finally have what I consider to be the minimum – bare minimum, mind you – bar of the 3rd Space gaming framework finally passed. What I have working is a Predator/Prey simulation using the Boid rules for modeling flocking behavior. Boids were invented by Craig Reynolds to model the flocking behavior we see in birds, fish and other herd animals. The rules in Boid are actually butt simple and all local – i.e. simulating the flocking behavior only relies on the emergent behavior of the individual’s action, not some “higher authority” guiding the individuals, keeping them in formation.
In any event, what you find if you look for any Java code which implements Boids, the seeming universal implementation is to actually keep a global list of the boid positions – i.e. an implicit “global” which really shouldn’t be present. The reason why this is so is, of course, because Area Of Interest management (AOI, for short) is a tough thing to do, even if you are simply running the simulation in a single process.

>

Predator/Prey Boids, using Voronoi based AOI management in an event driven simulation

I really needed a non trivial simulation to use as the driver test case for the 3rd Space gaming framework I’ve been working on. Flocking behavior is, as one expects, quite common in games and is something that the human players do quite frequently as well – they don’t call humans sheep for nothing. As it turns out, managing the area of interest for simulated entities and human’s avatars is rather difficult precisely because of this tendency to flock. Moving, flocking simulated entities is therefore the de facto test case that one should be using as a model when developing the basics of a large scale, distributed simulation and gaming infrastructure – i.e. if you can’t handle this, then you have no hope of handling anything more complicated.

Same as above, revealing the voronoi overlay used to maintain AOI.

So, it’s kind of cool. I now have a non trivial simulation which runs under both the event driven framework and makes use of the voronoi based AOI management. Next step is to now distribute the simulation using Coherence so I can see how well my theories of how to massively scale this framework will work.

2 thoughts on “Event Driven Cage Match: Predator/Prey

  1. Very nice and I think the whole thing has potential. I discover your blog a few months ago while searching for Jist info for my own simulator.
    I considered the Voronoi graphs for a P2P protocol implementation I’m working for my master thesis, but since the need of multiple dimensions was a requirement, the use of n-dimensional Delaunay triangulations seemed too complicated, so I’m using a CAN protocol.
    But I think that for a MMORPG the Voronoi approach suits better. I’ll keep checking your blog from time to time to see your new advances ;)
    It’s nice to discover that some people have the similar “crazy” ideas (and that they are implementing it ;)
    Great work!

  2. Thanks. It seems to be a meme that’s taking off. Ideally, the voronoi partitioning should be in 3 dimensions, but I can’t for the life of me find a reasonable algorithm like Steve F.’s sweep algorithm for 2D. For my purposes, 2D is quite sufficient – i.e. MMOG. Maybe something like EveOnline would need 3D partitioning to be useful, but for any ground/air based gaming I would think the 2D would work fine. Nice thing is, though, the AOI management I have would simply use a 3D implementation without any changes.
    Keep me posted on your work, though. I hadn’t thought of using a CAN protocol for this kind of stuff, and that does sound quite intriguing…
    Crazies have it made in this day and age ;)

Comments are closed.