Frozen is an open-source HTML5 game engine delivering ease-of-use, rapid development through tooling and modularity.
Our goal is to apply techniques used in building modern webapps to game development, such as ES next, dependency management, build process, and project scaffolding.
-
Frozen (single file - global frozenjs)
Development and Production -
Frozen Source (individual modules)
Usenpm i frozenjsto add it to your project
Play examples at https://frozen-demos.netlify.com/
Examples source code can be found at https://github.com/iceddev/frozen-examples
Source available on github: https://github.com/iceddev/frozen
Our Frozen Box2d Editor is available at http://phated.github.com/frozen-editor/
While builds of Frozen may be tiny, we use some libraries and technologies behind the scenes as to not reinvent the wheel.
These technologies include:
- Node.js and npm - used for dependecy mangement for our build process and development workflow
- Hammer.js - multi-touch library used for mouse/touch/pointer event normalization and gestures
- Box2d - used for physics calculations in games
- JSDoc - generates documentation for code
npm run build to lint, test, doc, and run webpack build process to build the single file
npm run doc will lint and generate docs
npm run test to lint, run tests in PhantomJS and open your default browser at the test URL
Breaking Changes
- ES.next re-write
Breaking Changes
- Due to performance reasons,
InputManager.mousemoveonly fires duringmousedownortouchstart- see breakouts example for workaround - Added
frozen/TouchActioninstead of usingfrozen/MouseAction- used whenInputManager.emulateMouseisfalse InputManager.handleTouchandInputManager.handleMouseremoved, replaced withInputManager.emulateMousewhich determines if MouseAction or TouchAction should be used- Either
InputManager.mouseActionorInputManager.touchActionwill be active at one time (depending on state ofInputManager.emulateMouse) InputManagerevent handling methods no longer check if a point is inside canvasInputManager.keyActionsswitched from array to object (only breaking if you iterate over the collection)- Removed
Box.destroyJointbecause it was deprecated in last release - Created a
frozen/box2d/listeners/Contactmodule to contain contact listener callbacks and other logic - move custom contact handlers to this object - Remove
dojo/dom,dojo/dom-geometryanddojo/dom-stylemodules from hard dependencies to use straight DOM instead (modules will be missing from built layer) - Remove
dojo/_base/langin favor of Lo-Dash (module will be missing from built layer) - Removed
updatefunction fromfrozen/reiner/Creature- replaced withupdateDirectionandupdateAnimationsfunctions
New Features
- Add Bower support
- Add dependencies on Lo-Dash and Hammer.js
- Touch/Mouse/Pointer event normalization with Hammer.js
- Gesture support with Hammer.js
InputManager.hammeris an instance of Hammer.jsInputManager.oncan be used for binding new eventsInputManager.insideCanvascan be used to check a point against theInputManager'scanvas- New methods for adding or removing multiple bodies or joints in
frozen/BoxGame:addBodies,removeBodies,addJoints,removeJoints - New methods for flipping images in
frozen/ResourceManager:flipImage,flipImageX,flipImageY - Added
preSolveto contact listener - Added box2d sprite, gesture, ragdoll physics, and breakouts examples
Non-Breaking Changes
- Update Examples to use features of 0.3.0/0.4.0
frozen/utils/removeExtensionnow uses a regex for removing the extensions, limited to 4 characters after the.require.toUrl(filename)is now used inside theloadSoundandloadImagefunctions, instead of the plugins- Fix for WebAudio on iOS
- On mobile which requires touch, interally switch to
Audio.play()instead ofAudio.load()to avoid double loading - Use
dcl'sadvice.beforeto wire upGameCore.beforeUpdate
Deprecations
GameCore.preUpdate- Deprecated in favor of beforeUpdateInputManager.handleMouse(already removed) - Mouse is always handled, use emulateMouse to specify how to handle itInputManager.handleTouch(already removed) - Touch is always handled, use emulateMouse to specify how to handle itInputManager.mouseUp- Use the lowercase name instead - same syntax as normal event handlingInputManager.mouseDown- Use the lowercase name instead - same syntax as normal event handlingInputManager.mouseMove- Use the lowercase name instead - same syntax as normal event handlingInputManager.touchStart- Use the lowercase name instead - same syntax as normal event handlingInputManager.touchEnd- Use the lowercase name instead - same syntax as normal event handlingInputManager.touchMove- Use the lowercase name instead - same syntax as normal event handlingInputManager.keyPressed- Use keydown instead - same syntax as normal event handlingInputManager.keyDown- Use the lowercase name instead - same syntax as normal event handlingInputManager.keyReleased- Use keyup instead - same syntax as normal event handlingInputManager.getMouseLoc- Deprecated in favor of normalizePoint function (Same functionality, different name)
Breaking Changes
- Removed previously deprecated methods and properties
- Removed Node 0.6 support for the build process
frozen/sounds/Soundwas a plugin, but is now the base object of other Sounds andfrozen/sounds/AudioBasewas removedfrozen/sounds/Soundplugin was moved tofrozen/plugins/soundfrozen/box2d/Entitymoved tofrozen/box2d/entities/Entityfrozen/box2d/RectangleEntitymoved tofrozen/box2d/entities/Rectanglefrozen/box2d/CircleEntitymoved tofrozen/box2d/entities/Circlefrozen/box2d/PolygonEntitymoved tofrozen/box2d/entities/Polygonfrozen/box2d/MultiPolygonEntitymoved tofrozen/box2d/entities/MultiPolygon
New Features
- Auto-selection of Audio extension if no extension is specified
loadSoundandloadImageplugins now userequire.toUrl()to generate a path to your resources- Added
.jamignorefile Box.setAngularVelocityfunction added to set the angular velocity on an entity- Tests added for Sounds, BoxGame, and Sprite
- Added
frozen/box2d/entitieswhich returns a map of entity types - Added
frozen/box2d/jointswhich returns a map of joint types BoxGame.addBody,BoxGame.removeBody,BoxGame.addJoint,BoxGame.removeJointmethods added for convenience
Non-Breaking Changes
- Made all the examples adhere to the linting rules of the rest of the project
- Move linting declarations to .jshintrc to allow for JSHint being run in the directory standalone
- Update Grunt to
~0.4.1and add/update all the dependencies inpackage.json - Modified the Gruntfile to work with new plugins and define more tasks for convenience
- Removed Node 0.6 from tested environments
- Updated examples that were using deprecated methods
- Cleanup event handler usage on Audio implementations
- Rearranged the
specs/file structure to matchsrc/ - Implement the dcl Cleanup API for InputManager to remove event handlers on destruction
- Add declaredClass to entities and joints
Deprecations
Box.destroyJointhas been deprecated in favor ofBox.removeJoint
Full changelog available: Changelog
The MIT License (MIT)
Copyright (c) 2018 Iced Development, LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
