Skip to content

Networking Blind.io

September 8, 2016

The Dancing Lobsters team and I have decided to develop Blindfolded into a networked multiplayer game. In this new iteration, players will be dropped into a random room in which they will attempt to kill all other players.

For our stack we have chosen to use Phaser for rendering on the front end , and Ruby’s Puma+Sinatra for the http server and game server on the back end.

Because the connection is on the web over a browser, my only option for socketed connection is websockets. Chrome and I imagine other browsers simply disallow raw sockets, so the usual route of unreliable connection through UDP is unavailable.

What I am realizing that there is a great deal of player and network information that must be maintained between the server and client.

The server as it stands maintain a list of rooms that it places players into. When a player connects via a socket he placed into a random room. A onDisconnect() alerts the server when the client has closed out the tab. The problem is, when I receive this notification, I do not know which player left, only which socket disconnected.

I can either assign the socket information to each player  object or I could maintain a table keyed by websockets with player values. Being able to pass a websocket id to a delete function seems desirable, but maintaining the table seems unnecessary. Networked games maintain enormous playerbases, so iterating over the entire playerbase looking for a player with a matching websocket seems dumb, and the constant lookup time of the hash table could alleviate it, but it means having more items in memory. All things to consider.

Advertisements
Leave a Comment

Leave a Reply

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

WordPress.com Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: