Excalibur.js Documentation

website·Indexed 33 days ago

https://excaliburjs.com/docs/

A 2D game engine featuring an Entity Component System (ECS) architecture. Documentation covers core concepts including Colliders, Graphics, Actions, and Custom Components, as well as implementation details for collision groups, action queues, and async flow.

Tokens
332.9K
Snippets
2.1K
Records
3.2K
Agent score
67%

What's inside Excalibur.js

  1. Overview of the Excalibur 2D Game Engine

    Excalibur is a free, open-source 2D game engine written in TypeScript designed for creating web-based games. It aims to reduce boilerplate code and handle cross-platform targeting, providing a "batteries included" experience with sensible defaults to allow developers to focus on game design and building.
  2. Overview of the Collider class

    The Collider class specifies the geometry used to detect when two objects in Excalibur intersect. It serves as the base class for specific collider shapes including CircleCollider, EdgeCollider, PolygonCollider, and CompositeCollider. It implements the Clonable interface.
  3. Overview of the LightingSystem

    The LightingSystem is a composite canvas-driven visibility system that tracks ambient light, darkness, light masks, and ray-projected shadow volumes. It renders via a ScreenElement named 'lighting'.

    The raster pipeline per frame follows this sequence: ambient-blended darkness veil → room rect fills/clips → camera frustum cull → per-light destination-out punch (with occluder shadows subtracted) → colored tint passes.

    Performance Note: The overlay is rasterized using the 2D Canvas API and re-uploaded to the GPU every frame, which can impact performance.

    Known Limitations:

    • Circle occluder radii scale uniformly using Math.min(scale.x, scale.y); non-uniformly scaled occluders will not cast elliptical shadows.
    • Darkness room rectangles do not have independent rotation (they only rotate with the camera).
    • Polygon shadow volumes may split at corners if the silhouette edge is not face-on to the light.
  4. Overview of IsometricMap

    The IsometricMap is a specialized tile map in Excalibur that provides isometric rendering support. When configuring the map, tileWidth and tileHeight should represent the height and width in pixels of the parallelogram base of the tile art asset, which may differ from the actual graphic pixel dimensions.
  5. Overview of built-in Excalibur Actions

    Excalibur provides several pre-defined Action categories to modify Actor behavior and appearance:

    • Movement Actions: Modify velocity and position over time. Includes MoveBy, MoveTo, RotateTo, RotateBy, Meet, Follow, CurveBy, and CurveTo.
    • Cosmetic Actions: Change the visual appearance of an Actor. Includes Blink, Flash, Fade, and Scale.
    • Utility Actions: General purpose helpers including Delay, CallMethod, and Die.

    Caveat: Most actions end automatically upon completion. However, Follow is designed to never end automatically and must be stopped deliberately. Meet only ends when it intersects the target, meaning it may also run indefinitely if the target is never reached.

  6. Overview of the Dual Tilemap Autotiling Technique

    The Dual Tilemap technique solves common 2D autotiling problems like excessive art requirements and 'ambiguous tiles' (where a tile visually represents two different terrains). It separates the world into two distinct layers:

    1. World Tilemap (Logic): Manages game logic and states (e.g., soil vs grass). It uses a single background tile.
    2. Graphics/Mesh Tilemap (Overlay): An offset overlay that uses only 5 specific tiles (Edge, InnerCorner, OuterCorner, Filled, and Opposite Corners). These tiles are rotated and stacked to create all necessary visual transitions.

    This approach reduces the total asset count to 6 tiles (1 background + 5 overlay tiles) and ensures that walkable areas align perfectly with the logic map.

  7. Overview of ActionQueue in Excalibur.js

    The ActionQueue class represents an ordered sequence of actions for an Actor. It is part of the Action API and is used to store and manage the list of actions to be executed. Actors implement Actor.actions, which allows advanced users to manipulate the queue to adjust currently executing actions.
  8. Overview of SparseHashGridCollisionProcessor

    The SparseHashGridCollisionProcessor is a collision processor that uses a sparsely populated grid of uniform cells to bucket potential colliders. This spatial partitioning is used to efficiently detect collision pairs and collisions by limiting the number of checks to nearby objects.
  9. Overview of the ScreenElement class

    The ScreenElement class is a helper Actor primitive specifically optimized for drawing user interfaces (UIs). It is designed to be drawn on top of all other actors and does not participate in collisions, making it ideal for HUDs, menus, and other UI overlays.
  10. Overview of GraphicsComponent

    The GraphicsComponent is used to manage drawings for an entity in Excalibur.js. It is typically used in conjunction with a position component to determine where graphics are rendered in the game world.