Navigating the Labyrinth: Implementing AI and Unit Diversity in RTS Games by Miguel Martinez Olivares

 

"Navigating the Labyrinth: Implementing AI and Unit Diversity in RTS Games"

Author: Miguel Martinez Olivares

Posted on: 09/08/2023.


The Problems

    This week, I faced a multi-faceted challenge that revolved around implementing new units for the Elves and Dwarves in our RTS game. The problem was twofold: First, integrating these new units into the existing game logic without causing imbalances or bugs; second, enhancing the AI to accommodate characters with different attack ranges. The issue was crucial because a lack of unit diversity could make the game monotonous, and poor AI behaviour would directly impact the end-user experience, making the game frustrating to play.






New Dwarven Units we planned to add.                            New Elven Units we planned to add.


Problems Solutions

The root cause of the issue was the limitations in our existing AI and game logic, which were not designed to handle various unit types or attack ranges. To address this, I took several steps:

  1. Unit Implementation: I started by creating new sets of units for Elves and Dwarves, each with unique attributes and abilities. This involved not just coding but also integrating new models for these units.




  2. AI Enhancement: The AI was then modified to recognize these new unit types and their respective attack ranges. I implemented a dynamic targeting system that calculates the closest enemy based on the unit's attack range, ensuring that ranged units behave as expected.
  3. Model Offset and Behavior Trees: To prevent units from awkwardly staring at each other due to attack range issues, I added an offset to the attack range decorator in the AI's behaviour tree. I also separated the behaviour trees for controlled and non-controlled units to allow for more specialized AI behaviours.
  4. Player Base Models: I revamped the models to align with the new units, ensuring a cohesive visual experience.


By addressing these issues, I enriched the gameplay with more strategic depth and improved the AI's decision-making capabilities. This resolved the problems we were facing and significantly enhanced the end-user experience, making the game more engaging and less frustrating to play.

Comments

Popular Posts