Changelog

All notable changes to this project will be documented in this file.

The format is (mostly) based on Keep a Changelog, and this project adheres to Semantic Versioning.

[unreleased]

Added

  • Added KAPLAYOpt.types, kaplayTypes() and Opt to config specific TypeScript Advanced Features (TAF) - @lajbel

    kaplay({
        types: kaplayTypes<
            // Opt<> is optional but recommended to get autocomplete
            Opt<{
                scenes: {}; // define scenes and arguments
                strictScenes: true; // you can only use defined scenes
            }>
        >(),
    });
  • Added TypesOpt.scenes to type scenes and parameters - @lajbel

    const k = kaplay({
        types: kaplayTypes<
            Opt<{
                scenes: {
                    "game": [gamemode: "normal" | "hard"];
                    "gameOver": [score: number, highScore: number];
                };
            }>
        >(),
    });
    
    // If you trigger autocomplete it shows "game" or "gameOver"
    k.scene("game", (gamemode) => {
        // gamemode is now type "normal" | "hard"
    
        // @ts-expect-error Argument of type 'string' is not assignable
        // to parameter of type 'number'.
        k.go("gameOver", "10", 10); //
    });

    The methods that support this are:

  • Added TypesOpt.strictScenes to make usable scenes just the ones defined - @lajbel

    const k = kaplay({
        types: kaplayTypes<
            Opt<{
                scenes: {
                    "game": [gamemode: "normal" | "hard"];
                    "gameOver": [score: number, highScore: number];
                };
                strictScenes: true;
            }>
        >(),
    });
    
    // @ts-expect-error Argument of type '"hi"' is not assignable to
    // parameter of type '"game" | "gameOver"'.
    k.scene("hi", () => {});
  • Added named animations - @mflerackers

    By giving a name to an animation, you can define more than one animation

    const anim = obj.animation.get("idle");
    anim.animate("pos", [0, 5, 0], { relative: true });
  • Added screenshotToBlob() to get a screenshot as a Blob - @dragoncoder047

  • Added getButtons() to get the input binding buttons definition - @lajbel

  • Added RuleSystem for enemy AI - @mflerackers

  • Added DecisionTree for enemy AI - @mflerackers

  • Added constraint components for distance, translation, rotation, scale and transform constraints - @mflerackers

  • Added skew to Mat23, transformation stack, RenderProps, GameObjRaw as well as a component - @mflerackers

Changed

[4000.0.0-alpha.21] - 2025-08-07

Added

  • Added GameObjRaw.serialize() for serializing the game object and its components. - @mflerackers, @lajbel

    const bean = add([sprite("prefab")]);
    const beanSerialized = bean.serialize();
  • Added createPrefab() for serializing an object and register it (or not) as a prefab from a Game Object. - @mflerackers, @lajbel

    const beanObj = add([sprite("bean")]);
    
    // Serialize game object and register it as a prefab asset
    createPrefab("bean", beanObj);
    
    addPrefab("bean");
    
    // Just get serialized data
    const serializedBean = createPrefab(beanObj);
    
    addPrefab(beanObj);
  • Added addPrefab() for creating an object previously serialized - @mflerackers, @lajbel

    loadPrefab("bean", "/bean.kaprefab");
    
    addPrefab("bean");
  • Added new scene methods pushScene() and popScene(), for stack behaviour in scenes - @itzKiwiSky

  • Added throwError() for throwing custom errors to the blue screen, even errors KAPLAY can’t handle. - @lajbel

  • Added insertionSort() - @dragoncoder047

  • Added a mapping for PS5 (DualSense) gamepads, so now you can bind actions to the touchpad press (only works in Chrome for some reason) - @dragoncoder047

Changed

Fixed

  • Fixed shader error messages - @dragoncoder047
  • Fixed compatibility issues when calculating font height with missing TextMetrics props - @imaginarny

[4000.0.0-alpha.20] - 2025-06-15

Added

  • Added loadSpriteFromFont() for loading a bitmap font from a loaded sprite. - @dragoncoder047

Changed

  • Improved various doc entries. - Many contributors

Fixed

Removed

  • (!) loadPedit() was removed - @lajbel

[4000.0.0-alpha.19] - 2025-05-16

This version changelog covers versions 4000.0.0-alpha.0 through 4000.0.0-alpha.19, as we didn’t have a concise changelog strategy before.

Added

Changed

Fixed

Removed

  • (!) make() was sent to doom - @lajbel

kaplay logo