Designing a network game

With the recent classes on networking, I have been thinking of creating a simple network game to help pass the course. This project will help me tick off a few LO’s (learning outcomes) that are required for me to complete to pass the course, these LO’s will be:

  • Design a networked game or application
  • Implement a networked game or application
  • Implement a player profile system ina networked game

To begin, I decided what kind of game would be best, a game that isn’t too big on complexity, something I can focus my development time mostly on the networking, and it hit me, a pool game. Pool games are abundant, and networked pool games are just as large in quantity, so it won’t be something new that I’ll be creating, just something I can use to help pass my course.

Now that I had the game idea down (exceptionally simple), I needed to decide on what I’ll use to create it, the requirements for this project. There will be 4 main things needed for a client: access to the server, game logic, physics, and rendering. The access to the server will be handled by WinSock2, and the player inputting the IP address of the server, the player who wishes to be the server will need to open a server program I will create. Game logic will just be the positioning of the pool cue and the amount of power going into the shot, which will be sent to the server for physics calculation, the position of all of the balls will be sent back to show the player. Physics will be handled using Box2D, an API I have had brief exposure to, and rendering will be handed by SFML, a 2D game framework.

The game will have player profiles stored within the server, something that the player will need to sign in for. The player will first type in the IP address of the server, type in their username and password, and then press connect. If the username already exists in the data on the server, then it will check if the password works, if the password is invalid or username doesn’t exist, it will return a message saying that there was an error, else it will return a message saying it worked. When an error is sent back, the server will deal with it as telling the player there was an error, offering the player to create a new profile due to it possibly existing on another machine.


Network Protocol:




Username : 8 characters maximum (8 chars long = 8 bytes [1 char = 1 byte])

Password : 8 characters maximum (8 chars long = 8 bytes [1 char = 1 byte])

Client action:

Angle of aim : 2 bytes

Distance pulled back : 15 bits

Shot : 1 bit


Connection attempt:

Connection type : 1 byte (error code)

Pool ball update:

Ball flags : 16 bits (each bit represents whether a ball has been sunk)

BallData (4 bytes per ball) * 16 (all balls) = 64 bytes [at most]

X position : 2 bytes

Y position : 2 bytes



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s