Sponsored By

Server Code Cleanup and Player Classes

This week I focus the majority of my blog to all the enhancements made to the server using splint. Or fixing things I didn't know were broken!

James Bennett, Blogger

March 14, 2016

3 Min Read

Conquest! is a client/server application.  The client uses Unity and has been the subject of most of my blogs the past 10 months.  I would like to spend most of this post discussing the enhancements to the game server but first let's get the new stuff for the client out of the way.
The big news was completing the new pop-up images and starting on support for player classes.  In Conquest!, there are 6 playable classes: Fighter, Barbarian, Mage, Cleric, Ranger, and Vampire.  Each class has its own strengths, weaknesses, and playstyle.  Classes are an important and large area of the game and are one of the last remaining sections to complete.  The design calls for a large tome, which players will page through to view their class abilities and skills.  The graphics aren't complete yet but here are the general information and abilities pages:

The skills for each class will follow a similar pattern.  I really like this design and am excited to see it 100% complete.
The Conquest! server is written in C and was first created in 1998.  It has evolved quite a bit since version 1.0, including enhancements to the communication protocols, game features, and stability.  As part of taking Conquest! mobile I have gone back and cleaned up some poorly written code.  Part of this cleanup involves the use of a lint program, namely Splint.  I recently ran split for each of the source files in Conquest!.  While I took comfort in the fact that Splint only identified a few minor bugs it did uncover some less than optimal code.  For example, the use of snprintf instead of sprintf and strlcat instead of strncat.  Note the former required the install of the libbsd library but this is readily available.
Also new this week was the storing of chat and world event history.  When a client connects this information is sent, timestamped to the local timezone.  This allows conversations to continue in the event of a disconnect or simply the passage of time.  It also allows players to instantly see the last 20 world events without having to visit the web site.  The server saves these to a file when it exists so they are persisted between reboots.  These features enhance the user experience and help persist the Conquest! world.  All told, the code cleanups and chat storage took approximately 8 hours of development over many long nights.  Grueling, but worth it.
This week during the Core Labs Accelerator lecture we heard from Jeff Burton, one of the founders of Electronic Arts, who coached us on networking skills.  Jeff is one of those people you want to go out to dinner with to hear his stories and I hope to meet him during demo day in Silicon Valley later in the summer.
Follow the journey on Facebook or Twitter.  Until next time, I hope to see you in the game.

Read more about:

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

You May Also Like