Happy New Year from the Kiwi team! Today we are happy to release version 1.2.0 of Kiwi.JS, “Williams”.
This version of Kiwi.JS brings powerful new ways to build and automate game architecture. With a robust Entity Component System, more time controls, faster file loading options, a new debug logging system, unified color format, and more, we reckon you’ll be able to build some seriously pro games.
“Williams” is named in honor of Roberta Williams, creator of the King’s Quest series and one of the great adventure game designers. Where would modern gaming be without Williams? We’re big fans here.
You can download 1.2.0 of Kiwi.JS on github now.
New Features
Kiwi.JS v1.2.0 has several exciting new features. Some of these are so cool that we’ll be doing entire posts on them in the near future. Upcoming articles include:
- Entity Component System
- Robust Clocks and Better Animation
- Kiwi.Log Debug System
- Color System
- Revised File Loading System
We’ve also made some smaller improvements that don’t merit their own article. We’ll explain those here.
Animation.onComplete
When an Animation
is set to a single repetition, and it successfully completes that repetition, it fires a Signal
called onComplete
. This is useful for signalling the completion of a single event. It is different from onStop
, which may fire upon completion, but will also fire if the Animation
is interrupted.
Transform Performance Upgrades
GameObjects must have a Transform
to set their position in space. Unfortunately, Transforms use matrix mathematics to do their thing, and this can be costly on low-end CPUs such as those in mobile devices.
We’ve streamlined the Transform process to make it 10-30% faster. In addition, we’ve supplied a couple of useful functions to squeeze even more power out of the Transform.
Transform.ignoreParent
By default, Transform
will get a matrix from its parent. This allows the Transform to follow a parent through any transformation, as though it were part of the parent Transform. Set ignoreParent = true
to disable this, gaining some performance back. The entity will still be able to transform, but it will not respect any parent transforms. This is useful if your entity is not part of a Group. Note that the State is also a kind of Group, so if your entity is a child of the State, and the State does not transform, ignoreParent = true
is a great way to get a little more oomph.
Transform.locked
By default, Transform
will update its matrix every frame. Set locked = true
to disable this, gaining some performance back. The entity will be locked at its current transform. It will still respect parent transforms. This is useful for objects that don’t change often.
TextField.box
TextField
now has a hitbox component. This hitbox is a clever estimate based on expected text dimensions. If you wish to add other components, such as physics or input, the presence of a Box
will make it possible.
Game domParent can use CSS Selectors
When specifying the domParent in game options, you can now use CSS Selectors as well as DOM element ids.
Kiwi.Utils.Common.isBetween
Tired of writing long conditionals to figure out whether a number is within bounds? isBetween( x, min, max )
will do the heavy lifting for you. Note that it only returns true if x is genuinely between min and max; if x = min or if x = max, it is not between them and is thus false.
Pointer.pressed, Pointer.released
Pointer (and by extension Finger and MouseCursor) now have pressed
and released
properties. These are true only on the frame directly after the pointer is pressed or released. This was previously difficult to ascertain if you were creating your own input methods.
Camera.transformPointToScreen
You could already call Camera.transformPoint
to transform a Point
into world coordinates. With transformPointToScreen
, you can go the other way. This will tell you where a Point in world space maps to the screen. This can be useful for ascertaining whether something is on screen, positioning HUD elements over game objects, etc.
Reassign Tween.object
There is now a setter that permits you to reassign Tween.object
midway through a Tween. This will immediately stop updating the current object. The new object will inherit the current value of any tweening value. Any tweening value that is not present on the new object will be removed from the Tween. This could be useful for substituting one object for another midway through a Tween, as in a transformation sequence or an entity suffering battle damage.
TextField name
What’s wrong with “Textfield”? It’s not properly camel-cased: it should read “TextField”. We’ve added the correct name as an alias. Old code will still work, but new code may be written in a more pleasing fashion.
Release Notes
v1.2.0 "Williams"
New Features
- Pro architecture tools out the wazoo
- All
Component
objects on a Group or Entity will automatically update when the State updates. This permits a full Entity Component System. (#122)
Clock
greatly improved (#143)
- Time can run at any rate, in any direction
rate
property available on clocks
- Animation, Tween, and TweenManager use new clock abilities
Animation
has a Signal
called onComplete
which fires after finishing (#143)
Kiwi.Log
added. This replaces and upgrades console.log
functionality, with recording, tagging, and selective muting. It’s a big step up for debug! (#117)
Kiwi.Utils.Color
object can record and output color values in a very wide range of formats, including RGB, RGBA, HSL, HSV, CSS color functions, and normalized or integer values. (#135)
- File system is more flexible
- Parallel loading option for lightning-fast downloads
- Load files with easy-to-use parameters
- Easily manage state-specific files
Transform
optimisations (#141)
- Improved performance
- Transform may be set
lock = true
to prevent updates and increase performance
- Transform may be set
ignoreParents = true
to save performance with objects whose parents don't update
TextField
now has a hitbox (#137)
- Game
domParent
parameter can now use CSS selectors (#131)
Kiwi.Utils.Common.between( x, a, b )
method added. It's much faster to check if something is between two numbers now. (#118)
Input.Pointers
now has pressed
and released
getters, allowing you to see if a mouse or finger was pressed or released in the last frame only. (#115)
Camera.transformPointToScreen
added, allowing you to translate world points to screen coordinates. This is the opposite of Camera.transformPoint
. (#112)
- You may now reassign
Tween.object
, transferring a Tween from one object to another. (#109)
State.loadProgress()
can now estimate bytes loaded (#66)
- Timer Helpers implemented. You can now call
Clock.setInterval
and Clock.setTimeout
, rather than mess around with three or more calls to get the same effect. These helpers run on game clocks, and will respect clock manipulation and pausing. (#44)
Bug Fixes
- XHR loading works with Nodewebkit where status codes are unavailable (#144)
Kiwi.Utils.Common.defaultToString
is now in camelCase (#140)
TileMapLayer.getOverlappingTiles
now works correctly with negative coordinates (#139)
Kiwi.Time.Clock.removeTimer
works correctly (#138)
- Audio objects now loop correctly after being paused and resumed (#132)
PluginManager
now correctly allows requirements that match or exceed requested version number, rather than those that match or precede it. (#130)
- Game prints the correct error message when no stage was specified, or an incorrect stage was specified. (#129)
- Mouse events now include button data. (#126)
AnimationManager
now calls onUpdate
after changing cellIndex
, ensuring that callbacks have more accurate data regarding cells. (#125)
StaticImage.objType()
now reports "StaticImage" instead of "Sprite" (#119)
- Spritesheet texture atlas correctly enumerates number of cells. (#116)
Timer
resumes where it left off after being paused (#113)
- File loader now correctly interprets files without extensions in CocoonJS (#106)
Deprecations and Removals
Textfield
is deprecated in favour of TextField
alias (#134)
Kiwi.Utils.Common.defaultToString
is now in camelCase (#140)
Project Architecture
- Switched to Typescript 1.4. Run
npm update
to upgrade your packages.
More details can be found on the Kiwi.JS repo under the 1.2.0 milestone
Recent Comments