Adventure Game Creator Framework

Hi all,

Over the last couple of weeks, I have been building a small framework for creating text adventure games.

I was inspired, in part, by the Text101 game from the Complete Unity Developer course, childhood memories of Fighting Fantasy / Choose Your Own Adventure books, and of course the volume of awesome students taking this course who have made this game and wanted to expand on it.

They do say that the Devil finds work for idle hands…

I’d like to share what I have so far with you.

The Aim

What I set out to do was to demonstrate how you can, and arguably should, separate your story from your code and make the adventure game more extensible.

I had myself provided feedback on a number of student’s Text101 games and offered ideas for extending it, most of which included “separate the story from the code, perhaps use XML” but I’ve yet to see anyone attempt it, nor had I offered a step-up for anyone to try to.

What Does It Do

The framework at this time is fairly limited in its functionality but does provide the following features;

  • Adventure Data Read from XML
    The story text (data) is not embedded within the code

  • Location Based Story Model
    Just as the books above did, locations contain items and have connections to other locations

  • Living Story
    Locations can be updated during game play, e.g. dropped items are reflected at the location they are dropped at

  • Searchable Locations
    Sometimes items will just be mentioned, in other locations the player may need to search first before they are revealed

  • Player Inventory
    Items that the player pickups are persisted through the story until dropped

  • Take / Drop Items
    Basic functionality for adding items to/removing items from the inventory

  • Examinable Items
    Items can be examined to reveal additional information (hints)

The Example Scene Is Dull

Being a framework my aim was not to make a whizzy looking game, instead provide a tool which could be used by others in order to make a more whizzy looking game, as such, the framework currently comes with an example scene which is incredibly basic and does little more than providing an interface for an adventure.

It is grey. It is dull. Anyone can make a more interesting scene. Please do.

Development Road Map

The current road map (read: gravel track) looks like this;

  • Usable items
    As an example, a locked door may require you to use a specific key to open it

  • Game Over Conditions
    Currently you navigate through your locations but with only the story telling you that you have won/lost

  • Automated Key Bindings
    Key bindings are currently controlled through the XML file, with the exception of some reserved keys

  • Alternative Data Sources Support
    Database/Web Services

Creating Your Adventure

At this time there is no editor for creating the story, this is something I would seek to implement at a later stage. The structure of the XML data file is fairly lightweight, meaning that anyone with a text editor could write their own story, drop the file into Unity and off you go, playable game.

Want To Try It?

If anyone is interested in giving it a try please let me know and advise as to which version of Unity you are currently using. It has been developed using Unity 2017, but with the example scene being so basic there is no need to have Unity 2017 installed. I’m happy make one or two previous Unity versions available if there is interest. The real content is the C# framework.

I will happily put together some lightweight documentation on its usage but from the outset, it has been my hope that anyone at the Text101 level of experience with Unity would be able to use it with the briefest of instructions.


I would, of course, welcome any constructive feedback/criticism, better still I would love to see some screenshots of your own scenes which implement the framework, throwing away the example scene.

Thanks for taking the time to read my post and showing any interest in my work. :slight_smile:


Hi Rob, I would like to give it a try and learn from your code.
I am using Unity 5.6.1f1.

1 Like

Hello Shyam,

Thank you for your interest, more than happy to create a 5.6.1f1 version.

In line with the roadmap above, I have started implementing the Usable Items functionality, in a fairly light manner. Hoping to have that wrapped up by this evening / tomorrow.

I will respond here in the next day or so when I have downloaded / installed 5.6.1f1 and rebuilt. :slight_smile:

1 Like

Hi @Rob,

I’d love to try it. I’m working on a Text Adventure and was already heading down this road. I’m using the latest version of Unity.

Do you plan on releasing this on Github? I’d be happy to contribute.

Happy Coding :slight_smile:

1 Like

Hello @justinhhorner,

Thanks for the reply. Is that 5.6.2? Or 2017 beta?

Regarding GitHub yes.

I’ve fallen a little behind this week due to some other things I needed to take care of.

I did however check to see whether Unity 5.6.1 would be happy to open the project as-is, as I mentioned to @dreamer, it’s very lightweight on the Unity side of things at this stage. It does give the standard warning about being opened with a different version of Unity but aside from that there are no ill effects.

This led me to wonder about actually separating the project so that the code is merely a library and then a separate project could be created for the Unity side of things. That I believe would make it considerably easier for me going forwards with regards to releasing updates/versions which people may want/need in different Unity versions.

Part of the delay is also because I had started implementing the usable items, it’s in it’s infancy at this stage and as such that has made the which supports it significantly less how I would like it.

Would you and @dreamer prefer a slightly tidier version or, the one which supports the first iteration of the usable items?

Let me know and I will endeavour to make this available this evening for you both.

Regarding collaboration - this wasn’t something I had initially consider to be honest, it was more of a case of putting something out there which others could use to see how they could create a text-based adventure game and learn to separate content from code. I have effectively achieved that and taken it a little further than I needed to.

Whilst I hadn’t initially considered collaboration, neither am I ruling it out. Perhaps take a look at the project initially and see what you think, I have more to do regarding it’s architecture, especially regarding the main manager class which has grown as I have added additional functionality and will need considerable refactoring. I think I would like to get that all tidied up before I necessarily open it for collaboration but we will see.

Thanks again for the interest, let me know about the various questions above and I will try to get something available for you both to try out later today.

Thanks for the info @Rob,

Since you’re already doing a build for @dreamer 5.6.1f1, I’ll use that.

I believe separating the project to make the code a library is a great approach since there are few dependencies on Unity itself. This will certainly help with adoption of the framework.

It would be great to see the stable master branch along side a development branch with your latest iteration of usable items. If you’d rather the project be hands off in terms of collaboration, state that in the and possibly a letting people know. Others can still fork the project and build upon it. If you decide to allow contributions, I’d be happy to help admin the project on GitHub if you’d like.

Once it’s solid and you’re happy with it, maybe this would be a good fit for the Unity Store.

Thanks for working to make this available to us. Let me know if there’s anything I can help with.

1 Like

Thanks for the response and ideas Justin, appreciated.

At the moment there is only the master branch, I was toying with the idea of creating a development branch only the other evening ironically. The thought at the time was that it was not needed as I was the only developer on the project anyway, and, if I make a mistake I can still pull back to a previous version if required. This was prior to your post about collaboration, if I go down that road then yes, I think another branch would definitely be an excellent idea.

I wasn’t aware of the configuration, so again, thank you, this is useful information. I’ve only been using GIT for a short amount of time, I was using SubVersion in my place of work previously.

As per the other post, I will endeavour to get you both a 5.6.1-happy version later today and I will list any currently known issues.

1 Like

Hi @Dreamer / @justinhhorner,

As promised… please find below a .zip file containing the AdventureGameCreator project. I created a new 5.6.1f1 project and recreated the basic example scene. It should therefore not generate any warnings.

Items to note;

  • The scene is deliberately dull - no real time has been spent on it. You are welcome of couse to create your own scene and as long as you have the three required UI Text game objects you should be ok. I added panels to these just to make it look a little more interesting.

  • The content/story is held within adventure_data.xml which is in the following path: / Assets / StreamingAssets / XML - change this as you wish using the existing structure, it should be fairly obvious but ask if you have any difficulties.

  • I have, by design at this time, included the requirement to close the Inventory before you can choose other options. In my mindseye I was envisaging the Inventory to appear as a modal. So, if you are wondering why you can’t pick an option, this will probably be why, press I to open/close it.

  • The Use Item option is currently displayed but will throw a NotImplementedException as I have given you the version prior to adding this functionality.

  • The main AdventureManager.cs file currently contains far more than it should, it is scheduled for refactoring.

  • The code is commented and members are named descriptively should you want to read through it and follow what is happening. There are also some notes/todos that I have added here and there.

  • The project is on GitHub but I thought this would be easier as a method for giving you a version to experiment with. Once I have tidied things up a bit futher and improved the use item functionality I am happy to pop the link up for that also.



Thanks @Rob :slight_smile:

1 Like

No problem Shyam, let me know how you get on :slight_smile:

This looks cool, I tried the demo scene and it’s very simple to use, I’ll have a nosey through the code when I get more time as I’d like to understand how it’s done :grinning:
Good job!


1 Like

Hi Pete,

Thanks for the feedback, appreciated.

I’ve not put any instructions together for it yet, as hopefully, like you said, it should be easy to use. It will, of course, need some for the XML data structure / elements / attributes in due course, and as it evolves I will ensure this is provided.

Currently reworking the usable items feature (not included in the above) as it wasn’t as good as I wanted it to be.

As soon as I have an update I will update this topic :slight_smile:

p.s. would love to see some screenshots of people using it but with their own scenes, just needs 3 UI Text objects to function, so if anyone has any artistic talent (I do not :smiley: ) perhaps a scroll or something medieval or futuristic or whatever… would be nice to see :slight_smile:

Privacy & Terms