by Sako on March 29th, 2016

Spareware is built on complex randomisation and generation systems and tweaking those took a lot of time in the development. We summoned the programmer, Ville Siuruainen to reveal what's going on 'under the hood' of Spareware.

Spareware uses procedural generation. What does it mean?

It means, that some of the content in the game is created using algorithms that are based on certain rules and limitations. With generation like this we get the advantage of being able to create almost infinite amounts of content with very little data.

What is generated in Spareware this way?

The maps in in Spareware are procedurally generated. First the street layouts are generated and on top of those the 3D-models for the streets are created. Then the buildings are created with algorithms to side the streets. Finally all the different props made by the artists are sprinkled around to the streets and the walls. When the visual generation is done, the AI will receive it's navigation data. All of this happens during the loading screen.

What are those certain rules that the algorithms use?

When the map is generated, the game uses randomly selected reference data - biomes which define the threshold values to the width of the streets and textures, the height of the buildings, their colors and decorativeness and so on. The biomes also define which props may be generated. When the props are generated, it's taken into account that they won't spawn on top of each other or in such ways, that they would prevent completing the level or navigation of the AI.

What was the hardest part in creating the generation systems?

The whole generation code has been re-written at least half a dozen times, so I guess the short answer is EVERYTHING. When it comes to single things, the buildings caused the most headaches. They really wanted to overlap each other still two weeks before launch. Also the optimization of the generator performance required a lot of work, because no one wants to keep looking at a loading screen longer than a few seconds. The first version of the generator made a map in about a minute while the current version manages the same task in about 15 seconds.

You were also working with the AI. How many types of AI are in Spareware?

There's 3 archetypes of AI at the moment: Melee, Ranged and Suicidal. Melee has two ways of function, where the other controls baton wielding melee enemies and the other is for the ones with a shield. At this point there's three different ranged enemy types with their rifle, shotgun and grenade launcher variants. Fun trivia: only the riflemen's AI has the feature of avoiding friendly fire. Suicidal is the simplest of these AI models. It just makes the nombots to run near a player of its choice and explode.

How exactly do some of these enemies behave?

The tactics of the melee type enemies are solely based on cornering the players. It's easier to hit immobile targets when you have enough pals around. The riflemen try to form an arc to a proper distance of the player and shoot whenever there's no allies on the way. Shotgun and grenade launcher enemies trust on pure fire power so the best strategy when fighting them is to just shoot first.

What was the biggest challenge when creating the AI?

This was actually the first proper AI I've ever done, so I've had to learn everything on the fly. It's probably apparent in the end result. We were originally going to use middleware AI bought from the Asset store, but we found out it was too heavy with our enemy amounts. After a few months of fighting with the optimization I gave up and decided to just do the AI system myself. But even then the performance was the biggest challenge,when there are dozens of AI controlled enemies on the stage at the same time.

Systems like this or their importance isn't always noticed, but it's something that requires a lot of time and work. It wasn't for nothing though as the generation has been getting positive notes from players and reviewers. You can now check it out yourself. Spareware is available on Xbox One digital store.