Optimisation, New Commands, Win Condition
Table of Contents
Recen work on the “Die Commander” was a mix of performance upgrades, UI improvements, and core gameplay systems.
Some of it makes the game run smoother, some of it adds polish for the player — and some of it involved tearing down half the codebase and putting it back together again.
Pathfinding Optimisation
When controlling a lot of units, my old pathfinding approach would try to calculate every path at the same time, which could cause frame drops.
Now, units request path calculations one at a time, distributing the workload over multiple frames.
This system is adjustable — lower-end hardware can spread the calculations out more, while higher-end hardware can handle faster updates.
Pathfinding optimisation in action!
— roguephoton (@roguephotondev) July 31, 2025
Watch how units start moving one at a time - this staggers path calculations to avoid FPS drops. I’ve exaggerated it (1 unit/frame) to show the effect clearly but can easily go to 6-10 per frame.#gamedev #rtsgame #indiedev pic.twitter.com/2rD54lku3X
I might need to use a more advanced optimisation like splitting selected units to groups and calculate a single path for the whole group but for now this is sufficient.
“Hold Position” — The Command That Broke Everything
I wanted to finish the basic RTS command set by adding Hold Position alongside Move, Attack-Move, Stop and Return-To-Base (for workers).
Seems simple, right? In practice it led to:
- Refactoring the entire command handling system
- Breaking half the codebase in the process
- Rebuilding using interfaces for cleaner architecture
- Fixing all the things I broke
It was painful in the moment, but now commands are easier to extend and maintain — definitely worth it.
Upgraded Unit Selection UI
Previously, the selection UI was just a single number showing total units selected. Now it shows:
- Icons for each dice type (D4, D6, D8, D12, D20)
- Counts per type
- Sorted by tier
- Dynamically updating as selection changes
It is essential to see the composition of your army at a glance as new units production relies entirely on existing units.

Core Game State Manager
I finally implemented a Game State Manager to track and trigger win/loss conditions.
The initial rules are simple:
- Victory: eliminate all enemy units
- Defeat: lose all your units
- Draw: no new units and combat in the last 3 minutes (may change)
The system is data-driven and designed to support future custom win conditions — so modes like “king of the hill” or “score race” should be easy to add later.
Victory / Defeat Screens
When a game ends, the result is now displayed with clear Victory or Defeat screens. This ties directly into the Game State Manager and marks the first step toward proper match flow.
TL;DR
- 🗺️ Optimised pathfinding to prevent FPS drops
- 🛑 Added Hold Position (and rebuilt command system in the process)
- 🎲 Improved unit selection UI with dice-type grouping
- 🏆 Added a flexible Game State Manager
- 📺 Implemented Victory / Defeat screens
It feels good to check off some foundational RTS features and polish the UI at the same time. Next, I’ll be focusing on… well, whatever inevitably breaks when I touch something else. 😉