Does Dots are compulsory for Real time strategy game (RTS)

I am developing a real-time strategy (RTS) game. In my game, I can build a command tent, a worker hut, a garrison that can build troops, and an archer tower that damages enemies and can also train archer troops. I have just started development on the project, and in the future, I will add more buildings, troop types, and enemy types that will attack the castle and try to destroy the command tent. I have not fixed the total number of troops I can train at this moment.

Are DOTS compulsory for my game? I may add Unity multiplayer features, such as a dedicated server. Is there a way I can build this type of game without DOTS? If yes, how many total troops, enemies, and buildings can Unity handle in a scene that is currently rendering in the camera view?

Troops: 177
Enemies: 231
Buildings: 28

What do you expect? We can’t predict how the code you’re going to write will perform nor do we know what kind of animations, meshes, textures, materials and shaders are going to be used, nor what the targeted platform specs are. :wink:

The two things you NEED to know right now is:

  • decide on whether to use DOTS or not - by the questions you ask I would recommend NOT using DOTS because it takes a lot of time to wrap your head around it
  • get started!

Either you are going to add multiplayer from the get-go, or you won’t. Networked games require a very different architecture.

I am using 2d sprites for my soldiers, enemies and building. I am targeting the mobile devices android and Ios.
Now is it possible what without using dots i can handle a scene where lot of enemies attacking the castle destroying buildings and soldier tries to defend the castle. All the animations are sprite sheet or spine animations.

I have made an RTS game before in pure Monobehaviours and started running into issues with performance once I tried to scale up. I think that project capped around 200-300 units with 3D skinned mesh animations and combat logic only. If your using 2D you should be able to get up to 500 units without too much difficulty. Best way to know is to test what you got.

I have been working on a pure DOTS RTS for a couple months and it scales unbelievably well. A few adjustments to systems with heavy operations and they go from 3ms to 0.03ms. So far it can handle ~4000 units doing pathfinding, gathering, building, fighting and shooting before I start to drop frames.

I disagree with CodeSmile about not using DOTS. I started my recent RTS project to learn DOTS and have been making great progress in just a couple months. I agree it takes time to wrap your head around, but in the long run it’s worth it.

True that!

I also want to add that there’s a sane middle-ground: use GameObjects and MonoBehaviours, but implement them in a “systems” architecture.

By that I mean put as little logic as possible into individual per-entity MonoBehaviours. Instead, you will want to have a root object like Units which does everything from spawning new units, killing them, then decaying their corpses after some time, also pooling and running their behaviour, pathfinding, formations and so on.

The individual unit’s GameObject may not have more than a) an Animator, b) a Collider and c) an Index component. This is primarily for collision events or other interactions where you end up with a GameObject reference but not a reference for that object in the Units system. The Index component simply holds that Unit’s index for lookup in the system’s array of Units.

While you could use a Dictionary this is best avoided since access by index is faster, and enumerating over an array of units is deterministic ie the units are iterated in the same order.

This then allows you to simply add additional data to each unit by wrapping the GameObject reference with additional data such as offensive and defensive values, buffs, timers, hitpoints, and what not.

Porting such a system to DOTS should be far less of a headache than the traditional per-GameObject way of stuffing way too many components onto each entity. And even if you don’t port to DOTS you benefit from the better performance of a central system handling all entities rather than each entity handling its own logic. Especially when it comes to spatial awareness (eg what is happening around me?) this is very difficult and/or inefficient to handle on a per-GameObject basis.

1 Like

You may be able to cheat a little and use a particle system for certain objects and not just bullets.

Plenty of RTS games existed before DOTS or even Unity existed so, no… it’s not compulsory. But you’ll probably be implementing something akin to the data driven pattern DOTS is based on if you go sans the framework. Learning how older RTS games work on a deeper level is probably a good way to understand what you need to implement, and how that might apply in a DOTS context as well.

1 Like