Basic multiplayer

Feature Development

Well that was a little faster than I thought.  Here’s a screenshot of my very, very basic multiplayer support in action:

That’s two browsers running the game side by side.  For now, your player is represented by my nifty character model, and any other players are a gray sphere.  So you can see in this screenshot that in the game on the left the sphere is where the player is in the game on the right, and vice versa.  As each moves around it’s updated in real time on all other clients.  My polling time is set at 1 second right now, so the server only sends out an update once per second and the movement is very jumpy, but there are ways to improve that, the simplest of which is to simply decrease the polling period.

Using socket.io and node this was almost disturbingly easy.  It took me a bit to get my head wrapped around the concepts, but overall this is a very simple thing to do with these tools.  I also relied pretty heavily on a series of tutorials made by the guy who made Raining Chain.  The tutorials were very helpful, and the game itself is also quite entertaining, so if you’ve never played it, go check it out.

Still many things to do, but it’s exciting to get basic multiplayer support added so quickly and easily.

Leave a Reply

Your email address will not be published. Required fields are marked *