Learn How This Unity-Powered RTS Displays Thousands of Entities on Screen at the Same Time

Digital Sun's Jorge García spoke about the team's upcoming LEGO-inspired RTS Cataclismo, explaining how the team leveraged Unity's DOTS to display thousands of characters on screen all at the same time.

Introduction

My name is Jorge García, I'm the Producer of Cataclismo. I began my career as a programmer at Digital Sun, developing video games for clients. I contributed to Moonlighter during its release and post-release phases, providing support for Quality Assurance (QA) and Public Relations (PR)/Marketing. Later, I joined the team working on Cataclismo.

Cataclismo's Story & Gameplay Mechanics

We ran a brainstorming process to come up with ideas for a new project. Vicent, Cataclismo's Creative/Design Director, provided some concepts for a game about building castles and defending against waves of enemies that would try to destroy them. He, and many others within the studio, had grown up playing with LEGO blocks and were fascinated by the freedom and endless design choices it could present to players if it were to be included in a game. The team was also excited about bringing along elements from They Are Billions and Warhammer, so upon validating the idea, we decided to move forward with its development.

Choosing Unity

The team had garnered extensive experience working with the Unity engine after working for several years on Moonlighter. We felt confident and comfortable taking on a new project with Unity. The choice was clear to us when we realized that many of the performance bottlenecks we could encounter could be solved by using ECS/DOTS

In RTS games, there's often a lot of stuff happening simultaneously. Handling the large number of computations stemming from a targeting system (e.g. unit positioning relative to that of the others, attack ranges, pathing, etc.) frequent creation/deletion of game objects, and verticality, can be challenging. At some point in the game, there can be over 50 player soldiers/units facing 1000 enemy horrors on screen, in addition to the many more pieces that players will stack to construct towers and walls. This is where DOTS/Jobs proved to be a game changer for us. We have a Unity showcase where we go into more details for those who are interested:

Optimization

We used every tool we had at our disposal to ensure it displays as many enemies and pieces on screen while preserving a smooth and responsive experience. Objects like pieces and buildings are built around the Unity gameObject/component system, providing flexibility and ease of iteration. The functionality of each entity is split across several components that are controlled by a 'master' class.

Regarding units and enemies, we used the navmesh functionality as soon as it was available and adjusted the agent to our needs, gaining increased control with regard to how and when petitions are solved. The navmesh has been tuned to ensure that only affected sections are recalculated when modified. In addition, we also implemented a custom version of flowfields using Unity's Jobs system. All these improvements enabled us to achieve the horde-like behavior of the swarm of horrors in-game while minimizing the performance loss.

We also created a custom system using DOTS to handle targeting. Targeting includes the logic through which an entity (ally or foe) decides whom to attack, as well as logic to prevent units from cluttering/stepping into each other. In short, our implementation processes the computations needed to derive the pathing and agro from in-game entities in a fraction of the time.

We rely on GPU instancing and draw mesh indirect calls to reduce draw calls as much as possible. We also used baked animations (pre-calculated and stored in a texture) on the GPU to allow for a large number of entities to be on screen at any given time.

Future Plans

Cataclismo's development is close to completion, the primary focus at this stage is polishing and ensuring that the game is balanced (easier said than done in an RTS game!). On release, the game will feature a fully-fledged Campaign Mode, following the story of Iris and uncovering the secrets behind the Mist, a Skirmish Mode, a selection of carefully handcrafted levels by the devs intended to pose the ultimate challenge to the experienced builders of Hogar, and Survival Mode, put your knowledge to the test by designing and defending a fort that withholds the siege of endless waves of horrors, each of increasing difficulty. We expect to release the full game in Q2 2024.

Conclusion

We enjoy games that have an engaged community. We believe that providing players with the tool to design and share levels with each other will result in a more enriching experience. We are looking to provide mod support via Steam Workshop integration, enabling players to customize, share, and compete in challenges created by others. We will make more announcements concerning this mode in the near future, so stay tuned!

Wishlist the game on our Steam page and stay up to date with its progress by joining our official Discord.

Jorge García, Producer of Cataclismo

Interview conducted by Arti Sergeev

For anyone interested in learning more about DOTS, Unity will be hosting a DOTS bootcamp in March. 

Join discussion

Comments 0

    You might also like

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more