Hidden Mechanics In Slime Battle Royale
There are some things going on behind the scenes in Slime Battle Royale, and I wanted to take a moment to share it with everyone.
AI Movement
First, let me say that originally I had pathfinding for the enemies, but ended up having to rip it out because of some issue with it. Instead, so I could get the game submitted in time, I made a simpler system for the AI. They have two states: Random and Towards. By default, all AI uses the Random state.
Random State
In this state, the AI chooses one random direction to move, then the next frame they choose to move towards the player on the X or Y axis. I was hoping this would work out, but in the end, they seemingly just randomly move.
Toward State If the player sits still and doesn't move for 3 seconds, all AI switch to this state. In this state, they evaluate a towards vector and move towards the player. If the player moves, then they all switch back to the Random state.
AI Attack Choices
In battle, it's rock paper scissors. In real life, there's not much strategy to it, and it all comes down to random. In Slime Battle Royal, it's all random as well, with some added weighting. There are six arrays that are filled with Rock, Paper, or Scissors attack enums. Some arrays contain more of one type than the others. Each enemy is randomly assigned one of these arrays, and chooses a random attack from their array when attacking.
AI vs AI
Battle commences between the player and an enemy when they are next to each other on adjacent squares. However, did you know the AI's will also battle it out among themselves? It's a battle royale after all, and they want to win to. Each time two enemies are adjacent to each other, a random roll is thrown to see if they'll fight.
If you haven't had a chance to check the game out yet, head on over and give me some solid feedback and rating. I want to develop this out post Ludum Dare into a full game, with a much better system for fighting.
https://ldjam.com/events/ludum-dare/41/slime-battle-royale