Tuesday, 24 August 2021

Sprint Roundup : Intelligiable Artificial Intelligence

Hello Folks,

If you've been following along on the devblog for a while you will know that OFF GRID's NPC A.I. is quite extensible, moddable and able to create interesting dynamic behaviours, we've been continuing to refine and polish this of recent, and this blog will dig into a few of those changes.

One of the things those of you who are players in our First-Access testing groups have commented on regularly is that these complex behaviours can be hard to pick up on some times. Fundamentally there is one word used in game development to describe this, it's down to having a lack of "Juice". Creating juice in a given system is essentially the art of designing satisfying player feedback with animation and audio, and we have been digging into this specifically in the context of our AI recently.

 NPC reactions

It's a small thing, but up until now you could only tell NPCs were receiving data by watching the networks in data view. We have now improved the NPC reactions so that they physically respond to data too.

Similarly - showing what an NPCs behavioural model is upto has been tricky just through animation. We had hoped to just show what NPCs were thinking for players to deduct their next move from purely through character animation, in reality in a 3rd person game you are often so far away from the characters you are watching that this proves very difficult. 

 



We decided to move to a more Metal Gear Solid Style system of core NPC thoughts and behaviours being identified as icons above their heads at certain times.  It's pretty early in testing but it certainly seems to have improved things, more on this in future blogs as the feature evolves.

Another is the fact that the modders we have testing the tools to make their own levels tend to want to be able to make more expansive environments and put more random background NPCs in to their content without having to write or design specific AI routines. They want to be able to drop random wandering NPCs in, *in walks the Wander NPC system*

So this doesn't end up becoming a book rather than a devblog we'll focus on this particular system as the deep dive for this post, and we can dig into the others previously mentioned here in future posts as they mature.

The Wander NPC System

Essentially the bulk of AI work last sprint was creating a new system to easily have more neutral or non-enemy NPCs in a level without the need for the resource intense AI calls the main NPC system uses. This helps bring to life many of the environments and makes levels set in public spaces seem somewhat more realistic. We decided to call this lightweight AI the WanderNPC system, to differentiate it from the core and more complex NPC AI.

With the "normal" NPC system, every character has an agent definition to control its behaviour. This is good for having various types of NPCs in a level, but every NPC needs to be defined in the mission script, so it's not exactly a quick and simple way to spawn various characters scattered in a level. We needed a system to spawn NPCs more easily and without any specific AI, just different characters with different props and colors wandering in a level without any bigger purpose, except filling the level.
To use this new system you only need to use the respective function in the LUA API, specifically the function "Mission.SpawnWanderNPCs", this function has some parameters to easily change the spawned characters. They are the following:

  • spawnpoint : Is of the type string and is the only required parameter, the point selected to spawn is going to define the area that we want to spawn all the wander NPCs, every wander NPC is going to be spawned in a random position inside that area; the spawned area is defined by any position that a navigation agent can walk between the selected spawnpoint at any random position inside a specific radius, the wander NPCs cannot use doors, so doors and walls are normally the boundaries of a spawning area.
  • quantity : Parameter used to define the number of wander NPCs to be spawned at the same time in a specific area, if this parameter is not manually set then it's only going to spawn 1 character
  • characters: This defines what characer models / prefabs the system will spawn, at random.
  • headprops : Like the name suggests its possible to define a prop or a group of props for the characters to use, the character is spawned with a prop or none in a random way, and never more than one prop
  • colorTextures and metalTextures :  It's possible as well to randomize the color and metal textures of the characters spawned, if none is selected each character will have its default textures
  • gestures : Sometimes the wander NPCs will run an animation when they tops momentarily, this animation will be a random one of those selected in this parameter

As you can see, with this new system it's very easy to spawn various wandering NPCs, and it's also very flexible, by just changing some parameters it's possible to have a diverse crowd in a level, making it possible to have even more unique looking levels!

New Content - The Harbour Terminal

Since the last blog post we've spent more time designing and modelling for the Harbour level's main building. This one is a bit different from many of our locations, the main building itself is big enough to be a  full level on it's own.

 Like the rest of the Harbour, we've made it to support lots of alternative routes through the level, more than what we'll likely enable for when you play this level the first time. Let's just say that we have some interesting plans for that...


Changelist and other updates : 


Content (Level Design and Art)  

  • Intro at the Apartment - player guidance and tutorialisation
  • Courthouse - more advanced devices and puzzles
  • Harbour - creation of areas for future expansions to the game
AI 
  • Creating the new Wander NPC system
  • Start on AI behaviour icons system
  • Reactions from NPCs and their corresponding animations

Modding and Lua API additions 
  • Player path tool now supports connections between paths

Bugs fixed 
  • AI reacting with a Radio
  • AI Pause
        - Save time reduced
       - The save system also save the player crouching / standing state
        - Use item button visible after loading an autosave


If you haven’t already - be sure to wishlist Off Grid on Steam - each wishlist makes a big difference to us, and we really appreciate your support!

Tuesday, 9 March 2021

Sprint Roundup: Spring Forward

Welcome Folks and Happy 2021, and how good does it feel to be finally well out of 2020?!

Thanks for bearing with us while we got this you, we missed December's update, but here we are, back in the swing of things, and so finally here is your back-to-regular dev update!

 Give me an 'A', give me an 'I', what does that Spell?!

On the last sprint roundup we mentioned that we started to work in some improvements in the AI to give more flexibility to the NPCs. So what exactly are these improvements? To start, some bugs were fixed, some unused features were removed and others simplified. But the main thing improved was the possibility to change, add or remove any aspect of the NPC behaviour in run time, like, for example, actions and goals, and with this came a round of improvements on our AI debugging tool, the AI Explorer:
 


The default way to change any NPC behaviour is still as it has always been, changing the world states.  Only in specific situations should changing the goals or actions be needed, but this is now possible by adding or removing them during runtime and allows for much more complex behaviour. Changing Goals should be used rarely, as it is seen as a more permanent change to the NPC behaviour. It's important to keep the following concepts in mind to understand the best way to change an NPC behaviour:
 
"World States" represent everything that the NPC knows about the world and themselves, for example: The guard must see the intruder before doing any action to try to catch it.  Changing world states in order to evoke a reaction is the first thing you do. 

"Actions" are the available skills and resources that an NPC has, for example: A guard should have an action to use a taser or other resource to knock out the intruder, and so accomplishing his goal. Changing actions is the best way to change what an NPC has the potential to do.

"Goals" describe the intentions or beliefs of the NPC, for example: the guard should always have the goal to catch the intruder, because it's his job, if this goal is removed it means that the guard lost his faith or belief in the job. For this reason goals are the last thing in NPC behavior you would consider changing as you are fundamentally changing them as a person.
 
Being able to alter any of these at runtime means NPCs are now more flexible and give more options to design new levels and scenarios, that is noted especially during the gameplay because now its possible to change its behaviour at any time and you don't have any restrictions in relation to what was initially defined in the NPC, so that means that a NPC now can use picked up objects, learn new skills, change their main objective, among other possibilities, it really is much, much more flexibility.

But of course this flexibility also means that is important to be careful with the complexity of the NPC definition, it could get a bit confusing in the best way to accomplishing some results and also could be hard to track why the NPC is behaving in some way. So to simplify we think the best way to approach the changing in the NPC behaviour in runtime is trying to change the world states first (but being careful to not have to many different states), next is the actions (that are especially handy for use specific items and skills), and the last one is the goals (that need to be used very carefully because a minor change can change the NPC behaviour drastically). Hopefully this model will provide some exciting opportunities for us in design and for modders too!

We also replaced the old Lua API call for altering a character's motivation value with a new generic system which allows for checking, and setting, any of the stats an AI might have.

The U in Usablility

Since the last blog post, we've spent some time fixing some usability issues on the UI side. Mainly, we've added automatic scrolling to UI for use with gamepad controls, removing the need to use scrollbars, which then simplifies the navigation across the UI. To go with that, we've updated lots of the UI across the game, also fixing some selection issues and improving on the mouse cursor autohide system to further smooth the controls and especially switching between input methods. While these might not sound like big changes, they certainly have made the user experience a lot smoother...


Paperwork for a good cause!

The start of a new year always brings a lot of paperwork, with our financial year end timing in to the calendar one.  It's a lot of shifting numbers on spreadsheets but the nice thing is that in the UK, with the fantastic BFI's support, we actually get a credit back on money we have spent on development each year though the Video Games Tax Relief scheme the UK government runs. Pretty good stuff.
 
We have had some work for hire that we have fitted in in a couple of places, Pontus has been doing research and development on an unnanounced project of a developer friend of ours and Rich ran a lecture series on Blender basics and specializing in Character animation for the MA Character Animation course at Central Saint Martins, University of The Arts London.

We also managed to garner some more funding for some R&D work from one of our long term partners Creative England, which has been super exciting - PLEASE don't jump to any conclusions from this but we have been researching how well our procedural message generation can be evolved to be able to handle languages other than English...
 

No Tofu!

As mentioned above, we have been working out how our generated content will work in different languages and doing some R&D on non-latin alphabet/writing system support.  This is all quite exciting stuff, and warrants its own dedicated post at some point, but... essentially, OFF GRID's game mechanics depend on key words in data and meta-data generated by NPCs, and the fact that there is text in the game that is generated at all creates and interesting problem to solve when it comes to localisation.
 

At this early stage we can't specify any particular languages, in-fact we can't guarantee it will work, or that there will be any other languages than English in the game, but we are laying the groundwork to see if possible and have embarked on some research work to see what those possibilities are, watch this space!

The Beginning and The End

Some of you who have played alpha builds, or demos at some point may have seen the intro cutscene to the game (it's the one that some of the clips in the trailer on our Steam page come from). One of the things we have been working on is making this part playable and more of a mix of small cutscene sections intertwined with basic tutorials and gameplay. We are believers in making sure that everything in the game story is told via gameplay and the environment as much as possible, so we were keen to make sure that the very beginning of the game sets the scene while still adhering to this principle. 
 
 

 
Unity's timeline is the powerful tool we have been using to achieve this, but we have had to do some real hackery to get it to play nice with interactive sections rather surprisingly.  When you couple that with tying it into our lua commands for writing missions, objectives and triggers and you start to get quite a complex section of the game to assemble. It's coming along nicely though, and they say the first 30 seconds, and 30 minutes of a game are the most important to focus on to keep players intrigued, so we have been happily dedicating a lot of time to getting this to all feel right. It's also certainly something we'll be counting on you, as our players, to play and give feedback on ahead of full release. Looking forward to seeing what you think!

 
We've also been fine tuning and cleaning up some of the content in the later game and making some more complex puzzles and hacks. The wierd thing about editing content is sometimes you can make more of something, in this instance we needed to make sense of one of the final missions, and actually breaking it into two seperate missions works better.  Without giving any spoilers, one of the planned missions is now giving a 2-for-1 value!
 

Changelist

Content (Level Design and Art) 
  • Design for the Harbour level passenger terminal / offices building
  • Replaced messages that were written for old SMS system with proper single-message conversations
  • Courthouse initial puzzles done 
  • Taking the scene from prototype to production and playable instead of just a cutscene
  • Broke up Court House Level into two levels

Controls and UX
  • Autoscrolling in UI
    • Usability improvements especially on a gamepad for any scrolling UI
    • Greatly improves device UIs since it means we can make their scrollbars un-selectable on a gamepad, simplifying the navigation in that window

AI 

  • AI Goal and Action improvements for flexibility
  • AI Debug system improved (with more information and in a clear format)

Modding and Lua API additions 
  • Lua API support for setting/getting NPC AI stat values
    • We used to have AI.AlterNPCMotivation(name, value) specifically for setting motivation stat value, this replaces it with a generic AI.AlterNPCStat(name, stat, value) usable for all the stats an AI might have
  • Lua support for Unity timeline and firing Lua functions from it (use wisely!)
  • Lua Console app for testing any line of lua anywhere in the game
Bugs fixed 
  • Bug fixes related with the AI and save system
  • Fixed issues with mouse cursor autohide/show system when switching between mouse/kb and gamepad controls
Other 
    • Year end accounts and VGTR
    • A few small work-for-hire jobs
    • Blender for Animators Lectures
    • New Ideas Fund application and grant

     

    Hopefully that catches you up on OFF GRID development. It's been a tough 2020 for us, especially the second half of it.  Safe to say, the world has been turned upside down and that had an impact on some of our families and how we managed running businesses and looking after our loved ones. Obviously OFF GRID is continuing development but running behind at this point, luckily we have at every turn been ahead of the punches and come up with game plans to make sure we could continue sustainably, and deliver OFF GRID come what may.

    For our little studio this has meant tightening our belts at the couple of junctures when we have found we were behind our anticipated milestones, tightening scope, bringing in some part time work-for-hire contracts to top up the coffers, and scaling the team down so we could operate in a lean and efficient way. The knock-on effect of shrinking the team for sustainability is it means things take longer, but it has the benefit of meaning you can roll with the punches and survive more easily.

    The three of us, Pontus, Andre, and Rich are still working hard on dev, bringing you the best game possible, and one thing is clear, with our great little team, OFF GRID is going to be everything it deserves to be, and that you deserve it to be for supporting us. Thank you so much and looking forward to showing you more over the coming months!



    If you haven’t already - be sure to wishlist Off Grid on Steam - each wishlist makes a big difference to us, and we really appreciate your support!