node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org ยป


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.


npm install gamemaster



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.