• Register
Post news RSS RTS Buildings with Garrisoned Units: Video Devlog 9

The ninth weekly devlog of Deterrence. In this log I expand on unit code to build buildings and program buildings to be constructed and have garrisoned units.

Posted by on


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

Sandbag Walls

Sandbag walls will be basic early game defenses that can be built by all soldier units. They will have the ability to garrison 2 soldiers. I'm also thinking about adding the ability to upgrade the sandbag walls with a mounted machine gun to buff attack and double layered bags to buff defense or hit points.

Constructing Buildings

Building construction will be done by soldiers. Basic buildings like the sandbag walls can be built by any soldier, but more advanced buildings like bunkers and towers will only be built by engineer soldiers. Buildings can have more than one unit constructing it to speed up production and units can stop building at anytime the player chooses.

Building UI

Buildings will have the same stats as units shown. Buildings will inheret the attack and range of the units that occupy it or the building could have an upgrade that buffs a stat(s). For instance, if a building has two general infrantry units occupying it, then the building would have their range and attack x2; defense and hit points are not inhereted. Buildings will have a garrisoned units section where you can see the icon of units currently garrisoned in the building, and the player can left click on those icons to ungarrison the units. The building command menu currently has 'ungarrison all' and 'attack' buttons. The building attack button will command all garrisoned units to target a specfic enemy unit as long as the enemy is in range.

Making Units Construct Buildings

The build command works like the move command. The placement object will give the selected unit(s) the build target. Once the path is complete, the unit will switch to the build animation instead of the idle animation. Each unit will call the build target's build method making it possible to have multiple units to speed up construction. The build method will simply progress using Time.deltatime. Once the time reaches the buildings build time, the building is complete.

Making Buildings Garrison Units

Buildings have a capacity variable that determines how many units can be garrisoned at once in the building, if the capacity is larger than zero, the UI will display the garrisoned units section. Buildings will have a list of units it holds and assign each unit a position for each slot. Garrisoned units will have their colliders disabled to prevent selecting; and while garrisoned, all code except the enemies in range check is disabled and the unit follows specific instructions for being garrisoned.

If you would like to follow me on my game dev journey, don't forget to subscribe or follow on social media!

Facebook - Facebook.com
Twitter - Twitter.com
Instagram - Instagram.com
Discord Server - Discord.gg

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.