Chris’ Developer Diary

Hi! 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.

A picture of Chris Kohnert, starring Chris Aardappel’s photobomb

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. . .)

Chris Aardappel, who’s taking point on the AI operations. Yes ladies, he’s taken.

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!

13 Responses to “Chris’ Developer Diary”

  1. RC
    December 7, 2012 at 1:28 pm #

    Well.. shit. Chris, sir… you’ve just left my brains on the wall. ^_`’`’`’`’`’`’`|_

  2. Risingsun
    December 7, 2012 at 1:28 pm #

    Sounds fantastic. This game will have more depth than I could have hoped for.

  3. Xaosbringer
    December 7, 2012 at 1:38 pm #

    The dull Spluch noise you just heard was my brain leaving the back of my skull at high velocity targeting the nearest wall… Whoa.. Indeed. I look forward to seeing this in action.

  4. Zamion
    December 7, 2012 at 2:48 pm #

    though im sure you have added it is race one of the triggers for more racist guards? IE do the ork underground guards shoot humans on sight but the troll bouncer just gives other trolls more leway?

  5. Not of this World
    December 7, 2012 at 5:00 pm #

    I liked it, give me more!

  6. Fábio Vieira
    December 7, 2012 at 9:09 pm #

    Awesome post, mr. Kohnert! Never failing to keep us excited and well-updated! You guys and Black Isle 2.0 (Obsidian, inXile and DoubleBear) are the best! :D

    Love, love, love!

  7. Traxx Steiner
    December 8, 2012 at 6:30 am #

    Hoi Chris,

    it is great to read about the AI will factor in reactive/passive roll checks and not only simply follow s a given script…this will bring in some variance in behaviour of the npcs and thus makes the response to us players unpredictable for us.

    If it will carry out like you pictured it, it will be mind-blowing ;)

    I would like to ask you, if you also plan to implement some basic psycholocial repsonses as passive morale checks?

    It was always a major (still unresolved) question in our shadowrun pen&paper sessions, if we should translate the horror factor (from the Call of C’thullu system) into the shadowrun system. Mainly it was about when to prompt a composure check.

    The players mostly always responding emotionless the e.g. conjured spirits or an overwhleming opponent, where their avatars would not. The same goes for NPCs.

    I hope I could make my point clear enough…

    regards
    T.

  8. Wizfall
    December 8, 2012 at 9:19 am #

    “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.”
    If you really have made this possible it would be fantastic.
    Next step : same check made by everybody (with different consequence of course : townsfolk would not talk to you/run away for example/call Lone Star) so that you make light weapons and concealment realistic and useful gameplay wise.
    No more peaceful walking downtown with heavy weapons hehe

    • spike_baby
      December 20, 2012 at 12:00 am #

      Seconded.

  9. Joey
    December 11, 2012 at 11:13 am #

    …well what if I had vision augmentation and wanted to hack into that guard’s comlink and effectively make it unable to see me?

    Or if i’m a wizard who cast an invisibility spell beforehand?

    THE POSSIBIRITLTELS

  10. ShuChiba
    December 13, 2012 at 7:18 am #

    This is what i remember from the pen and paper version, awesome purely awesome

  11. Mike
    December 14, 2012 at 2:23 pm #

    I’m fired up for this, Shadowrun is a franchise with so much unrealized potential. Glad there are some real brains working on the game’s AI.

  12. Jean-Paul
    December 26, 2012 at 1:09 am #

    This information has me hyped up about this game. The artwork is fantastic and it sounds like it’s A.I is going to be handled quite well. I’m glad to see it going for a turn based action point using system akin to fallout or the jagged alliance games.

    One thing I am curious about is whether players can coordinate movement with their characters when out of combat. One thing I found myself wishing for when playing Jagged Alliance 2:Unfinished Business lately is that I would be able to move two or more mercs side by side so when enemies came up and combat mode was engaged, I would have said multiple mercs ready to fire. It would leave them compacted and more easy targets of course, but when dealing with only one or two mercs, it would make for very efficient spearheads to lessen the enemy group.