npm_crafty

0.5.3-8 • Public • Published

npm_crafty

This is a nodeJS module. It runs a server version of craftyJS.

npm_crafty adds a logical overlay network on-top of crafty

  • You can create multiple rooms. Each room contains one server and multiple clients.
  • A client can send events to the server. The server can send events to all clients.
  • Define your client & server code in one place, and let the module determine which code to run.
  • Network events are automatically routed to the correct entity instance on the other end of the network.

Go multiplayer today with a minimalistic and easy-to-use net api!

Version


Current native crafty version is 0.5.3

Overview


The unmodified crafty version runs on the client (== browser). A heavily modified version runs on the server (== nodejs, drawing stuff and similar is omitted from the server version).
Both client and server version have additional features available for defining the game code on server or client, as well as enabling communication between them.
These differences between original crafty library and the modified libraries can be seen inside the diff folder.
You have to alter your game code to include these features.

In order for the communication to work between server and client(s) you also have to specify how connecting / disconnecting hosts will affect how your game sessions are setup. Each game session is an unique instance of your game; there can be multiple game sessions taking place at once and each one takes place inside a game room. A game room consists of one crafty server instance that communicates with multiple crafty client instances.
The documentation on game room setup (server and client) setup can be found inside the lib folder.
You have to setup game room(s) so that each server instance knows with which client instance to communicate.

An example can be found inside the example folder.

Misc


If you have a suggestion or bug report, open an issue. If you want to contribute, open a pull request.

License


The MIT License (MIT) (See LICENSE)

Dependencies (3)

Dev Dependencies (1)

Package Sidebar

Install

npm i npm_crafty

Weekly Downloads

0

Version

0.5.3-8

License

none

Last publish

Collaborators

  • mucaho