Building a game assistant using Unity3d, Blender and QnA Maker

Guest blog by Horatiu Ilie,  I have been a Microsoft Student Partner for more than one year now. I am currently a 3rd year Computer Science Student at University College London


I am a huge fan of Artificial Intelligence. I love all types of programming, from web development to building Machine Learning solutions and, recently, I started to be passionate about entrepreneurship and business.


Through this post, I would like to tell you more about how I had the chance to develop a game assistant for “Flames of Agartha” at IC Hack 2017 and to give you an idea of how you can use tools like Unity and QnA Maker to accomplish such a task.

In other words, I want to walk you through the following:

· What is Flames of Agartha and how does it work

· How Blender and Unity were used within the game

· What is QnA Maker

· How to develop a QnA Maker solution and connect it to the game

· Outcome and Conclusions

Flames of Agartha

Flames of Agartha is a 3D puzzle game which has quite a common idea behind: you are starting in an open world and must find answers to hidden puzzles in order to finish the game. However, the cool idea of the game is that we developed an “in-game” assistant (The Oracle) – a bot that can answer your questions about different puzzles.
We created the game so that it is almost impossible to solve all the puzzles without making use of the game assistant. Moreover, the idea of having a bot within the game made everything more interesting, as one had to know exactly what questions to ask in order to get the right answers.
But how can you implement such an assistant into a game? Well, I created a game console where players can write their questions. Then, we trained a bot model in the cloud to answer these possible questions and, which was accessible from the game console.

So, the way it works is simple and you can find even more details about it here:

Finally, I would recommend you watch the demo, as it will give you an even better idea about the game:

Blender and Unity

Before going to the actual bot development, I want to quickly talk you through the two main tools used to develop the game: Blender and Unity.

Blender is an open source 3D creation software. We mainly used it to create our 3D models and it proved to be very efficient and fast, allowing us to finish our whole environment in under 24 hours. However, I do not want to focus on this specifically in this post and, if you want to find out more about it, please check the Blender project website: .

On the other hand, Unity is one of the most used game engines in the world. It is very powerful and it provides a great framework for building games on all types from platforms, from mobile to VR. This was our main tool for building the game: the place where we imported all the Blender models and created the actual game.

Now, my main task within Unity was to create the game console which communicated with the cloud bot. All the other details were implemented by the rest of the team, so I will not focus on them in this blog post. Finally, if you want a better understanding about Unity, which might not be covered here, feel free to visit their website: .

QnA Maker

QnA Maker is one of the simplest Bot technologies out there, which allows everyone to easily create question and answer bots based on FAQs. It is incredibly easy to use – all you need to do is to provide a specific FAQ document and it will automatically create a Q&A bot for you in the cloud.


Basically, after feeding the Maker with the information you want to use, it will automatically deploy the model as a service in the cloud – service that you can easily access by making an HTTP request to a specific endpoint.

In the next section, I will present more about how to deploy the bot model and use it from Unity. If you want to find more details about what I discussed so far, please, have a look at the QnA Maker webpage: .

Develop a QnA Maker solution and connect it to the game

Now, to start using the QnA Maker, simply begin by visiting their web page and click on the “Create a New Service” button.


Here, simply name your new service and either paste a URL to an FAQ you want to use or provide a document with question and answers. For “Flames of Agartha”, we spent a lot of time for creating our own FAQ document, providing a lot of possible questions and answers that the bot my use. So, if you need an accurate service, I really do recommend you spend some time on creating a good set of examples that the assistant can use.

After the above steps, click on Create and then your service will start to be deployed:

Now, the content you used will be extracted by the tool and extracted into a knowledge base. Now, before actually publishing the bot, I definitely recommend going to the “test” section and try for yourself how your assistant behaves. The cool part about this is that if the bot does not know how to answer one of your questions, you can provide alternate answers to it and then retrain the model, which is a quick way of solving errors:


After doing some testing, it is time to simply publish your service. And do not worry if you might need to make future changes, you can edit your model at any time in the future:


Ok, so our service is up and it can answer to queries as the one in the image above by sending a simple POST request.

So, all we need now, is just a way of simply sending a HTTP request from Unity to our service endpoint.

Moving on to Unity, I needed a way to create a C# console where players can communicate with the bot. I was relatively new to Unity and I was not sure how to build the UI for such a console, but I found these 2 tutorials really helpful:

By basically following these 2 examples, I managed to have a fully functional game console, so if you want to find out more about how to do it, I recommend you take a look at the tutorials.

To recap, at that moment I had the console UI and the bot in the cloud. After following the console UI tutorials, my console was capable of getting the submitted text from the user, but I needed a way to communicate with the bot endpoint in the cloud. And that proved to be quite simple.

Firstly, I needed to create a C# Uri object where I included the endpoint URL of the service, along with the knowledge base ID. Then, in the body of a post request, I added the question in a JSON format. Moreover, I added the subscription key of the service in the header of the request. In other words, I used a C# specific way of sending a POST request with the question, subscription ID and knowledge base ID and simply received back the response. The code can be seen below:


It was simple and fun and, with this, everything was in place. If you want to give it a go, please download the game .exe application file from GitHub: .

Outcome and Conclusions

All in all, I learnt a lot from the experience. I further developed my game development skills, as it was the first fully functional game I have ever created. Moreover, I had the chance to work with the QnA Maker, which is an amazing tool for quickly creating lightweight bots for a wide range of situations.

I hope that you enjoyed this post and that you found out a cool and easy way of building intelligent bot solutions – either in games or in other applications.

Thank you for reading!

Comments (0)

Skip to main content