Is Artificial Intelligence week! If I though the complexity of the procedural level generation was quite something, digging deeper into the basic AI development for the enemies has been also quite the endeavor.
At the moment all enemies share an EnemyBrain script which follows few simple rules to interact with the user, in a nutshell is based on a “Wander, follow, retreat” behavior where the enemy wanders until the Player is in range, at that point the enemy follows the player and attacks, but also retreats if is low on health or the player is too close.

The main problem with this is that the enemy always tries to find a direct path to the player, as well as takes a direct path when escaping, which does not always work as there’s obstacles and walls in the way. This is where the A* Search algorithm comes to play.
This algorithm plots an efficiently directed path between multiple points, called nodes, by searching among all possible paths to the goal, and among these paths it first considers the ones that appear to lead most quickly to the solution.
Premade tools or implementing my own solution?
There are some premade tools in the Unity store that implements the A* algorithm, and certainly will be more polished than creating a custom solution by myself from scratch, however, if I backpedal to the main objective I wanted to reach by releasing this game, then the learning process weights more than reducing the launch date a couple of weeks.
There’s always lot of trade-offs to take into account when choosing to take one approach or the other, for example: While I’m not going to create a game engine from zero and Unity is more than enough for what I want to create, I also give myself some buffer to create certain things from scratch in other aspects of the development. For this I’ve discovered Sebastian Lague has a really good tutorials about this implementation.
I’m not discarding completely yet to use a premade tool for this, definitely some of them look amazing and has a lot of work behind, but I’ll give it a go for a few weeks before any final a decision.
Added this week:
- Enemy permanence: When enemies die, leave a corpse behind and not just disappear
- Blood splatters! Each impact shot leaves a blood trail in the ground.
- Sound on weapon change.
- Sound on getting damage and doing damage
- Added a new pickup Ammo item.
- Added a portal item and animation to move between levels.
- Added bullet new sprites for character and player, no more prefabs.
- Added new sprites for coins.
- Fixed a bug with the procedural level generator where some floor tiles remained empty.
- New enemy (Tiki Warrior)with a basic A* AI implementation.
To add next week:
- Keep working on the A* implementation.
- Keep working on the game art: Explosions, more effects, more sounds ( for example when enemies or the player are hit), dust on move, shadows, new random tiles for walls and floors, etc, …
- Start to plan an itch.io demo release in the next month
Leave a Reply