Unity 2D space shooter – game update – dialogues! – update 10

Although still being unnamed, I know one thing – my 2D space themed shooter game is not going to be a pure shmup. It is going to be a hybrid of sorts. I’ve known this ever since I decided I wanted to add dialogues and random events to the game play.

boss-interaction1

A while a go I managed to get hold of a free copy of Dialoguer, a Unity asset that helps you create branched dialogue with a handy editor. I lost that copy, and when it came to me finally having a chance to implement it into my game, I bit the bullet and bought a copy off the asset store. The asset is put together nicely – it has a good event system with events to subscribe to for every part of a dialogue interaction. The editor itself also has some useful features and works well.

However, I did need to do some work to stitch my GUI (Daikon Forge) together with Dialoguer. I wrote a custom Monobehaviour script that functions as an adapter between Daikon Forge UI and Dialoguer to provide DF GUI elements for every aspect of a Dialoguer interaction. It basically boils down to a few UI elements and some methods that I subscribe to Dialoguer’s events. I also hook my own EventManager system in to ensure my game entities respond to my own events when they need to based on various dialogue actions, such as disabling player control input when a boss comes on screen to enter dialogue with the player.

Dialogue interactions are then defined in XML files which are deserialized and converted into parameters for game events and entities. They are essentially my “rudimentary” level editors – when all the core game mechanics are done, the idea is that I’ll simply be able to mess with my XML files to balance and tweak levels and gameplay, or design a simple level editor that plugs into the XML. For example, I might define a boss’ look, properties, movement style, and dialogue options in a specific XML node. When the game manager reaches this node, it processes it, sends the boss on screen and the dialogue scene starts up.

df-dialoguer-integration
Adapting Daikon Forge UI with Dialoguer
An example of one of my boss encounters defined in XML
An example of one of my boss encounters defined in XML

 

boss-interaction2
Feeding the boss false information about my intentions…

 

boss-interaction3
This boss was not happy with what I said to him, as such, he launched a massive missile salvo at my ship along with hot plasma bullet fire!

 

If anyone is interested in adapting Daikon Forge UI to Dialoguer, feel free to drop a comment or get in touch – I am happy to share my code 🙂 (C#) PS the awesome character portrait placeholder you see in the dialogue example in my screenshots above is courtesy of my good friend Gesworx!

Leave a Comment