As we mentioned earlier, we’re going to continue giving you small snippets and insights into our development process on Shadowrun Returns. So this latest dev diary falls to me, Chris Kohnert. I head up the engineering efforts in our little office.

I think first off, it bears mentioning that Shadowrun Returns really is a pretty ambitious project. There’s a lot of depth and tactical strategy we’re trying to put into this game, while also keeping alive the fluid and dynamic elements that make a good story-based RPG fun.

One of the most important elements of any good single player game is a challenging and believable AI system. Since we’ve recently been tying up loose ends in the bulk of our core AI, I figured it would be a good time shine a bit of light into some of the elements of it, and how it integrates with some of the story-related gameplay elements of SR:R.

For this game, we have many different ways for you to approach any given scenario: do you try a frontal assault? Do you try to don a disguise and trick the guards into letting you into the server room? Do you need to protect that decker as he overtakes that computer node in order to take control of that mini-gun turret?

In order to facilitate this flexible approach to tackling a level, the AI must be able to interweave many different disciplines and game systems and respond to a lot of different situations.
Let’s talk a bit about how this works at a very high level.

The very first thing an AI needs to do is to be aware of its surroundings. For instance, when you move around a scene and perform actions, a guard will make an “awareness” check (i.e. “Do I see him?”). This is where stealth, line of sight, and audible cues are sensed and perceived (and also where that awesome ninja suit might come in handy). Assuming the guard sees you, he must then make what we’re calling a “perception” check (i.e. “What do I notice about him?”).

This is where the non-combat elements of the game start to come into play. For example, if you’ve managed to procure a guard’s uniform, he may take a look at you and decide you aren’t a threat. Though, that uniform may not do you any good if you’re carrying a couple of assault rifles when the standard issue weapon is a pistol. (Yes, we actually model that level of sophistication! Though whether it gets into the final game is based on how much fun it winds up being. . .)

Oh and speaking of sophisticated, here's Chris Aardappel, who's taking point on the AI operation.

Once an AI has perceived you and identified you as a threat, it drops down into a high level planning system where it determines what types of actions it should perform. Things like staying near a VIP to protect him or her or barreling down the hallway to take out the interlopers are resolved at this level. This level of logic, in our system, is implemented using behavior trees. They can be very useful for choosing among high level alternatives and goals.

Next, it comes down to tools of the trade. And in this case, that means pulling out your gun or choosing to unleash that Force 4 fireball spell. Our system performs a weighted analysis of options available comparing the action points (AP) available, AP spend-per-action, potential damage, chance-to-hit, splash damage potential, friendly fire, etc. It selects the best option (or two) and queues it up to be performed. This may also involve moving to get in range (or better range) and/or possibly moving to take advantage of nearby cover.

Eventually it all lands in a low level system that is the nuts and bolts of driving the character around on the screen. Choosing which animation to play, how it meshes with the current state of the character (crouching and facing), which weapon(s) are equipped, whether and how much to turn and face... these are all driven by state machines, a simple, but trusted friend of any programmer.

When you put these parts together, it is a very powerful (but complicated) tool. You can see from the diagram that it manages to hook into many of the exciting gameplay elements we’re working on as well. We want to be able to build Runs that are your standard smash and grab, but also be able to play dress up and possibly sneak into a dinner party wearing that fancy suit, or to woo that bank cashier into giving you the extra details regarding the bank manager’s schedule without resorting to violence (necessarily).

One of my favorite features that might not be evident at first (it’s in that diagram if you look carefully), is the ability for a superior’s perception check to influence or even override those made by underlings. For example, let’s say you had a squad of Lone Star security guards and their commander protecting a genetics lab. If you manage to convince the commander that you belong there (i.e. pass a perception check) through, say, intimidation, fake papers, or even disguise, then when you encounter any of the guards later on, they will check with their officer as to whether you belong there.

If the commander says you’re good, the guard will just wave you on. Assuming, of course, that the guard has a high enough discipline trait. If he’s a slacker or doesn't trust (or like) his superior, he may just ignore his commander, and make his own check. This could be for good or bad, depending on whether he thinks you’re suspicious or not.

Currently, this type of “consult with superior” check is simply done invisibly behind the scenes for the sake of gameplay speed and flow. If you wanted a scripted scenario where the guard stops you, rings his commander, and then makes that assessment upon hearing back, you would probably want to dive into the trigger system and implement that kind of logic there.

We’ve come a long way on AI, but there is definitely a lot of work still remaining. We have a lot of different skills and abilities being coded up right now, so we’ll need to spend some time folding that extra logic into the various levels. We have to make sure the enemy Shamans summon things correctly and that mages will use that trusty Fireball I mentioned earlier without going unconscious from the strain. We’re also continually refining the overall believability of the AI to make sure it feels smart and fun while maintaining a proper challenge level.

That’s about it for my little peek behind the scenes. I hope it gives you an idea of what we’ve been up to on Shadowrun Returns!

Comments

It would be nice to have control in the editor over even lower-level AI points, like adding the superior's perception check as an in-game dialogue. If that were awesome, a simple trigger or extra dialogue more and you could add in an option to hack the comm of that soldier so he can't communicate with the officer. It would all hinge, though, on how deep the editor would allow us to create triggers or dialogues based off of behind-the-scenes AI steps. If that was possible, cool possibilities certainly present themselves.

Though, that uniform may not do you any good if you’re carrying a couple of assault rifles when the standard issue weapon is a pistol. (Yes, we actually model that level of sophistication! Though whether it gets into the final game is based on how much fun it winds up being. . .)

PLEASE LET THIS MAKE THE RELEASE BUILD. that is an excellent idea that absolutely captures the spirit of shadowrunning and changes the "disguise/stealth" element from the typical "i has the stealths" feeling that most games use. acquiring the fob should not be enough to suddenly be invisible to security; these are highly trained guards at corporate arcologies, and a large part of the magic of Shadowrun was preparing and executing the perfect plan.

you NEED to leave in the choices about what type of weapon/armor/gear (even race!)we are packing/ If i can roll into to Tir as an Ork rolling in with an RPG in a Copper Maiden tshirt, the same as a dressed up elf with no weapons spotted, it's going to cheapen the experience.

I loved what I just read. Very cool system indeed.
If you guys manage to implement all of this, the game will be a blast to play.
Keep up the good work.
-
offtopic: (since everybody is whining about it) for the record, I have no problem with pics

@tony
https://www.kickstarter.com/settings/notificationsGoto that page and unclick whatever projects you don't want to get email updates for. Whenever you decide you want to look and see how the game is going, come back to kickstarter.com, and look at the little globe icon at upper right, and click it. It will show you the updates you've missed.

Giant photos ended up stretching this entire update in my Gmail, had to pan horizontally to see all the text and it made things a little silly. Good to see that Kickstarter scales them down but but smaller-scale images linking to the larger ones might be better for email purposes. At least, I'd hope so, I'm not really sure what's going on behind the scenes at your side, Kickstarter's or Gmail's...

First, congrats for this post! Being a game developer myself, I know how hard it can be to explain such things, and how deep you can go without running out of things to say!

One question, as a Shadowrun paper RPG player: if astral world makes it into the game, how will you implement astral perception and interaction (particularly for astral "beacons" or players having a strong aura but no astral perception/awareness and having to face mages, for example)?

I love this post and I'm a huge fan of behavior trees and state machines because it's a reasonable task to expose a lot of this to the scenario designer which is fascinating and leads to very interesting level design esp regarding leg work.

So whadda ya know?! That's one hell of a Dev Diary there Chris. Seriously chummer, thank you for sharing...because you've just totally blown my mind. Once again I'm so excited hearing about Shadowrun Returns it's like a cranial BOMB of AWESOME exploded in my BRAIN!!! ^_`'`'`'`'`'`'`'`'`'`'`'`'`'`''`'`

I for one, would love as much sophistication in the perception model. At one point, I wanted to use tactical games to explore the original concepts of fog of war and uncertainty that was described by von Clauswitz, John Boyd, Musashi, and Sun Tzu. But most games don't do that. The "fog of war" in RTS is not really fog of war. I had toyed with the idea of writing my own tactical sim just to explore these ideas.

Perhaps consider making stuff like having the right weapons out in the open be something that matters when you play the game on 'Hard'.

Wow, never expected the AI to be so smart. As a player we tend to look for complexity more in external or environmental stuff. Tactical advantages we can use to our advantage. It's quite eye-opening to realise that our strategies rely as much on the intangible cleverness of our foes as on on our own skill.

The guards looking at what weapon you're holding, checking with their superiors, and potentially ignoring orders based on a personality trait sounds awesome! I hope you do include that stuff in the final game.

Bonus points if you at least see the guard touch his earpiece and see some dialogue text of him conferring with his commander. It would make for a nice tense moment.