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 frozenjs
to 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.mousemove
only fires duringmousedown
ortouchstart
- see breakouts example for workaround - Added
frozen/TouchAction
instead of usingfrozen/MouseAction
- used whenInputManager.emulateMouse
isfalse
InputManager.handleTouch
andInputManager.handleMouse
removed, replaced withInputManager.emulateMouse
which determines if MouseAction or TouchAction should be used- Either
InputManager.mouseAction
orInputManager.touchAction
will be active at one time (depending on state ofInputManager.emulateMouse
) InputManager
event handling methods no longer check if a point is inside canvasInputManager.keyActions
switched from array to object (only breaking if you iterate over the collection)- Removed
Box.destroyJoint
because it was deprecated in last release - Created a
frozen/box2d/listeners/Contact
module to contain contact listener callbacks and other logic - move custom contact handlers to this object - Remove
dojo/dom
,dojo/dom-geometry
anddojo/dom-style
modules from hard dependencies to use straight DOM instead (modules will be missing from built layer) - Remove
dojo/_base/lang
in favor of Lo-Dash (module will be missing from built layer) - Removed
update
function fromfrozen/reiner/Creature
- replaced withupdateDirection
andupdateAnimations
functions
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.hammer
is an instance of Hammer.jsInputManager.on
can be used for binding new eventsInputManager.insideCanvas
can 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
preSolve
to 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/removeExtension
now uses a regex for removing the extensions, limited to 4 characters after the.
require.toUrl(filename)
is now used inside theloadSound
andloadImage
functions, 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.before
to 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/Sound
was a plugin, but is now the base object of other Sounds andfrozen/sounds/AudioBase
was removedfrozen/sounds/Sound
plugin was moved tofrozen/plugins/sound
frozen/box2d/Entity
moved tofrozen/box2d/entities/Entity
frozen/box2d/RectangleEntity
moved tofrozen/box2d/entities/Rectangle
frozen/box2d/CircleEntity
moved tofrozen/box2d/entities/Circle
frozen/box2d/PolygonEntity
moved tofrozen/box2d/entities/Polygon
frozen/box2d/MultiPolygonEntity
moved tofrozen/box2d/entities/MultiPolygon
New Features
- Auto-selection of Audio extension if no extension is specified
loadSound
andloadImage
plugins now userequire.toUrl()
to generate a path to your resources- Added
.jamignore
file Box.setAngularVelocity
function added to set the angular velocity on an entity- Tests added for Sounds, BoxGame, and Sprite
- Added
frozen/box2d/entities
which returns a map of entity types - Added
frozen/box2d/joints
which returns a map of joint types BoxGame.addBody
,BoxGame.removeBody
,BoxGame.addJoint
,BoxGame.removeJoint
methods 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.1
and 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.destroyJoint
has 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.