@next version

KAPLAY v4000

npx create-kaplay myGame -v next
or
npm i kaplayjs@next

The next version of KAPLAY.js library is v4000. Learn about new features and notable changes compared to the previous v3001.

Hottest Features

Prefabs & Serialization

Create prefabricated objects with built-in serialization, ready to be reused or saved & loaded as-is

Picture API

Draw a picture composed of any primitives or sprites optimally by skipping the repeated drawing pipeline and render to framebuffer

Circle & Ellipse Collision Shapes

Circular colliders were previously not possible in the v3001. Now you can use a new Circle() or Ellipse() as area shapes

Fake Mouse

Create a custom cursor with ability to control it even without a mouse! More accessibility for cursor-based games

Video

Render a video right to the canvas easily using the built-in video() component

Object Parent Changing

setParent()

Improved TypeScript & Intellisense

Full ECS under the hood

Many more features coming soon!

You can look forward to stuff like Assets unloading, reworked Hover & similar events like gestures, UI components, and much more!

Notable Changes

Compared to v3001

Performance Improvements

With underlying systems updated comes the greatly improved performance, most notably in objects/area-heavy games

Global Z-index Sorting

Objects using z() are now sorted globally, meaning any child can be drawn above any parent siblings, or any object (within the same layer)

GJK as default collision algo replacing SAT

GJK is faster and more versatile algorithm allowing any shape unlike SAT. Can be reverted with narrowPhaseCollisionAlgorithm option

make() removed / replaced with Prefabs

Make was a friend, but a rebel too that had to be removed. Nothing what a simple factory function wouldn't solve or more robust prefabs

Tags separated from Components

Component IDs are no longer tags. But, instead of obj.is("sprite") you can use obj.has("sprite"). Can be reverted with tagComponentIds option

API Changes & Improvements

There were many changes to the API, mainly as a quality of life improvements or little options and features added here and there, that didn't make it back to the v3001

FAQ

Frequently Asked Questions

TL;DR

Should I try v4000?

Absolutely.

Why are there two versions?

v3001 also serves as a drop-in replacement and continuation on KABOOM library with many fixes and improvements. Although, some more in-depth changes and improvements would break this compatibility, thus v4000 was created naturally and is the future of KAPLAY with a room for much bigger improvements and features.

Should I switch early?

Currently, there aren't many compatibility issues. The sooner you switch the better, as it will only stray more and more with time. We are working on making it stable with some work in progress API finalized.

Why alpha? Is it stable?

Only because the API could change, which is always mentioned and documented in the changelog of each released version. Stability, more in the terms of bug count, is on a par with v3001. More people use v4000, the more bug-free it becomes. In the terms of performance, v4001 is already more optimized and performant.

Should I migrate (almost) finished game?

If you are not having any issues or are satisfied with the features of v3001, there might not be many gains if you do so. But, if you plan on updating the game later on, you might realize that some features from v4000 would be handy.