RTG
What it is
RTG is a real-time strategy prototype. Drag a box with the left mouse button to select units (they turn blue), then right click to send the group somewhere. A yellow box shows where they will end up, and the group keeps its shape on the way instead of piling onto one point.
How it's built
I wrote it in C++ on SFML 2 in 2018. In 2026 I moved it to SFML 3.1 and my library kazilib, and compiled it to WebAssembly so it plays in the page with no server behind it.
- Group movement: the game computes the bounding box of the selected units, moves its centre to the clicked point, and gives every unit the same offset as its destination. That is why the formation holds.
- Units step at most one pixel per axis per tick toward their destination, so they move in straight or diagonal lines.
- The game loop runs a fixed 60 ticks a second whatever the display rate, catching up at most five ticks per frame, so a 120 Hz screen does not run the game twice as fast.
- The port fixed three old bugs: a right click with nothing selected read the front of an empty list, a unit's selected flag was never initialised, and a destination between pixels made units shake around it for ever.
- A headless browser test drives box selections in both directions, group moves, single clicks and clearing the selection.
Timeline
Written in November 2018 without AI; ported to SFML 3.1 and the web with AI help in November 2026.
Technologies
- C++23
- SFML 3.1
- kazilib
- WebAssembly