Sponsored By

Weather, new Pop-up Design, and Network Traffic

This week I share the challenges with creating a new pop-up manager class and my efforts to reduce network traffic between client and server.

James Bennett, Blogger

February 29, 2016

2 Min Read

Since my last post, Krees and I finally completed the weather graphics.  In Conquest!, each continent has weather effects which change hourly and affect food production, the risk of a ship being damaged while sailing, and how troops fight in combat.  In the old client, a text description of the weather was sent.  For the new client, we wanted to use images to represent the 11 different types of weather.  For example, here is what freezing looks like:

This show also shows the new pop-up design, which use color images vs. wood carvings and reduces the size of the scroll area.  We are currently in the process of retrofitting some of the existing ones to use the new design, which provides additional variety and color to the 100+ pop-ups currently in Conquest!.
As part of this new design I created a Popup Manager class in Unity to handle existing and future variations.  This was a rather large undertaking, as I had spread the code for the pop-ups across all the scenes and it took a couple of days to consolidate it all to one master class.  I'm not sure if this helps any with efficiency but it reduced the overall size of the code and makes future changes much more manageable.
This project is my first real foray into true Object Oriented Programming and I'm getting a big dose of on the job training.  The code base has gotten better over time and I'm sure I'll continue to make further enhancements prior to launch.
On the server side I made some pretty drastic changes to the communication protocol used by Conquest!.  Using Message Analyzer, a free tool from Microsoft which allows you to capture all network traffic, I began looking at how much data is being sent back and forth between the client and server.  Conquest! uses an XML based protocol and so has tags such as "Message", "Body", etc.  While XML is a great protocol for humans to read and process its wordiness was unnecessary.  But rather than switch to a different protocol, such as JSON, I simply shorted all of the tags to 2 characters each and changed "YES/NO" responses to "T/F".  These two changes reduced the overall message size by approximately 20%.  I also continued my crusade to remove unnecessary messages and reduce existing ones.  Unfortunately, these changes complete break the Windows reference client but I stopped making changes to that a while ago.
In the Core Labs program we heard a lecture discussing timelines and have our first deliverable due: a production timeline for each of our games.  Fortunately I have worked on many IT projects so I have some experience to draw on.
Follow the journey on Facebook or Twitter.  Until next time, I hope to see you in the game.

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like