Procedurally generated missions in Spy DNA

By Alex Maier, Writer of Words

Here’s a basic overview of how we generate randomized missions. We’ve built a Mission Editor tool for that, and here’s how it looks when you open a mission in it. Here we set all the basics for a mission, such as terrain type, time of day, and so on.

 Spy DNA mission editor "Map" tab screenshot

Spy DNA mission editor "Map" tab screenshot

Then we add all the interesting stuff, like the NPCs you’ll encounter on a mission: enemies, neutrals, people to be rescued, that sort of thing. This is also where we add eligible infiltration options. Not every infil option makes sense for every mission, so we make a list of the ones that do for a given one, and also describe the outcomes.

 Spy DNA mission editor "Gameplay" tab screenshot

Spy DNA mission editor "Gameplay" tab screenshot

When the mission is generated, only a subset of the infiltration options are picked.

Generally, you’ll see four kinds of infiltration outcomes, and each of them influences the mission at spawn:

Outcome

What it means for the mission

You did great and have ALL the intel

You’ll see mission markers for some of the objectives, such as hostage location and enemy camp HQ, or enemy patrols won’t be concealed by the fog of war.

You did okay, and have some intel

You’ll see a mission marker for the some objectives, but not for others. In the case of our hostage mission here, you’ll see where they hold the prisoner, but not where the enemy HQ is, or you’ll find out the enemy patrol route, but not the schedule.

You failed, and have no intel

This is the equivalent of going in without any infiltration. Nothing lost and nothing gained.

You failed, and now the enemy knows you’re there

You’ll be going in blind, and the enemy will be on high alert. They may have added more patrols, etc. Examples of such failures would be to have your recon drone shot down by enemy, or have your agent captured during infiltration.

In-game, you select the infiltration option during the mission brief meeting, and it’s simulated prior to mission start by using the stats of the character you chose to complete the infil. This will allow for different members of the squad to shine, and for the player it will make sense to pick the right person for the right task. Or not, and deal with the consequences.

Here’s how the infiltration planning meeting looks like in-game.

 You pick which infiltration option you like best

You pick which infiltration option you like best

We use Lua to script all the different things we’d like to randomize. For example, the mission description (see first and second screenshot) has all these variables, and below it there’s a box where we define them. The randomizing function pulls the values such as countries, diplomatic titles, and such from a table where we store all kinds of things, tagged with metadata for searching, and the player sees the mission description like this.

 Pardon the layout - it's a dev build :)

Pardon the layout - it's a dev build :)

Here’s how it looks in the tool.

arps-editor-names.PNG

Randomizing names is a bit trickier, because unlike the stuff that is only used in the description, the random name has to be assigned to the character when they are spawned on the mission map. We have a way of doing that when we add the character to the mission.

This is also where we pick the character template for a given NPC, which includes the types of things they wear (military uniform or civilian clothes etc.) and some other aspects of their appearance such as hair styles (again, military personnel will have simpler hair styles and natural colored hair, while the civilians may have wider choices of both).

 This is the NPC we're going to need to rescue

This is the NPC we're going to need to rescue

In most cases, unless it’s an NPC that persists throughout the game, we fully randomize gender, skin color, and body type. Military personnel will again have fewer choices in the body type department, as we will only allow them to have an “average,” “fit,” or “fighter” fitness level. Civilians get a fourth option in fitness level: “unfit.”

The level of fitness and body type aren’t just for show either, they influence the body owner’s attributes as well, so if you meet someone who looks strong and fit, they very likely are.

To make sure that the spread of different body types is more realistic, we weight the probability of each of them occurring. After all, you don’t see twenty-five MMA-fighter-level-fit people for every hundred you meet.

Body types matrix for female and male bodies:

light

average

heavy

unfit

f-un-lt, m-un-lt

f-un-avg, m-un-avg

f-un-hvy, m-un-hvy

average

f-avg-lt, m-avg-lt

f-avg-avg, m-avg-avg

f-avg-hvy, m-avg-hvy

fit

f-fit-lt, m-fit-lt

f-fit-avg, m-fit-avg

f-fit-hvy, m-fit-hvy

fighter

f-ftr-lt, m-ftr-lt

f-ftr-avg, m-ftr-avg

f-ftr-hvy, m-ftr-hvy

With that, we can populate the world with a fairly diverse set of characters for the player to encounter. And often, shoot. Oh, and also create for yourself at the beginning of the game.

Other things you will have noticed in the mission generation tool would be buildings. We generate buildings at runtime from a floor plan which we also create in our tool, but that is a topic for another post.

For now, suffice it to say that when the map is generated, the buildings are placed on it somewhat randomly, according to the parameters specified when the building is added to the mission.

Let’s not forget the objectives! They contain Lua commands to evaluate when the conditions for a particular objective have been met, or failed, such as in case of having the civilian you’re supposed to protect, die. If an objective is marked as required, failing it will mean mission failure and you’ll have to do it over, and if an objective doesn’t have this box checked, you can fail it all you want and still complete the overall mission.

 The Lua check is to make sure that the NPC 39 (our Hostage) is alive. Because this is a required objective, the mission is failed the moment the NPC dies.

The Lua check is to make sure that the NPC 39 (our Hostage) is alive. Because this is a required objective, the mission is failed the moment the NPC dies.

Some objectives are only available when particular conditions are met. Case in point: “recover drone wreckage” is only shown if you chose the drone reconnaissance option and the drone crashed. If the drone is shot down and captured by the enemy, your objective (and area of search) will change to retrieving the drone from the camp.

When everything is said and done, we’ll have a mission that can be replayed over and over, but it will never be exactly the same. You’ll get different infiltration options, the terrain will be different, and the buildings will never be in the same spot. Same goes for objectives such as which building the hostage is in, or where the drone wreckage is.

By the time we ship the Early Access version, we’ll have a number of such missions implemented, in addition to a handful of storyline ones to tide y’all over until the full version is released.

We’re also thinking of creating affordances for players to design their own mission mods, and whole missions down the road. That’s something that will have to wait until after Early Access though.

Spy DNA development update 2018-02-23

By Jason Sams, Lead Developer

It’s been a while since my last update. I’ve had my head down in the game code making some fundamental changes. We have made major changes to the AI system, character customization, hit location and damage system, level designer, asset loading, modding support, and a few other things. 

Let’s start with character customization. We put a lot of effort in making the players character fully customizable. Now a few of you gave us a hard time for going overboard here. The reason we put so much effort into this is we unified it with NPC generation. This will let us generate much more unique NPCs for each mission and avoid repeating the same character models over and over.

 New game screenshot

New game screenshot

During character creation you will be prompted to choose your commanders frame (skinny, average, or heavy), and condition (pro-fighter, fit, average, nerd). This choice determines which character model you will see in game and will also change your attributes. The condition choice biases your attributes towards physical or mental, while the frame choice is a speed/dexterity vs strength/toughness choice. 

Related to this we implemented our appearance reaction model. Each appearance item is rated on several metrics, such as Serious, Classy, Scary, and the ability to conceal weapons or armor. So while you may want to bring the heavy armor to the dinner party, doing so will make it much harder to get people talking, at least by verbal means. 

 Wardrobe screenshot

Wardrobe screenshot

Speaking of armor, we added the armor options to the wardrobe screen. You can now equip your characters with a variety of armor and storage options. I’ll have some updated screenshots of the overhauled equipment screen soon. Armor in spy dna is now working as intended. Armor resists bullets and other weapons, but for it to work, the weapon needs to hit the armor. This makes your aim point really matter. Unless you have the heavy weapons out, you will want to try to avoid hitting the heavily armored points on a target.

 Character status screen

Character status screen

We updated the status screen to show where the shots have hit a character. The length of the marker changes depending on the penetration of the incoming round. The diameter represents the damage level of the shot. The hits are colored based on result. 
Green = fully blocked by armor
Yellow = blocked by dermal armor, probably still really hurt though.
Red = call the doctor and make an appointment

 Attributes screenshot

Attributes screenshot

We are scanning the shot against the polygon mesh of each piece the characters are wearing. We don’t want near hits/misses being mis-reported by the engine.

We have also been cleaning up the UI. We moved from using pre-drawn icons for the party to using render targets and snapping them in game. This means they will reflect the current state of the character. If you change into a delivery worker outfit to sneak into a building, the portrait will update on the fly.

 Skills screenshot

Skills screenshot

And the final bit for the update is the changes to the inventory screen. We have moved a few things around and made room on the left, under the item image, for attachments or modifications. 

 Inventory screenshot

Inventory screenshot

We have also put a lot of time and effort into performance work. To give you just one example: The time from a level loading until you can start moving has been reduced from a minute or more it could take in the past, down to about a second. The pathfinding will prepare in the background now, using multiple cpu cores to speed things up if available.

While we basically had Spy DNA up on jackstands with the engine out and all kinds of parts strewn all over the place, it was challenging to really show and explain all the things that we had in-flight. But now that we have put the thing back together, we’ll be sharing updates on a more regular basis.

Stay tuned.

A (subtle) UI refresh

For many months, we've been focusing on the internals of the Spy DNA game, things like dialog logic, character progression, map generation, AI and such. As one would expect, the UI was left in whatever state it was at the time we started the major push.

Well, no more.

This months I (Alex) spent a lot of time catching the UI up to the current style.

What this means is that while many menus such as chat, information/inventory screen, and in-game pop-ups and dialogs have been using the styling that we intend to ship Spy DNA with, other elements were still using outdated graphics. Most noticeably, inventory icons.

Here, let me show you.

 Old inventory icons in the graphic design program

Old inventory icons in the graphic design program

 New inventory icons in the graphic design program

New inventory icons in the graphic design program

The icons themselves remain the same, but now they are using the correct color scheme and feature a glowing outline edge, to match the rest of the UI.

The HUD also got a bit of a subtler refresh, to make it use our new color scheme.

 Before

Before

 After

After

Unless you know what to look for, it's not obvious, as you see. However, when seen with the rest of the game, it definitely looks more like it belongs. The HUD background and buttons come next.

Anyways, just wanted to drop a little update here for you all, to show off the progress I've made so far. We're going to try to be more conscientious about posting on here from now on.

Managing complexity in games

A little while ago, I gave this 5-minute talk about managing complexity in games such as Spy DNA.

The main point of the talk is, that as the computer technology advanced, game mechanics of strategy RPGs and tactical games have not kept pace.

Driving and flight sims do a great job of simulating real-world conditions while keeping the game experience accessible and fun. At the same time, RPGs and even first-person shooters still rely heavily on artificial constructs and arcane rules of combat created in the era of pen-and-paper games.

With Spy DNA, we endeavour to bring this sort of detailed realism to the RPG world: simulating combat on a very detailed and granular level, all the while preserving the approachability and the fun of playing a game.

The slides are embedded below. Post your questions in the comments!

So about that early access…

It’s still in the works, and we’re getting closer, but while we do that, we wanted to give you a status update.

Why the delay?

We have reviewed our launch plan and decided that the early access game should be as close to the final release as possible, without giving away any of the plot. So we went to work on improving character appearance, mission generation, and map creation. Let’s break that down in some detail.

Character appearance

We switched the characters and clothes from using traditional materials to PBR (physically-based rendering), making them look better in-game. Character rendering performance was another major area of focus for us.

We also improved the fit of clothes, and enabled wardrobe management for playable characters. Now you’ll be able to choose from dozens of items your Commander and the squad members can wear.

In the same vein, we’ve added some more animations and made some improvements to character skinning, again, making them look more realistic.

And finally, the Spy DNA squad is complete, with finished models, and back stories.

Mission generation

Same mission, different map? We don’t think so. That means that we need a way to create unique combinations from some smaller “elementary particles” that make up a mission.

We have created a number of scenarios that are similar from the tactical point of view, and the game will fill in the (compatible) details randomly, whenever a mission is generated. To take a simple example, the generic mission could be “hostage rescue.” The details that would be filled in and used to generate a mission can be: number and appearance of hostages and enemies, skill levels of hostages and enemies, geographic location (rural, suburban, urban, etc.), and any constraints – say, the area is full of civilians and you shouldn’t kill any of them, or cause a panic.

2017-08-01 (1).png

Next, we introduced infiltration. Most of the new missions that pop up, will have an infiltration option, and the Commander will decide which of the squad members will go. In the hostage scenario from above, the infiltration options could be: sneaking up to the building and placing a surveillance camera or microphone, hiding a weapons stash, or going in as a commercial hostage negotiator.

If the infiltration succeeds, the mission itself will be somewhat easier to complete, and if it doesn’t, your mission may turn into a rescue operation really quickly.

Map creation

Now of course, we need some maps to match the diverse missions. We’re working on creating landscapes and populating them with trees and buildings, as well as all the other things that go on a map: street signs, cars, fences, etc. both to provide a bit of visual appeal, and cover/line of sight obstruction.

When?

You have been very patient with us so far, so we decided that while we are finishing up the Early Access release, we’ll be shipping another demo version shortly, to show the progress we’ve made. Please stay tuned – we’ll be announcing it here on the blog, and on social media of course.

Getting ready for Early Access

It’s been a heads-down month here getting ready for early access. I’ll talk about what we are doing to go from demo to a full game. The transition from demo to full game for us has been about adding progression and content. 

The first big change is the result of a mission now affects your game. You can now also train your team at the base. Wounded characters will need some time to heal at the base before they are available for future missions. We’ve implemented the save game system and made the full character roster available. It’s all pretty obvious stuff, but it still needed to get done. 

While on mission, a character can advance their skills by using them in the field. On the skills page you will now see a count of how many times that skill has been used. Each use will improve the skill. 

The amount of the improvement will depend on several factors. First, each skill has associated attributes which govern how well your character can learn the skill. These are separate, though possibly overlapping, from the attributes which bias the ability to use the skill. For example “mental motivation” is a factor in learning most skills, however, it is used in few skill checks. These determine the character’s learning rate modifier for that skill. 

In addition each skill has a base learn rate to adjust for skills that are used frequently vs rarely. For example we don’t want to penalize hacking and lockpicking progress just because there are fewer chances to use the skill. 

Back at the base, skill training is a passive activity. You can assign each character two skills (primary and secondary) to train. Then as each day passes, any characters at the base that are healthy, will train those skills. So characters that are not taken on missions will still be making progress. A character that is not healthy may still make some progress. For example, a broken leg will prevent training physical skills, but would allow the character to keep working on mental skills. 

Injury recovery is similar to training at the base. A character will survive a mission as long as they are alive at the point when the “end mission” screen is triggered. In theory we can simulate post-mission death due to injury, but that would be an opt-in for extreme difficulty. Because we track each injury a character suffers, we do healing per-injury. Different injuries can heal at different rates. As they recover, they will automatically resume training as their health allows.

In the case of non-fatal injury to the Commander, if one or more other characters are available, you will be able to designate an acting commanding officer to cover the Commander’s duties and lead the squad on missions until recovery. If no one is available, time will fast forward until the Commander recovers. 

For early access we also wanted to make the full character roster available. So in addition to Ivan, Karsten, Nuri, and Zoe from the demo, you will now have Alexey, Marguerite, Ronda, Shinichi, and Rustam. 

Saving and loading has been implemented. The game will now autosave after each mission at the base. For initial early access saving will be limited to while at base. We will implement saving while on mission later.

2017-05-01.png

We also have been hard at work on the UI. We received a lot of feedback about the look and feel of the UI and have responded with some improvements. Functionally the location of the controls is largely unchanged. What we have done is softened the appearance of the buttons, borders, and dialogs, and replaced some of the radio buttons with icon based sliders that make it easier to visualize how the controls work together.

We published a video for those wanting to see more of the new UI.

One final change for realism and game ballance we’ve made, was to implement the penalties for attacking moving targets. Simply put, it’s harder to hit something that is moving than something that is still. The mechanic implements this is two ways. One, there is a penalty to the circular error probable (CEP) for any given aim time. Two, the moving target limits the amount of time that can be spent aiming. The strength of the penalty is based on how fast the target is crossing the character’s field of view and how far away they are.

The first batches of character voices have started to arrive. Each playable character will have an unique voice and persona which they will use to acknowledge your commands and give you status updates.

The last area of getting ready was the implementation of settings screens. We have made a pass over all the sound effects and broke them into channels so each can have its own volume control (music, ambient sounds, combat sound effects, player character voices). We have also started implementing the settings for difficulty and new game options. These will be exposed soon.

With all these changes, the core engine of Spy DNA is pretty much ready for early access. What we are finishing up now is getting enough of the missions ready that the game has some content to go with the engine. 


 

Early Access roadmap

Spy DNA has received the green light from Steam, meaning that we're still on-track to ship the Early Access release in Q2 2017. Read on to learn what will be in the Early Access version.

6570985235_5dba764294_b.jpg

Platform upgrade

For Early Access release, we have migrated Spy DNA to Unreal Engine 4.15.1, so we can take advantage of all the newest features and improvements that the engine provides.

User interface update

From the demo, you're already familiar with the ability to toggle the first-person view ("body-cam") on and off to improve performance. For the Early Access release, we're planning to change this behavior to toggle between the body-cam and a minimap. So while you will be conserving system resource, the game will be using the now freed-up screen real estate to display tactical information.

A very visible change you will see that we're working on is the UI look-and-feel update. The functionality and layout of the UI will remain mostly unchanged, but many of the text buttons will be replaced with icons, and all UI elements will receive a style update in order to make the game more visually rich.

 Work in progress: UI look-and-feel update

Work in progress: UI look-and-feel update

Map edges

To help make the Spy DNA world more immersive, we'll be extending the edges of the map past the area accessible to the player, so that you won't be seeing those hard map edges anymore.

Because we are generating the maps at runtime, it is fairly straightforward to extended the map, but it brings with it a performance trade-off. The area beyond the playable map will be extended a bit, and beyond that point, there will be a fogging effect, to make the map edge less noticeable/distracting.

As originally announces, Spy DNA will supprt three map sizes: 256x256 meters, 512x512, and 1024x1024. To raise or lower the difficulty one notch, each mission map will also be available in one size larger or smaller. This means for the largest map, you'll be able to play on a 2048x2048 meter map for highest difficulty, and for the smallest map, you'll have the option to play on a 128x128 meter map.

Missions

When it comes to selecting who you take with you on the mission, you'll now also have a choice to pick equipment for each individual character.

Every squad member will have a default load-out for each appearance/uniform that they can wear (fancy, field, and casual), and if you edit any of them, the changes will only impact that specific appearance, and the others will remain as they were.

Spy DNA Early Access will also include procedurally-generated missions. In the current demo, we have provided missions that use one of the two map types: either 100% hand-made OR 100% procedural. However, the mission objectives, as well as the NPCs you encounter on those missions are pre-set.

Going forward, storyline missions will use either a hand-made map, or a procedural maps, with predefined objectives and NPCs.

For Early Access, we’re expanding the game to include 100% randomly generated missions, similar to "random encounters." Those missions will have the map, objectives, and NPCs all generated at random, and will pop up in the intelligence screen, to give the player a lot more to do between the storyline missions. They’re going to be optional, but will offer a good opportunity for building skills and advancing your characters.

Finally, we'll be introducing a new mission phase (also optional), called "infiltration." You will be able to use this phase to set up for the main mission (or not; if you prefer to go in guns blazing, without any prep, be our guest). Typical things to do on an "infiltration" mission would be to pre-position characters such as your sniper, hide a weapons cache or plant some surveillance equipment, steal access cards/keys, disable/sabotage the alarm, or general recon.

On such a mission, success is good, but depending on how badly your infiltration fails, you may be changing your main mission objective to rescue your infiltration team.

Let us know in the comments below what you think of these new features and improvements!