Sponsored By

RTS Unit to Unit Collisions in Unity Software: Deterrence - Video Devlog 11

The eleventh weekly devlog for Deterrence. This week I solve unit to unit collisions and add the tower building to defensive structures.

Matthew Gianfrancesco, Blogger

May 31, 2022

1 Min Read

A tower defense mixed with real-time strategy where you repel attacking sentient AI robots until they give up.

Unit to Unit Collisions in Unity Software

To mimic Starcraft 2 unit collisions, I gave the units capsule colliders and rigid bodies. In the unit code, I would adjust the mass of the rigid body so that moving units have greater mass than standing units.

By adding physics to the units and allowing them to nudge one another, this created problems with group movement. In many cases, units would be nudged so far from their path that a block would come between the unit and its next node causing the unit to get stuck. To solve this, the group movement was modified so that node offsets are much closer to the leaders nodes, box and sphere checks were used instead of raycasts to find blocks between nodes, and instead of simplifying the path, all the nodes are used to keep units on path.

Towers

The tower will be a mid to late game defense like bunkers, but they will lack in defense. The towers will instead give units a range bonus. I plan on towers having upgrades to their structure like steel, and concrete to boost their hit points and amount of garrisoned units. Also towers should have the ability to add a mounted machine gun just like bunkers and sandbag walls.

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like