gamemaster

0.0.0 • Public • Published

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:

Server:

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

	@x = 0

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

Client:

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.

Readme

Keywords

none

Package Sidebar

Install

npm i gamemaster

Weekly Downloads

8

Version

0.0.0

License

MIT

Last publish

Collaborators

  • viclib