This is a project based on another tutorial from Sebastian Lague (an awesome developer and tutor, follow him on Youtube).
The maps and obstacles are procedurally generated, my part in this game, was to develop the AI, Pickup, and UI systems, as well the visual debug tool!
My goal in this project was to develop a Utility AI Bot to play this game. Utility AI uses a reasoning system, that is essentially a scored-base algorithm that calculates the best course of action every refresh cycle.
In this implementation, we calculate the best position that the bot should move (considering some strategic goals) inside the scanned positions (represented by the little spheres). This scanner is optimized to not consider unreachable positions.
I’ve also made a Debug Tool that helps the Game Designer see the scores in the Scanner (the grid of spheres), in real time. This tool shows color-graded spheres with a score, that represent every position used by the Scanner to evaluate the best position to move.
The designer can tweak several key aspects of the Scanner, but it must be done with caution, in incremental steps, to avoid overwhelming the computational power. We can, for example, expand the grid size (or the sampling density) while to compensate, we diminish the refresh interval.
Tweaks and maintainability
Another key aspect of this Utility AI approach is the ability (trough scripts and methods - e.g. this specific script ) to add, remove or tweak several “considerations” or “reasonings”, such as distance from the player to the nearest Pickup, nearest Enemy, the amount of ammo, amount of life. All these things have their respective “weights” and by tweaking, adding or removing them, we can achieve easily several different behaviors. If for example, we want to make the bot avoid bombs, we add a simple method that considers the distance between the player and the nearest bomb, and we give it a weight to that consideration, a some sort of precedence order.
This approach is much more easy to maintain and tweak when compared to the well-established, but harder to tweak, FSM (Finite State Machines) or Behaviour-Trees.
If you want to talk more about this and others AI approaches, just give me a shout!