Blueprints #3 - Building an AI
Hello everyone! Welcome back to Blueprints, where I explain some of the design decisions of Aerostrike. In this issue, I will give some insight into how the AI of Aerostrike was made.
When I first started developing games, one of the first issues I stumbled upon was how to make an AI. I understood the concept of an AI, I just was not sure how to write it into code. It was a problem that stumped be while creating my first full game, Attrition. However, one day I realized something important, that I had already created half of the code I needed without even realizing it. It was the code I used for the player. It did all the functions that I needed the AI to do. All that was left to do was automate it.
This little bit of information was something that would prove very useful in the development of Aerostrike. If I needed the enemy to fire its weapon, I could simply reuse the code from the player's weapon, replacing the "button pressed" input check with a set of conditions, like "AI is trying to attack the player" and "AI can see the player". If I needed the AI to move, I could replace the directional buttons with an angle of movement and a set speed. Anything the player could do, an AI could do as well. It was the same base code, with slight modifications.
Now we have a way to make the AI do things, but how do we actually make the AI as a whole? For starters, it is much easier to approach the issue from a different perspective. Instead of trying to "build the AI" in one go, make the AI "do things" one by one. First, make the AI move; not in any particular direction, just move somewhere. Then we make it move in a specific direction, let's say left. Next, we make it move in the direction of the player, following them around. Next, we make it stop at a certain distance from the player. Finally, we give the AI the ability to fire a weapon from the reused player's code; without any conditions, just let it fire all the time for now. The end result is an AI that will chase the player around while attacking them. An AI has been successfully built!
Applying this methodology we can create the various systems that make the whole of the AI, one by one. However, having all enemies behave the same way is not quite as entertaining. How do we change that? Join me next issue to find out. Stay safe, Pilots!
PS: If anyone has any tips on making AI, or wants to point out anything wrong, leave a comment so others can see.
Get MF-01 Aerostrike
MF-01 Aerostrike
A Tactical Shmuplovania.
Status | Released |
Author | LMG3864 Games |
Genre | Action, Shooter |
Tags | 2D, Bullet Hell, Exploration, Metroidvania, Pixel Art, Sci-fi, Shoot 'Em Up, Singleplayer |
Languages | English, Spanish; Latin America |
Accessibility | Configurable controls |
More posts
- Patch Notes - Hotfix 2.0.118 days ago
- Patch Notes - Version 2.0.025 days ago
- Plans of the Month - September 10th, 202494 days ago
- Plans of the Month - July 30th, 2024Jul 31, 2024
- Plans of the Month - July, 2024Jul 03, 2024
- Patch Notes - Hotfix 1.5.3Feb 15, 2024
- Plans for the FutureDec 19, 2023
- Patch Notes - Version 1.5.2Dec 11, 2023
- Plans of the Week - December 4th, 2023Dec 05, 2023
- Plans of the Week - November 27th, 2023Nov 28, 2023
Leave a comment
Log in with itch.io to leave a comment.