JavaScript implementation of the Entity System model as described by Adam Martin in his blog post series Entity Systems are the future of MMOs.
Using bower
:
bower install ensy
Using npm
:
npm install ensy
The documentation is available on Read the docs. All methods are well documented and parameters are described. If you are familiar with Entity Systems, it shouldn't be too hard to understand.
Here is a quick example:
require('entity-manager', function (EntityManager)) {
var manager = new EntityManager();
var Player = {
name: 'Player',
description: "The player's state",
state: {
life: 100,
strength: 18,
charisma: 3,
}
};
manager.addComponent(Player.name, Player);
var player = manager.createEntity(['Player']);
var playerData = manager.getComponentDataForEntity('Player', player);
playerData.life = 80;
}
There are examples in the examples directory:
- Concentration
- Total Madness Arena
- more to come...
Install the dependencies with npm install
.
$ npm test
To run the tests in your browser:
$ make test-browser
$ npm run build_doc