Posted July 31, 2022 by LMG3864 Games
#Game Design #Blueprints
Hello everyone! Welcome back to Blueprints, where I explain some of the design decisions of Aerostrike. In this issue, I will explain another method used to make each ship behave in its own way.
Aerostrike's AI is built as a finite-state machine. To oversimplify what a finite-state machine is, the AI will change what it does depending on a given state. Each state in Aerostrike is set by a number. The AI will check what state number it currently has, and then run a code assigned to that state. If the current state is "Idle", then the AI will run the "Idle" code. It is that simple. The best part is that each state can be customized to work off each AI's set of variables to create different behaviors.
The most basic set of states would be "Idle", "Attacking", and "Chasing". In "Idle" state, the AI will simply be waiting until the player comes close enough so it can see them. Once that happens, the state will change into "Attacking". Here, the AI will aim at the player and fire until either of them explodes into tiny bits. However, if the player flies too far away, the state will change into "Chasing". In this state, the AI will fly towards the player until it is close enough, switching back into "Attacking" state. Now let's customize these behaviors a bit.
Through the use of variables we can change how the AI understands these states and their rules. Long-range ships like the Javelin can see and fire from further away. This means that they will mostly spend their time aiming and sitting still. Meanwhile, short-range ships like the Scout will have to get much closer to the player. This makes the player move away and out of the range of the Scout. This causes the AI to chase the player around as they try to get close once more. If we make the weapon range be zero, then the AI will quite literally crash into the player, something that the Stinger is well-known for. With this knowledge, we can adjust each ship's variables and behaviors to fit their intended roles.
Combining the design ideas of each ship, the use of variables, and multiple behavior states, it is now possible to create the various enemies of Aerostrike. Wait... am I forgetting something? Join me next issue to find out. Stay safe, Pilots!