Thousands of Unique Units Doing their own Thing

My current project is creating a game based on the 1999 classic Heroes of Might and Magic. It is a great multiplayer game my family have been playing for years. Over those years, we have come up with a lot of ways to make the game even better. There have been a couple groups that have made fan-based upgrades, my favorite being Horn of the Abyss. This is an excellent upgrade that keeps all the flavour of the original game but improves many aspects gameplay.

Simply a great game
A great fan-based upgrade to the game

Seeing as how they have already made a great upgrade, my goal is to create a game with similar gameplay, but a much more chaotically fun combat system. One which will have thousands of unique units running around the screen hacking and chopping away with reckless abandon. This sounds like a job for Unity’s ECS system!
I started this project before ECS going through the Hex Map creation by Catlike Coding. Simply a great series of tutorials to get a programmer new to Unity to the next level.

My initial map creation project

Everything was great with this project until I learned about ECS. Then the dream of thousands of units began and I started my quest to reduce MonoBehaviours and implement ECS instead. Going through the many ECS tutorials out there, I revamped my hex map and got some serious speed improvements out of it.

My project after ECS infusion

Unfortunately, in my haste to implement ECS, I created a horrible web of references between objects and structures that made progress abysmally complicated and slow.

A graceful Object Orientated Program
A lean powerful ECS program
My program created from a myriad of tutorials patched together

So my first order of business is to start with a clean object orientated framework that gracefully controls the lean powerful ECS code. As one might guess, it takes a lot of cleaning up to repair a patchwork program as moving any piece of code breaks all kind of references that were hard-coded in.
When I am done this, then I will hopefully come back with examples of clean, understandable, fast code that combines the gracefulness of OOP with the power of ECS. The end goal of having thousands of unique units doing there own thing.
Cheers,
Darryl

Leave a comment