Unity RTS game

I’ve been getting a bit annoyed at the slow progress on the WebGL RTS4 project. I know what the problem is; I’m over-engineering it, trying to design it to be very general purpose and flexible, but as such it becomes very difficult to make progress.

I decided instead to see how far I could get building in a more purpose-built way. Over the last few weeks I’ve been putting together a model pack for Unity, to be released on the Asset Store along with a sample project to see the assets in action; this would be my sample project. The models were created in a hand-drawn cartoony style.


The current version was built over about a week:

  • Day 1: Pathfinding and unit movement
  • Day 2: Resource management, gathering, and melee combat
  • Day 3: Town Centre model, buildings as pathfinding obstructions
  • Day 4: Placement of buildings, terrain fog of war
  • Day 5: Hydra, Unit fog of war, FOW fading to grayscale over time

Some of the code is designed similarly to the WebGL RTS4 port, but with more stuff assumed (ie. only 1 action can be active at a time, terrain is a heightmap, buildings are rectangular).


Play in your browser (Unity)

3 thoughts on “Unity RTS game

  1. would you consider doing a tutorial on this, I’ve been trying to find documentation for making an rts style game for a while now, this has a lot of the elements that I would need to get started

    • Sure, happy to see someone else interested in building an RTS in unity :). Ill try to stick up a new post some time this week detailing how the line-of-sight, pathfinding, input, and action systems work.

      If you’d like to get started earlier, the LOS roughly follows the Valve Improved Alpha-Tested Magnification approach, pathfinding is using flow-fields with A* for cost calculation, input uses a scoring system to determine the most appropriate gesture, and hands off to Camera/Selection/Build managers, and the action system is quite simple; each entity has an active “action” (Move, Attack, Build or Gather) containing a target GameObject/position, which updates each frame.

      What kind of RTS were you thinking of making? It can help to figure out early on what features you need, like the ability for a unit to move while attacking or if you want to have flying units, and only implement the ones you need. If you want multiplayer, implementing lock-step networking requires all simulation logic to be deterministic, so needs to be considered from the start.

  2. Wow that would be great, I’m still in the early stages of working out what I need/ how to code it so any help would be much appreciated, I don’t know if you’ve ever played Warcraft 3, but that’s the style of RTS i’m looking at working on, and yes I hope to eventually include multiplayer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s