itch.io is community of indie game creators and players

Devlogs

Part 3 - AI

Turned
A browser game made in HTML5

I wanted to implement a free flow like combat system (Yes... I didn't foresee the complexity of such systems...).
To do that, I put in place two entities :

  • The Enemy : handle all the not in combat AI
  • The Director : take control of all in combat enemies to deliver a less messy combat experience (not everyone hitting and running everywhere)

The main idea was to make enemies take turns.
I implemented a timer with a random limit (from .3 to 1.2 secs) that triggers one of the enemies action.
This system helped a lot with the messy "all hitting together melee combat" I got when enemies were alone.

So we have 4 states for enemies:

  1. Idle if there is no waypoint defined
  2. Patrol if they have waypoints and no player in sight
  3. Follow if the player have been seen
  4. InCombat if the player is close enough => The Director is now in control

The enemies movements are handled by Unity build-in navmesh system . This makes harder the fact to avoid the feeling of the AI gliding on the floor because I don't use root motion here and animation speed can be a little off sync with actual movement.

Leave a comment