Skip to content

Sandruski/rts-group-movement

Repository files navigation

RTS Group Movement

I am Sandra Alvarez, student of the Bachelor’s Degree in Video Games by UPC at CITM. This content is generated for the second year’s subject Project 2, under supervision of lecturer Ricard Pillosu.

• My GitHub account: Sandruski

About the Research

This application is the result of a research in how to implement group movement for RTS games. It has been done following the tile-based algorithm A* (A-Star) and creating a collision determination and avoidance system.

It is not recommended to move simultaneously more than 16 units.

• Website: RTS Group Movement Website
• GitHub repository: RTS Group Movement Repository

Inputs

Keyboard

1: spawn a unit of priority 1 on the current mouse tile
2: spawn a unit of priority 2 on the current mouse tile

F1: debug draw units' movement calculations
F2: debug draw units' path
F3: debug draw map collisions

ESC: close the application

Mouse

Left click on a unit: select the unit
Left click and drag: draw a rectangle. Units within the rectangle will be selected
Left click on a tile without a unit on it: unselect all the selected units
Right click: if units selected, set their group goal

Tools

  • IDE: Microsoft Visual Studio 2017 (language C++)
  • SDL 2.0, STL, pugixml 1.8
  • Profiler: Brofiler
  • Map edition: Tiled
  • Graphics edition: Adobe Photoshop

Assets

All the sprites used belong to the game Warcraft II: Tides of Darkness, hence are property of Blizzard Entertainment.

Known Bugs

BUG 1. When the user sets a new goal to a group of units, each unit searches for its own goal, which is found by running a BFS algorithm. Since BFS only expands from a given node (tile), the new tile found may be located on the other side of a wall. This leads to moving half of the group of units towards the side of the wall the user has clicked and one or two units to the opposite side.
BUG 1 PENDING TO SOLVE. The BFS search algorithm will be repalced for a Dijkstra algorithm, which also considers the cost of the nodes, preferring the low cost nodes. This way, Dijkstra will prefer to expand on the side of the wall the user has clicked and avoid jumping on the opposite side.

BUG 2. If many groups are moving at the same time and the user spam-clicks new goals for the units, the application either slows down or stops for a fraction of second, due to the high computational demand.