top of page

Refactoring & Reworking

Writer: Liam HealeyLiam Healey

Updated: May 22, 2024

Immunity Wars

This week I spent a good amount of bug fixing and generally expanding the functionality of older systems. I reworked the AI system for the game to be more controllable and dynamic. In the old (bad) system, it would first choose an ability based on a weighted list and then pick whether it would target a random possible tile or a tile closest to a given type of entity. This allowed for very little control and customization on the design side, so I decided to improve it.

In the new system, it would evaluate all possible moves and then pick the one with the highest weight. Each ability would have a weight multiplier, variance, and modifiers.

Weight multipliers allow units to prioritize, for example, attacking over moving. Weight Variance skews the final weight value for each of its possible moves by some random amount, used for tie-breaking and allowing random behavior to keep players on their toes. Weight modifiers allow designers to determine which target locations are more or less valuable using things like distance functions and reading what kind of tile is under each location.

AI for an enemy that wants to sneak immune units using blood vessels to get to vital cells:



I also spent some time reworking pathfinding to support weighted movement costs instead of binary is passable. This was to allow for tiles that would slow down/speed up units moving through them, rather than applying a speed boost to units starting on that tile.

Lastly, I reworked the blood vessels as they were buggy and weren't able to push units more than 1 tile per turn. To do this I created a centralized blood vessel manager that stored a topologically sorted array of blood vessels and would handle the movement of units such that they wouldn't get blocked by units that haven't yet been pushed.

Comments


bottom of page