We have not been able to upload a dev log for a while, but it is not because we have frozen but, on the contrary, we are advancing and improving Lamentum day after day.
In the devlog of today we are going to talk about AI in depth since last week we have been very focused on improving and expanding this topic.
The AI of our enemies has been programmed as a state machine and we have developed it through independent modules so that we can create different patterns of behavior following some basic rules.
The states on which our AI is based are:
– Inactivated: The AI is not active in the scene, it needs an external factor to start.
– Rest: The AI is active but has no objective.
– Alert: AI can move between routes with points of interest.
– Attack: AI in action fighting.
They may seem like basic states but these allow us to have different types of AI depending on the type of enemy, for example, some enemies in the Attack state will seek to reach the target according to their range of action while other enemies will maintain distance because their role is to spawn new enemies.
We previously showed how our AI was behaving in motion and explained that we had programmed a raycast system that would allow it to detect if the direction of movement was adequate or if it had an obstacle and needed to reposition itself to move forward. This in theory worked fine but not as well as we would have liked, in some cases with several enemies simultaneously strange situations were generated and some corridors with enough obstacles did not take a clear route and could lead to loops, so we have discarded that part and we have implemented a pathfinding algorithm that in turn takes into account the size that we want to define our enemies.
We have simulated a quite rare situation with several equal enemies in the same room, although we really doubt that such a case is in Lamentum, we wanted to put this algorithm to the test and we liked the results:
The good thing about having structured the AI into independent modules is that by discarding a part of the work that we had before with the raycast movement system, we did not have to redo the entire AI since it was only the module that we used for the movement. In fact the previous system we have left to some enemy that we want to look more “dumb”.