networking lib to keep a game world synchronized between server-clients

npm install gamemaster
2 downloads in the last week
4 downloads in the last month

This lib allows you to share a game-world between a server and several clients without having to worry about manually messing with sockets. Just tell the system which objects each client can see and the system will automatically keep care of keeping them synchronized using the least bandwidth possible.

Install: -

npm install gamemaster

Usage: -


players = gamemaster.init 7171 ->
    @commands =
        move_left: ~> @x += 1 

    @x = 0

    for player in players @, ["x"]
        @watch player, ["x"]


world = gamemaster.connect window.location.origin
setInterval (-> world.send "move_left"), 500

And that's it! On the server side, "players" is an array containing all players connected to the game. On the client slide, "world" is an object containing all objects that the client can see. You can make a player watch any JavaScript object.

npm loves you