Review: Unity Multiplayer Games by Alan R. Stagner


Disclosure: I was sent a free review copy of this e-book by the Publisher.

Format:

I made use of both the PDF & Kindle versions of this book while reading it. The PDF version displayed well on a Nexus 7 as well as my PC, where I used it to type in the many examples provided. The few graphics used in the book were mostly for configuration of Unity components, but all of them were in color in the PDF version.  I did most of my reading through the Kindle version.  It read smoothly on my Kindle Touch, and the code snippets displayed about as well as they can in that format.

Source code as well as errata are available for the examples in this book from the publisher’s websitePackt Publishing.  All examples are in C#.

Audience

This book is best suited for developers who have a working knowledge of the basics of Unity as well as experience using C#.  The author, thankfully, does not spend much time reviewing these two tools.  There are hundreds of other resources for learning Unity, and those should be explored before covering the topics in this book.  This book is a great introduction to multiplayer programming.  While a few intermediate and advanced topics are covered, it’s mostly geared toward beginners.

Content:

The book is broken up into seven chapters.  It adopts a “learn by doing” format for the majority of these chapters.  Some people like more exposition, but I enjoyed this format for the most part.  There were a few topics that I would have liked more detail, but overall the book covers a variety of methods of handling multiplayer gaming in Unity. I’ll go through each chapter quickly.

The first five chapters involve the different services that are available to speed up multiplayer development.  Each chapter has a mostly complete program that you will be creating to utilize that service.

Chapter 1: Unity Networking – The Pong Game
This chapter is a great way to start learning about building multiplayer games with Unity. You build a multiplayer version of Pong using Unity’s own multiplayer libraries. He also covers some basic networking concepts that are great for understanding the differences in the technologies in later chapters.

Chapter 2: Photon Unity Networking – The Chat Client
This chapter utilizes the Photon free libraries to build mostly a lobby system. The last bit focuses on the chat client bit itself, but I think the focus and value of the chapter is really the lobby, matchmaking, and friends lists tools that he describes. I had some previous experience using Photon, but this chapter adds a lot of great information that I think is severely lacking in the actual Photon documentation.

Chapter 3: Photon Server – Star Collector
These libraries take a lot more work to set up. Here you will be utilizing the Photon Server libraries to build a server application and clients. Together this makes a little collecting game.

Chapter 4: Player.IO – Bot Wars
This chapter is similar to chapter 2, but includes all the intricacies of working with Player.IO’s room system and their BigDB database. You will create a very simple RTS prototype in this chapter.

Chapter 5: PubNub – The Global Chatbox
This is the weakest chapter of the book, but thankfully it’s short. You will be creating a chat system similar to the chat client in Chapter 2. While some people may be interested in this, I felt like the service could have been mentioned alongside the information in Chapter 2, and the author could have saved the space for more gaming applications. Lobbies are interesting and complicated, so use these pages to expand the one we built already, instead of designing another chat client.

The last two chapters, Chapter 6: Entity Interpolation and Prediction and Chapter:7 Server-side Hit Detection, are some of the most valuable chapters in the book. The first five will help you choose the right service or libraries to start building on. The last two are really focused on taking that next step to a more advanced multiplayer game. I loved the information in these chapters, and I wish that there was a whole book devoted to more like them. The author prepares you for concepts like dealing with hacking, predicting object transformations, server side hit detection, entity rewinding, and more. I really enjoyed that he talked about how AAA games are solving many of the problems he describes. It really answered many of my initial questions that I had from the first five chapters.

Summary

I really enjoyed this book. The code examples were straightforward, and you can build some really neat multiplayer games utilizing Unity and these libraries. If you have no experience with making multiplayer games, this is a great place to start. I wrote a short little Pong variant based on these examples that I will be posting by the end of the month after it is polished up.