Node module that adds networking capabilities to Crafty, a JavaScript game engine.
JavaScript HTML
Switch branches/tags
Nothing to show
Latest commit 26012b5 Nov 22, 2015 @mucaho Update README.md
Permalink
Failed to load latest commit information.
example
lib
.gitignore
LICENSE
README.md
package.json

README.md

NPM

npm_crafty

This is a node module. It adds networking capabilities to Crafty, a JavaScript game engine.

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.7.0

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.
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 game room setup (server and client) 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.

Documentation

See the npm_crafty io page.

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)