Dr. Langeskov, The Tiger and The Terribly Cursed Emerald.


If you haven't played it yet, you can download it from Steam for free!
We’ve been getting a few questions on how we do things in our new release, so I thought I’d shed light on a few key features!
Editor Lots of Dialogue
Currently theres over 560 lines of dialogue, all with translations in the pipeline. To manage this we compile a Google Docs spreadsheet into a JSON file which we can cheaply reference in Unity for any segment, be it guards or other NPC.
Combined with Unity’s Assertion Library, we’ve found it very reliable in updating content without spending too much time in the editor.

How might you do that?
You’ll need a way to export JSON out of Google Docs, then drag the file into Unity, once you've done that you can use SimpleJSON or as I prefer JSON .NET For Unity to parse through the data.

It can be as simple as:

int id = yourCurrentDialogueItemsID;  
DialogueJSON = JSONNode.Parse (DialogueFile.text).AsArray;  
if (DialogueJSON [id] ["Audio"].Value != string.Empty) {

  audio = Resources.Load ("Dialogue/" + DialogueJSON [id] ["Audio"], typeof(AudioClip)) as AudioClip;

  //Assertion Library
  Assert.IsNotNull (audio, "No audio loaded!");
}

Behaviour Trees AI
Guards work on a predefined path and will search based on a few key principles, all done with behaviour trees.
It wasn’t always behaviour trees though! Theres a few good systems which you can adopt for AI.

FSM: Finite State Machine
Finite State Machines group logic tied together with transitions, often featuring Intro/Outro step. Good for small controlled instances and it can be implemented very simply, even with enums! You'll find yourself using these pretty often - so often that I highly recommend Prime31’s StateKit, it's a great FSM implementation for Unity.

HFSM: Hierarchical State Machine
Hierarchical Finite State Machines group together logic as a Finite State Machine would, but in my experience give you a better overview with less duplication in transitions and overall less mess in shared logic. AngryAnt has a great sample scene for getting started with implementations of both FSM and HFSM!

Behaviour Trees
As the name suggests, Behaviour Trees are in a more rigid tree structure. Flow is directed by an actions success or failure, leaving the transitions between implicit. Overall it creates a very fluid and reusable design, although it doesn't permit very tight control.

On the upside, you don't need to commit to just one implementation. We found ourselves using a combination of the above systems and Unity assets such as AngryAnt's Behave or Behaviour Designer will make light work of designing AI.

Pencils

Optimisation
Optimisation is a main concern of ours, so we try pool recurring objects like the guards, particle systems and pencils.
Recently at 2015 Unite Europe Nordeus uploaded their GenericPool solution as well as profiling tools and a VaryingList. Unwarranted GC is never something you want, so I highly recommend these!
https://github.com/Nordeus/Unite2015

Pooling is super important as it doesn’t require more resources as it would instantiating every object you need, from the tranquilliser bullets, to the guards. GenericPool is an all-round solution that doesn’t require much work to set up.

_guardPool = new GameObjectPool (Resources.Prefabs.Guard, GuardCount, null);

for (int i = 1; i < GuardCount; i++) {  
  ...
  var newGuard = _guardPool.Fetch ();
  newGuard.name = sillyGuardNames.Next ();
  ...
}

Nordeus also has a profiler which can be handy when running on devices not currently connected to the editor, or just quickly profiling code!

using(ProfilerFactory.GetProfiler("profilerName"))  
{
  ExpensiveMethod();
  // more code that you want to profile quickly
}
ProfilerFactory.DumpProfilerInfo();  

If you have any more questions or comments, let me know on twitter! @nicetrysean
We'll also be releasing new content via our newsletter Crows Crows Crows

Check it out!