Having abstracted everything nicely, it was time to think about wiring all these tools together.
We have the following entities involved;
- Vessel – should be pretty dumb, and owns systems and reports their status (including collisions)
- Pilot – responsible for telling the vessel and autopilot what to do
- Autopilot – responsible for telling the vessel where to go and how to get there
The Pilot now can be in one of several states;
- … and so on
Which state the Pilot is in determines what it tells the Vessel & Autopilot to do, and what state it in determines on the Vessel status, whether it’s being attacked and so on. Basically, it has to get answers to a lot of questions to make informed decisions.
The above shows the scope of the initial design for the states involved, and the questions/decision making processes needed. I’ve actually simplified it further and introduced a new entity – the ‘Pilot Mind’. This new object doesn’t actually do anything as such, it just analyses and collates game information and answers questions the Pilot has to ask – such as ‘Am I under attack?’ and ‘Am I outclassed by my attackers?’ and so forth.
The Pilot Mind data mines these answers, and then the Pilot State Machine decides what state to go into. The wiring is all done, so all Pilot can transition between the various states, and next it’s a case of answering all those pesky Pilot questions…