Integrating the Boid logic with the Vessel Flight Controller took some doing, but – one ‘hack’ aside – everything is now wired up and ship shape (pun intended).
As planned, everything is nicely abstracted, and the Pilot has to fly the vessel using the Boid ‘steering’ input, with the same controls the player has. So the Pilot AI can be given simple rules and multiple prioritised objectives, and then decide how it wants to go about fulfilling them. Changing the Pilot’s objective priority changes the heading and velocity of the vessel as fast as it can.
I’ve now got to run this lot through the mill – attack the player, attack each other, defend a vessel, defend a station, and so on. This will lead to an ‘alpha’ pass of balancing (i.e. good enough for now but not final).
The ‘hack’ I mention is the lateral/dorsal velocity compensation. Something I wanted to add as a flight model turned out to be vital for the Boid logic to ensure they try and remain inside the local volume of space where the combat is happening. So it’s been introduced, and basically helps ensure your velocity tends towards the direction your vessel is facing. It should work by applying a counter thrust in the opposite direction to any lateral movement, to bring any ‘drift’ down to zero. Sadly I can’t balance it out, and it keeps overcompensating to produce horrific jitter back and forth. For now it just works by reducing the drift velocity by a percentage every frame. So, a hack for now, but, one day, I will return!
“It keeps overcompensating” -> you tried PID control yet? Or something similar?
Hi Cornflakes – no nothing as yet. The same code is in the Player flight controller (also the same code) and it works a treat there. The Boid logic is continually fighting the compensator, so I need to do some balancing/tuning in there to stop it over-steering. I’ve left it on the bug-list for now 🙂