-
Notifications
You must be signed in to change notification settings - Fork 1
Modules
A way for game developers to share components and other common game logic. It should be very easy to use a component. I am seeking to make this workflow possible:
- browse crafty-modules.com where description and samples are available of all components.
- Specify component name/version. something like Crafty.modules({ CoolComponent:1.4 })
- Use the component in the game as if it was defined locally: Crafty.e("CoolComponent")
We could use scriptjs to load the components http://dustindiaz.com/scriptjs
Thoughts:
- It should be possible to load components at arbitrary points in time so stuff that is only needed in late levels don't delay start of the game.
- callback or event when a component is ready
- maybe this could be integrated into the existing Crafty.load() that handles images and sound. This could be done in a later release.
- for performance we could make it possible to bundle a bunch of modules in one file or even combine it into the game source.
The other part of the equation - submitting modules could be modeled after the new jquery plugin site http://blog.jquery.com/2011/12/08/what-is-happening-to-the-jquery-plugins-site/
Modules live in their own repository on github where the creator enables a commit-hook pointing to crafty-modules.com. In the root of the repository is a package.json file with information about name, version, description etc. to be displayed on the modules website. Whenever the version changes we grab the code, minifies and publish to s3 under a naming system that the crafty script loader understands.
Fairly simple, right :-)
If version 1.8, 1.9 and 2.1 exists these files are created:
- cdn.crafty-modules.com/modulename-1.8.js - 1.8
- cdn.crafty-modules.com/modulename-1.9.js - 1.9
- cdn.crafty-modules.com/modulename-2.1.js - 2.1
- cdn.crafty-modules.com/modulename-1.x.js - 1.9
- cdn.crafty-modules.com/modulename-2.x.js - 2.1
- cdn.crafty-modules.com/modulename-DEV.js - Latest checkin (even if version wasn't updated)
- cdn.crafty-modules.com/modulename-DEBUG.js - As DEV, but not minified
- cdn.crafty-modules.com/modulename-RELEASE.js - Latest checkin where version changed (2.1)
{
"name": "MoveTo",
"version": "1.0",
"title": "Move entity towards mouse",
"author": {
"name": "Søren Bramer Schmidt",
"url": "https://github.com/sorenbs"
},
"licenses": [
{
"type": "MIT",
"url": "MIT-LICENSE.txt"
}
],
"dependencies": {
"Mouse": ">0",
"Crafty": ">0.4"
},
"description": "The mouse equivalent of Fourway. Click and the entity will move toward the point. NewDirection event will be triggered",
"keywords": [
"mouse",
"move"
],
"homepage": "https://github.com/sorenbs/MoveTo",
"files": [
"moveto.js"
]
}