{"_id":"entity","_rev":"5-3ffa7d0a47a6ff546dd401bbf737c719","name":"entity","description":"Javascript Game Engine","dist-tags":{"latest":"0.0.0"},"versions":{"0.0.0":{"name":"entity","version":"0.0.0","description":"Javascript Game Engine","homepage":"https://github.com/bendangelo/entityjs","author":{"name":"Ben D'Angelo","email":"ben.dangelo2@gmail.com","url":"http://bendangelo.me"},"main":"entity.js","scripts":{"test":"grunt test"},"repository":{"type":"git","url":"git://github.com/bendangelo/rift.git"},"keywords":["game","engine"],"license":"MIT","readmeFilename":"README.md","gitHead":"7b4361d420c788ae4d1ef2a5c29099db0b16cac4","devDependencies":{"grunt":"~0.4.1"},"readme":"# EntityJS\nAn HTML5 javascript game engine utlizing the entity-component design. Write highly flexible code in a powerful javascript framework.\n\n[EntityJS Website](http://entityjs.com) | [Demos](http://entityjs.com/demos) | [Tutorials](http://entityjs.com/tutorials) | [API](http://entityjs.com/api)\n\n## Version 0.5.0\n\nSystems and groups have been added. Groups are used to contain similar entities and can be used for searches or in systems. Systems should contain all the logic of a game, like updates, drawing and input. Components should only add attributes to an entity while systems will run everything together using groups.\n\nSee the examples folder for help.\n\n## API\nCurrently the [API](http://entityjs.com/api) is out of date. It will slowly be updated everyday.\n\n## What makes this different from other javascript game engines?\nEntity strives to be the most flexible game engine available. We understand no one likes rewritting the same functions and lines of code over and over. So we have developed a solution to this problem and that is the component-entity design. The traditional approach to game engine design is creating a hierarchy of classes. This is infact the **most** tightly coupled design. This creates close coupled classes whos functionality is strictly typed to one class, its not easily portable to other projects, good luck copying that one needed function and as game development progresses classes get bigger and more complex. You will eventually end up with *god-classes* who control most of the game logic.\n\nThis becomes a big mess.\n\nIn the world of *entity-component* designs. All logic is implemented in a *component*, as big or small as you want. You can then create an *entity* and add/remove components to it. The entity is a live represantation of all its components. With this low coupling of components and entities you can mix and match components together to create powerful functionality yet still portable and robust.\n\n## Requirements\n\nYou must have at least [Ruby 1.8.1+](http://rubyinstaller.org/).\n\n## Installion\n\nEntityJS is now an easy to install gem. In the terminal type in:\n\n`gem install entityjs`\n\nThis will install the latest version of the gem and now you can easily create some games!\n\n\n## Usage\n\nWhen using these commands make sure you are always in the root directory of your game.\n\n### Creating a New Game\n\nCreating a game is simple, move to any directory and type in:\n\n`entityjs new mygame`\n\nThis will create a new game using the default template.\n\nCreate a game with a platform template:\n\n`entityjs new mygame platform`\n\nSee all available templates:\n\n`entityjs templates`\n\n### Creating a Component\n\n`entityjs comp rock`\n\nThis will create a new component called *rock* at scripts/rock.js and will create a test file.\n\n`entityjs comp display/hero`\n\nThis will create a hero component in the directory scripts/display.\n\n### Creating a Test\n\n`entityjs test name test1 test1`\n\nCreate a test in /tests/name_test.js with two test methods.\n\n### Build Game\n\n`entityjs build`\n\nThis will minify all entityjs src code and game src code into one file inside /builds\n\n### Running the Game / Tests\n\nMake sure the server is running:\n`entityjs server`\n\nTo play visit:\n`localhost:2345`\n\nTo run tests visit:\n`localhost:2345/test`\n\nAssets are located here:\n`localhost:2345/assets/*name`\n\nView [all commands](/bendangelo/EntityJS/wiki/commands)\n\n## Directory Structure\n\n* Assets - Contains all external assets\n  * Images - Add any images here and retrieve them with `re.assets.images`\n  * Sounds - Add any sounds and retrieve them with `re.assets.sounds`\n\n* Build - Contains built game\n\n* Scripts - Contains all js, coffee sources. Xml, tmx and json files will be converted into js.\n  * Plugins - Contains minified scripts for plugin play.\n\n* Tests - Contains test files to run in [QUnit](http://docs.jquery.com/QUnit)\n\n* Styles - Contains all css to be included. Will support sass and others later on.\n\n* game.json - Optional, configurate scripts order, ignore certain files, etc\n\n### Short getters and setters\n\n    var tile = re.e('tile');\n    tile.tileX(1); //sets\n    tile.tileX(); //gets\n\n#### Setters can even be used in `set()`\n\n    tile.set('tileX', 2); //sets\n  \n#### Setter with multiple parameters\n\n    tile.tile(1, 2); //sets tilex and tiley\n    //or\n    tile.set('tile', [1,2]); //samething\n  \n### Factories in 0.4.2\n\nAll components now have a factory method which can be used to create complex entities.\n\n    re.c(\"button\")\n    .factory(function(label, click){\n      this.label = label;\n\n      if(click){\n        this.on('click', click);\n      }\n    });\n\n    re.button(\"Hello\", function(){\n      alert(this.label+\" clicked!\");\n    });\n\n    //Can be overwritten using the `method` function. A singleton is created below.\n    \n    re.c(\"player\")\n    .method(function(){\n      if(!this.instance){\n        this.instance = re.e('player');\n      }\n      return this.instance;\n    });\n\n    //get player\n    re.player();\n\n## QUnit Testing\n\nAll games use [QUnit](http://docs.jquery.com/QUnit) for testing, its light weight and easy to use. Checkout the platform template to see some example tests.\n\n### Factories\n\nFactories are used to easily create complex entities. During tests you may need access to a specific type of entity multiple times. Factories make it easy to create any kind of entity at anytime.\n\nSimply create a new `factories.js` in the `/tests` directory and add something like below.\n    \n    factory('enemy', function(){\n      //make a custom coin\n      this.health = 100;\n      this.state = 'idle';\n      \n      //can use normal entity methods\n      this.on('update', function(){\n        //something\n      });\n    });\n    \n    //create new enemy entity anywhere in tests\n    var e = factory('enemy');\n    eq(e.state, 'idle') //true\n    \n    //Same as...\n    var e = re.e('enemy');\n    e.health = 100;\n    //etc...\n    \nWhat if you need multiple enemy factories?\n\n    //use f for laziness\n    f('enemy attacking', function(){\n      this.state = 'attacking';\n    });\n    \n### EntityJS Helpers\n\nSome asserts have been added for checking entities, like `expectTrigger`, `expectFlicker` and `expectListener`. For more info check `localhost:2345/qunit/qunit.entity.js`.\n\n### Input Helpers\n\nSpecial methods like `keypress()` and `click()` are available to simulate user input. Check `localhost:2345/qunit/qunit.input.js` for more information.  \n\n## Tile Map Editor\n\nThe awesome [tiled map editor](http://www.mapeditor.org/) is now compatible and can be used in your projects. \n\nSimply create a new directory in /assets named levels or anything you like to save your maps in. They can accessed in code like so:\n\n    re('level1.tmx')[0]; //assuming the file name is level1.tmx\n    re('level'); //find all levels that are in the /assets/levels directory\n\nIf you are still confused create a new platform game and view levels are used.\n\n## Quick Start Guide\nFirst you should install [ruby](http://rubyinstaller.org/) and the [entityjs gem](http://rubygems.org/gems/entityjs). \n\nNow you can create a new game from the platform template:\n`entityjs new mygame platform`\n\nMove into the `mygame` directory and play the game:\n`entityjs server`\n\nOpen your browser and navigate to `localhost:2345`\n\n## Contributing\n\nBefore sending a pull request it would be a good idea to run `rspec` and `rake jasmine` to make sure all tests pass in both ruby and javascript.\n\nRunning rspec will generate a /mygame/ folder with test files. It will be ignored by git so don't worry about it.\n\n## Change Log\n\n### 0.6.0 - Upcoming\n* Move to a Nodejs package\n* Setup Dox to auto-generate documentation\n* Setup grunt to deal with tasks\n\n### 0.5.0\n* Added new group class\n* Added new system class\n* Removed global entity searching (use groups)","_id":"entity@0.0.0","dist":{"shasum":"f96af537c99e6a877dd9e32af6b88344b7cccaf9","tarball":"https://registry.npmjs.org/entity/-/entity-0.0.0.tgz","integrity":"sha512-SW6SvRmIxENsvNk5TzjeJDaMsfjQKwdND4Q0afWOUbEeRSwCGyEADpCcUbBdDdaWY3u9b0VGI9Xy1rFRKemctw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDsQvPeMisj/djNQ6n3bZ+cJjXlxbk/rx6DQ5Oe7d3SXgIgG9ImyEE8vpkRxzFYwoFRc95qt0abCEjuou6+rPGDz7U="}]},"_from":".","_npmVersion":"1.2.15","_npmUser":{"name":"bendangelo","email":"ben.dangelo2@gmail.com"},"maintainers":[{"name":"bendangelo","email":"ben.dangelo2@gmail.com"}]}},"readme":"# EntityJS\nAn HTML5 javascript game engine utlizing the entity-component design. Write highly flexible code in a powerful javascript framework.\n\n[EntityJS Website](http://entityjs.com) | [Demos](http://entityjs.com/demos) | [Tutorials](http://entityjs.com/tutorials) | [API](http://entityjs.com/api)\n\n## Version 0.5.0\n\nSystems and groups have been added. Groups are used to contain similar entities and can be used for searches or in systems. Systems should contain all the logic of a game, like updates, drawing and input. Components should only add attributes to an entity while systems will run everything together using groups.\n\nSee the examples folder for help.\n\n## API\nCurrently the [API](http://entityjs.com/api) is out of date. It will slowly be updated everyday.\n\n## What makes this different from other javascript game engines?\nEntity strives to be the most flexible game engine available. We understand no one likes rewritting the same functions and lines of code over and over. So we have developed a solution to this problem and that is the component-entity design. The traditional approach to game engine design is creating a hierarchy of classes. This is infact the **most** tightly coupled design. This creates close coupled classes whos functionality is strictly typed to one class, its not easily portable to other projects, good luck copying that one needed function and as game development progresses classes get bigger and more complex. You will eventually end up with *god-classes* who control most of the game logic.\n\nThis becomes a big mess.\n\nIn the world of *entity-component* designs. All logic is implemented in a *component*, as big or small as you want. You can then create an *entity* and add/remove components to it. The entity is a live represantation of all its components. With this low coupling of components and entities you can mix and match components together to create powerful functionality yet still portable and robust.\n\n## Requirements\n\nYou must have at least [Ruby 1.8.1+](http://rubyinstaller.org/).\n\n## Installion\n\nEntityJS is now an easy to install gem. In the terminal type in:\n\n`gem install entityjs`\n\nThis will install the latest version of the gem and now you can easily create some games!\n\n\n## Usage\n\nWhen using these commands make sure you are always in the root directory of your game.\n\n### Creating a New Game\n\nCreating a game is simple, move to any directory and type in:\n\n`entityjs new mygame`\n\nThis will create a new game using the default template.\n\nCreate a game with a platform template:\n\n`entityjs new mygame platform`\n\nSee all available templates:\n\n`entityjs templates`\n\n### Creating a Component\n\n`entityjs comp rock`\n\nThis will create a new component called *rock* at scripts/rock.js and will create a test file.\n\n`entityjs comp display/hero`\n\nThis will create a hero component in the directory scripts/display.\n\n### Creating a Test\n\n`entityjs test name test1 test1`\n\nCreate a test in /tests/name_test.js with two test methods.\n\n### Build Game\n\n`entityjs build`\n\nThis will minify all entityjs src code and game src code into one file inside /builds\n\n### Running the Game / Tests\n\nMake sure the server is running:\n`entityjs server`\n\nTo play visit:\n`localhost:2345`\n\nTo run tests visit:\n`localhost:2345/test`\n\nAssets are located here:\n`localhost:2345/assets/*name`\n\nView [all commands](/bendangelo/EntityJS/wiki/commands)\n\n## Directory Structure\n\n* Assets - Contains all external assets\n  * Images - Add any images here and retrieve them with `re.assets.images`\n  * Sounds - Add any sounds and retrieve them with `re.assets.sounds`\n\n* Build - Contains built game\n\n* Scripts - Contains all js, coffee sources. Xml, tmx and json files will be converted into js.\n  * Plugins - Contains minified scripts for plugin play.\n\n* Tests - Contains test files to run in [QUnit](http://docs.jquery.com/QUnit)\n\n* Styles - Contains all css to be included. Will support sass and others later on.\n\n* game.json - Optional, configurate scripts order, ignore certain files, etc\n\n### Short getters and setters\n\n    var tile = re.e('tile');\n    tile.tileX(1); //sets\n    tile.tileX(); //gets\n\n#### Setters can even be used in `set()`\n\n    tile.set('tileX', 2); //sets\n  \n#### Setter with multiple parameters\n\n    tile.tile(1, 2); //sets tilex and tiley\n    //or\n    tile.set('tile', [1,2]); //samething\n  \n### Factories in 0.4.2\n\nAll components now have a factory method which can be used to create complex entities.\n\n    re.c(\"button\")\n    .factory(function(label, click){\n      this.label = label;\n\n      if(click){\n        this.on('click', click);\n      }\n    });\n\n    re.button(\"Hello\", function(){\n      alert(this.label+\" clicked!\");\n    });\n\n    //Can be overwritten using the `method` function. A singleton is created below.\n    \n    re.c(\"player\")\n    .method(function(){\n      if(!this.instance){\n        this.instance = re.e('player');\n      }\n      return this.instance;\n    });\n\n    //get player\n    re.player();\n\n## QUnit Testing\n\nAll games use [QUnit](http://docs.jquery.com/QUnit) for testing, its light weight and easy to use. Checkout the platform template to see some example tests.\n\n### Factories\n\nFactories are used to easily create complex entities. During tests you may need access to a specific type of entity multiple times. Factories make it easy to create any kind of entity at anytime.\n\nSimply create a new `factories.js` in the `/tests` directory and add something like below.\n    \n    factory('enemy', function(){\n      //make a custom coin\n      this.health = 100;\n      this.state = 'idle';\n      \n      //can use normal entity methods\n      this.on('update', function(){\n        //something\n      });\n    });\n    \n    //create new enemy entity anywhere in tests\n    var e = factory('enemy');\n    eq(e.state, 'idle') //true\n    \n    //Same as...\n    var e = re.e('enemy');\n    e.health = 100;\n    //etc...\n    \nWhat if you need multiple enemy factories?\n\n    //use f for laziness\n    f('enemy attacking', function(){\n      this.state = 'attacking';\n    });\n    \n### EntityJS Helpers\n\nSome asserts have been added for checking entities, like `expectTrigger`, `expectFlicker` and `expectListener`. For more info check `localhost:2345/qunit/qunit.entity.js`.\n\n### Input Helpers\n\nSpecial methods like `keypress()` and `click()` are available to simulate user input. Check `localhost:2345/qunit/qunit.input.js` for more information.  \n\n## Tile Map Editor\n\nThe awesome [tiled map editor](http://www.mapeditor.org/) is now compatible and can be used in your projects. \n\nSimply create a new directory in /assets named levels or anything you like to save your maps in. They can accessed in code like so:\n\n    re('level1.tmx')[0]; //assuming the file name is level1.tmx\n    re('level'); //find all levels that are in the /assets/levels directory\n\nIf you are still confused create a new platform game and view levels are used.\n\n## Quick Start Guide\nFirst you should install [ruby](http://rubyinstaller.org/) and the [entityjs gem](http://rubygems.org/gems/entityjs). \n\nNow you can create a new game from the platform template:\n`entityjs new mygame platform`\n\nMove into the `mygame` directory and play the game:\n`entityjs server`\n\nOpen your browser and navigate to `localhost:2345`\n\n## Contributing\n\nBefore sending a pull request it would be a good idea to run `rspec` and `rake jasmine` to make sure all tests pass in both ruby and javascript.\n\nRunning rspec will generate a /mygame/ folder with test files. It will be ignored by git so don't worry about it.\n\n## Change Log\n\n### 0.6.0 - Upcoming\n* Move to a Nodejs package\n* Setup Dox to auto-generate documentation\n* Setup grunt to deal with tasks\n\n### 0.5.0\n* Added new group class\n* Added new system class\n* Removed global entity searching (use groups)","maintainers":[{"name":"bendangelo","email":"ben.dangelo2@gmail.com"}],"time":{"modified":"2022-06-17T06:10:19.451Z","created":"2013-04-04T22:57:52.140Z","0.0.0":"2013-04-04T22:57:54.484Z"},"author":{"name":"Ben D'Angelo","email":"ben.dangelo2@gmail.com","url":"http://bendangelo.me"},"repository":{"type":"git","url":"git://github.com/bendangelo/rift.git"}}