I thought I'd give an update on the co-op survival I've been developing for ROBA and specifically one of the issues I ran into during the development. That would be unit spawning. Now up until this point I've been developing for multiplayer and spawning units properly for that was already a hurdle. Now that I've started developing for coop survival… Wow… I seriously underestimated the difficulty of unit spawning for round based survival games. If you don't know what ROBA is I have a great article to explain it.
You know initially when I started this co-op survival project I thought that creating the units and their abilities would be the most difficult thing. While that's kind of true and having to animate everything while putting all the programming together for the units to work properly was difficult, surprisingly, it was not the biggest task. The hierarchy of unit spawning is actually quite intense and legitimately stumped me for a few days in integrating it properly. I know what you're thinking, just spawn the units every round, end of it… Not particularly. There's several different units with different abilities and different AI behavior, these all need to be enacted upon spawning. There's a hurdle. But the other thing is when developing a system, it needs to be made so that integrating it into new maps will be…easier… This requires some ingenuity in its modular abilities. There were aspects to this that I never considered and the hierarchical system that's required for you to spawn units at certain times or at certain rounds actually gets quite complicated.
The Overhead Camera Challenge
ROBA is an RTT game. If you don't know what that is, I have an excellent blog post about RTT games. There are some wonderful unit spawning assets that I probably could have used from the marketplace, but I took the project on by myself seeing as how not many assets were made for RTS/RTT games. In an RTT game your camera is overhead. In an FPS game, you have the luxury of just spawning a unit around the corner, whereas in an rtt game with the overhead camera, they might be able to see the unit spawning. It's rather difficult to hide their spawns. I also added a different twist on how units are replicated in an effort to prevent cheating (We'll talk about that in another post). That twist has complicated every aspect of the game, including spawning. So if a player moves around the area, which areas should the enemies spawn in? Yeah that can get pretty complicated pretty fast. That was only a small issue though, in reality, developing a hierarchical system to spawn different units at different times or spawning them in a bulk manner or in a delayed manner was far more complicated.
Building a Hierarchical Spawner System
I finally came up with a system that I'm not particularly too happy with and I will probably be changing in the future. This essentially consists of a master spawner that handles every single round and checks if every unit is dead or not. The programming seems rather straightforward, but it's definitely not like that. After accomplishing the initial requirements of the amount of units and if they're dead, I then created what I call Central spawners that handle individual unit types and have their own timing per round or spawn type. Meaning the central spawner will hold timers that will spawn units in a delayed manner or will have the ability to spawn units in a bulk manner on every single individual spawn on the map. The individual spawn is actually a subset of the central spawner as each individual spawner holds the information for the unit type and this central spawner contacts all of those individual spawns according to the unit type. I'm sure as you're reading this you might start to see how difficult this is and see how the hierarchical system breaks down even further and further. I tried to think dynamically but what if you wanted to spawn units only on this particular individual spawner on this round and not on the other round. What if… On this one round you only wanted this one individual spawner to spawn these units but in a timer sequence, every 10 seconds? You see where this is going? It got really complicated really fast when I wanted to modularize this system and it needed to be modularized to be dropped into any level with relative ease of setting up. The image below will visualize the hierarchy of the system.

Modular Objectives and Map Triggers
What also made it even more complicated was I wanted objectives that spanned across the map meaning you would change locations during the map and then different spawns would be enacted upon that location. The Master spawner would be handling this, essentially changing tags or IDs to target certain central spawners. There's also triggers on the map that will handle that or change that information for the Master spawner. Basically, I created a spawning system that allows you to add mission spawning for objectives or just running through a valley etc… So the system is quite modular in that regard but there is an initial setup. I figured though, in reality if you want a good level or single player map, these little niche touches and the ability to spawn unit A at location C would be important. We'll see if this system sticks. Check out the image below for a visual understanding.

It's Never Over
I won't get into too much detail here as you can see how difficult this got and how fast it got difficult. I hope the pictures I included help visualize how it works. Just know it's not done and I'm not particularly happy with it but it should suit ROBA's needs. It does seem to be working in the manner that I desire it to but I haven't done sufficient testing to see if it's easy to implement for every level.
ROBA is an indie game with no publisher support. If you're interested in playtesting ROBA you can sign up for the playtest or follow for more updates.
Thanks for reading.