(One for fans of Peter F. Hamilton there 🙂 )
Boids – if you’ve never heard of them (and I always use a very dodgy Brooklyn accent when pronouncing ‘Boids’) – are an algorithmic approach to simulating environment and goal based steering behaviours on an object, say a bird.
The algorithm was developed way back in 1986 by Craig Reynolds, and applies basic rules to the object which – when taken together – result in complex, dynamic and emergent behaviour, emulating a ‘flock’ or group of objects moving in unison.
I won’t detail the basic algorithm too much, but the three simplest aspects are;
- Separation – avoiding local flockmates
- Alignment – heading in the same average direction as other flock mates
- Cohesion – grouping with other flock mates
These three basic rules provide flocking behaviour, and it looks pretty cool. Many screensavers have been written on this basic premise. You’ve even see it at work in the Lion King(TM – Disney) in the Mufasa/Herd stampede scene.
Of course, I wanted something more complex 🙂 The Boids algorithm is superb in that it is easily extended to incorporate other steering behaviours – such as heading for a target, or avoiding an obstacle, and so on.
Applying these rules carefully, can provide some pretty entertaining and frankly superb ‘intelligent’ behaviour. I want this for combat in Dominium, so I set out to build a sandbox to get the basics up and running, and then add each ‘layer’ of steering behaviours to get what I want.
Frankly, pretty chuffed with the results so far… observe…
So – aside from me saying ‘basically’ basically way too often – that’s looking pretty good IMHO. Almost a game in it’s own right! But, lots of work to do to get this into Dominium yet.
Players and NPC’s alike must be subject to the same flight mechanics – anything else is totally unfair on one side or the other, and I want Dom to be fair and fun. So, these ‘Boids’ will become the pilots of vessels, and the pilot must use the Vessel Flight Controller to make the vessel obey their whim, exactly as the player has to.
The resultant Boid steering will become the ‘desired heading’, and it will tell the VFC to move the vessel accordingly. The vessel will do it’s best to fulfill this need, but it may be slower than the Boid would like. This becomes a feedback loop – a good one. You’ve experienced it in many games to date, where you aim at a direction and then your ship slowly comes around to head along it. In the meantime you may have changed your mind as it’s taking too long, and changed heading, and so on.
Then of course there are fleets, squadrons, mutual foe’s, temporary alliances, being attacked by a former neutral/ally, or accidentally hitting a neutral bringing them into the furball, the flight leader could order the flight to attack their target, disperse, attack their own targets, etc… you can go too far 🙂
Right now I have a nice system where I can add in new rules as I get to them. The Boid system works nicely and would do ‘as is’, so I can make a start on bringing it into Dominium proper without any more rules applied.