Networking Rework Again!

Mirror Networking

Well, here I go again.
I finished moving my multiplayer TicTacToe to the new networking system using litenetlib and it worked beautifully! I had to do a complete rewrite on the relay server also. In the end, everything worked great and the world was happy!

I then excitedly decided to work on the multiplayer pong game. The whole reason for the TicTacToe game was that it is one of the easiest games to write, its turn based and perfect to use for my first multiplayer game. So when I finished that, I figured I need to work on something that had some live action, synchronized objects, player movement, etc. Thats where pong was a perfect choice.

I got all the way to the end where I was trying to sync the player paddles and the ball. I spent a few weeks trying different things but ultimately in the end, I decided to look at other Networking solutions, preferably something that already had syncing of variables under the hood. With LiteNetLib, you have to write your own syncing algorythms, and that is definitely not something I could pull off. I got pretty close a few times, but something would always cause it to get out of control.

Photon Pun2
The first thing I took a look at was PUN2, or Photon for Unity Networking, version 2. Due to the type of architecture I wanted, I needed to create a seperate server that manages the clients, not so much the game, but the clients themselves, somewhat of a matchmaker with more control. Photon Server seemed to fit the bill perfectly, at first anyways. After diving into it, I came to realize real quick the lack of documentation. Without this, its damn near an impossible task. Getting PUN2 working with the server was pretty easy, but in order to get the server to do what I wanted, was requiring too much research, forum posting and begging for information. I finally decided to go with Mirror.

The downside of Mirror is pretty close to the same as Photon, lack of documentation. Very abstract or high level examples that are tough to understand and not too much information available, at least for what I was looking for. I finally decided to sponsor it and get access to premium help, this was well worth it. In the end, after a few weeks, I got going in a good direction and should hopefully be able to get the Multiplayer TicTacToe rewritten using Mirror soon. A few good things about Mirror is that it was based on the original Unity Multiplayer UNET, its open source for those that get off on that sort of thing, tons of examples (If you can understand them, not for the basic type like me) and once you get a grasp of it, it gets easier to understand and implement.

I just wanted to give a quick update, document my progress and take a break from spewing code, lol.

Ok, back to it! See ya on the next one!

Added The Game Realm Chat!

After getting the website up and running, getting the layout and styles to somewhere near where I wanted it to look, my first step was to get the chat system up and running. Since The Game Realm is all about multiplayer browser games, implementing a networking system was the number one priority.

Chat Screenshot

During my never ending search for the different architectures available for browser based or even non-browser based networking, I looked into everything that was available. My first adventure led me to After spending quite some time learning what it was, how to use it and implementing it into the website, I decided it wasn’t the direction I wanted to go. was great for sending messages back and forth but I would need to go alot deeper to incorporate a game server using it. I decided to look into the Unity Unet system (again).

One of the main reasons I wanted to use Unity to create my networking system is that I love Unity. I love the editor, the fact that I can port to just about any device and I wanted the server and client to share some code, which will make writing games for the web site a lot easier.

The first thing I needed to do was to learn what Unity UNet was all about. I will say that it was quite a learning curve. Trying to figure out what HLAPI and LLAPI was and how to do the a simple implementation of a network put my brain into overdrive.

My goal was to create a simple chat system. Since a multiplayer game is in reality nothing more than a server and a client sending messages to each other when broken down to its most basic level, I figured a chat system is the place to start.

While delving into the Unity UNet system and learning LLAPI and the HLAPI, I was finally able to narrow down the most basic usage of networking code as possible to get a server and client up and running. Of course it used a system I didn’t see in the forums or anywhere online, just something I came up with. So far I’m very excited about it and can see how I will be using it to create the games here at The Game Realm!


One of the things I found out is that the Unity WebGL doesn’t allow the mobile Keyboard to open when using the chat on a mobile browser. After seeing this I had to incorporate a home made virtual keyboard for the mobile browser chat which you can see in the screenshot above. I’m not very happy with it since the buttons are small, don’t respond as well as I would like and it isn’t very pretty. But until Unity fixes this, I don’t have any other options, yet!


Update as of June 2nd, 2018…
I decided to move away from hosting my own chat and decided to use the Wise Chat plugin. It was a lot easier, had all the features I needed and easy to implement plus no Maintenance! Check out the Chat link in the main menu! 🙂