Building the chatbot server

Python is a great framework and it provides a number of great tools for game development. However, we are going to focus on using Unity for our purposes. Unity is an excellent and very user-friendly game engine that will make setting up complex examples in later chapters a breeze. Don't worry if you don't know C#, the language of Unity, since we will be manipulating the engine through Python in many cases. This means we want the ability to run our Python code outside Unity and we want to do it on a server.

If you are developing your game in Python, using a server then becomes optional, except that there are very compelling reasons to set up your AI bots as services or microservices. Microservices are self-contained succinct applications or services that only interface through some form of well-known communication protocol. AI Microservices or AI as a Service (AIaaS) are quickly outpacing other forms of SaaS, and it will only be a matter of time untill this same business model converts to gaming as well. In any case, for now, the benefit we gain from creating our chatbot as a microservice is decoupling. Decoupling will allow you to easily convert this bot to other platforms in the future.

Microservices also introduce a new communication pattern into the mix. Typically, when a client app connects to a server, the communication is direct and immediate. But what if your connection is broken or the communication needs to be filtered, duplicated, or stored for later analysis or reuse? Then using a direct communication protocol becomes burdened by adding these additional functions, when it doesn't need to be. Instead, microservices introduce the concept of a message hub. This is essentially a container or post office where all the message traffic passes through. This allows for incredible flexibility and offlines the need for our communication protocol to manage extra tasks. We will take a look at how to install a very easy-to-use message hub in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset