NeoMecha v0.6.0 Range and Reactions devlog

Background Gameboard

Before I started features for this version, I took care of the biggest visual eye sore, the default cornflower blue in the background. I tiled the existing map around the actual map and limited the camera so that you can’t scroll past the actual map. The result looks much better but there really needs to be some sort of border between the real map and the background maps. That will be for later.

Ranged Attacks

I Added a basic blaster attack. it works but it is not hooked up to the reaction system so is still not really adding to the game play yet.

Refactor Reactions

The first version of reactions were completely hard coded in the Melee Attack Command. To expand reactions, I needed to refactor them into a real system. This created some bugs.

Bug 1 – When you attacked the enemy on the 2nd turn all the obstacles were removed from the game board, allowing you to move through then.

Bug 2 – You can’t damage the enemy.

Bug 3 – Your second movement breaks the game.

Bug 4 –The enemy always reacts to your movement when it should react only when attacked

Once all these were fixed, the refactored reaction system opened up some cool new possibilities.

Dashing now avoids damage

You can now dodge away from an enemy when they move toward you

Visibility Change

My initial implementation of Visibility was overly generous, to the point where you could see around corners. This was because I allowed tiles to be partially visible, I calculated a tiles visibility by looking at the two tiles in front of it and averaging them. Which meant a tile around a corner could still be 10% or 20% visible. To fix this I refactored visibility to only make tiles visible or not visible instead of maybe partially visible.

Melee Refactor

Previously melee attacks targeted two squares and prompted you to pick a “High”, “Mid”, or “Low” style. Depending on what style you picked, and which your enemy picked, you would either do full, half, or no damage. It really sucked choosing to attack and doing no damage without a clear indication of why. I decided to remove High/Mid/Low and replace it with a system that allows you to attack ~7 tiles at a time, with no chance of doing “no damage”, and the pattern is different for each new style, Right/Center/Left.

Replacing the style system was pretty straight forward, but once it was in the game, it started to lag for about one second every time you attacked the enemy. I cracked open the logs and saw that processing melee attack was taking between 500ms – 1000ms. I added some additional logging to track down exactly what was causing the game to hang. It turns out it was a bad Linq statement that was running in O(NM) time. I refactored this down to O(N) time and the melee combat was looking pretty good.

Dodge Refactor

Now that melee attack affected more tiles, the existing dodge would not get you out of the way of any melee attack. I increased the range of the dodge to two tiles to put it on par with the melee attack.

Reaction Indicator

To try an give combat more depth I added reaction indicators that give you a general idea of how the other player will react to your actions. They let you know if the other player will attack or defend and if they will reaction to any movement or just to an attack. You can use this information to plan out how you are going to attack.


At the start of the match the you don’t know where the enemy is but the AI knows exactly where you are. To make it thing more fair and enable you to get the drop enemy, I added a sensor to show the player roughly where the enemy is. The sensor shows the world in top down instead of isometric, oops, but it will work for now.

Leda AI

The existing AI was super basic. It moves toward you and if it is next to you it attacks, and it always picks a melee attack reaction. To be able to test out new features I needed an AI that would do more then just the bare minimum. I built out an AI I called Leda after a moon of Jupiter. It is broken down into a series of strategies that small chunks of code that pick the actions or reactions for a turn. Leda has three strategies,

  1. A strategy for moving toward the player when they are not visible
  2. A strategy for moving toward and attacking the player when they are visible
  3. A strategy for picking reactions

With only three strategies Leda is still pretty simple but by using the strategy pattern I will be able to expand the number strategies it has to give it more depth. I can also follow the pattern that I developed for Leda to create other enemies that feel different.



Gameplay Tweaks

Now that I have a better AI to play against, there are some things the jump out as needing to be fixed. Previously I decided that if a players first reaction didn’t get triggered by an enemy action, it would check to see if the next reaction would be triggered, and if it could use that. This really didn’t feel good so, I changed it so that only the first reaction is looked at. The next thing, was that enemy reactions were supposed to be like a puzzle but only having a max of two made the game too simple. To fix this I upped action/reaction points to 4 and that feels better. The last thing was that it was too easy use move/dash to exhaust an enemy’s On Movement reaction and go in for a hit, so I made the reactions loop so that you always have a reaction when you are attacked.

NeoMecha is really shaping up. It needs a ton more work, VFX, SFX, Animation, more attack/react options. but the main gameplay loop is looking good.