Easel Programming Language

website·Indexed 33 days ago

https://easel.games

A reactive, asynchronous, and event-driven programming language designed for game development. Easel features built-in support for multiplayer, a physics engine, and a UI system. The documentation covers core concepts like entities and behaviors, language control flow, and technical references for graphics, cameras, and input handling.

Tokens
154.8K
Snippets
979
Records
1.3K
Agent score
64%

What's inside Easel

  1. Overview of Easel Subblocks

    Subblocks allow a function to be called with a block of code as a parameter. This creates a hierarchical structure that reduces indirection and allows game logic to match the game's structural relationships. A common example is the Spawn function, where the subblock defines the main behavior of the spawned entity.
    Spawn {
        // This subblock defines the behavior of the spawned entity
    }
  2. Overview of Functions in Easel

    In Easel, a function is a reusable block of code that serves as a basic building block of programs. Functions allow developers to encapsulate logic that can be called from multiple different parts of a program to avoid duplication and improve organization.
  3. Overview of legacy Buffs in Easel

    A buff is a property of an entity whose value is derived from a set of contributed values from multiple sender entities. Buffs are typically used for temporary effects like speed boosts or damage reduction. When a sender entity despawns, its contribution is automatically removed. The final value is calculated via a meld function, cached, and recalculated only when contributions change.

    Note: Buffs are obsolete and have been superseded by Collectors. Use Collectors for all new code.

  4. Overview of the Easel Game Engine

    Easel is a high-level programming language, game engine, and online platform designed specifically for 2D browser games. It is built to be beginner-friendly and removes the complexity of networking by making games multiplayer automatically. The language is designed to match human logic through a hierarchical, reactive, and asynchronous programming style.
  5. Overview of Galleries in Easel

    A gallery is a UI construct where one entity owns the gallery and other entities provide content to be displayed within it. This decouples the 'what' (content logic) from the 'where' (UI structure), allowing entities to manage their own UI representation without the main UI entity needing to iterate over every single item or player.
  6. Lock a game to prevent new players from joining

    Easel games start in an 'unlocked' mode where players can freely join and leave. To prevent new players from joining (e.g., when a match is about to start), use the LockGame function.

    Key behaviors:

    • LockGame applies immediately; any players attempting to join after this call will be reassigned to a different game.
    • Calling CommenceGame automatically locks the game if it hasn't been locked already.
    • Calling ConcludeGame also locks the game, preventing players from joining a finished session.
  7. Manage loop execution with break and continue

    You can modify the execution flow of loops using these statements:

    • break: Exits the loop immediately.
    • continue: Skips the remainder of the current iteration and proceeds to the next iteration.
  8. Understand the World entity

    The World entity represents the global game world and exists for the entire duration of the program. It is used to store properties or own objects that must persist throughout the application's lifecycle.
    pub prop this.NightTime
    pub fn Example() {
        World.NightTime = true // assign a property to the World
    }
  9. Manage game state with incremental snapshotting

    Easel supports the snapshotting and restoration of execution states for thousands of concurrent behaviors. Unlike many implementations, Easel can snapshot code mid-execution, allowing it to restore the exact state of coroutines during a rollback.
  10. Configure screen-space offsets

    Use screenOffset to shift a shape along the horizontal and vertical axes of the screen. Note that this parameter is not supported by physics-related functions like PolygonCollider because the physics engine does not utilize the concept of a screen or camera.
    {
      screenOffset: { x: 0, y: 0 }, // Offsets the shape on the screen axes
    }
  11. Implement multiplayer in Easel

    Easel provides automatic multiplayer support integrated directly into the programming language. Developers can write code as if it were a single-player game (treating all players as existing in one shared world), and the engine handles synchronization, authority, and prediction. It utilizes advanced rollback netcode with incremental snapshotting and peer-to-peer connections to minimize latency and ensure a smooth experience.
  12. Use Symbols for unique identifiers in Easel

    The Symbol type represents a unique identifier. Symbols are more performant for comparisons than strings and should be used whenever a unique identifier is needed. A symbol is only equal to itself.
    // Create inline symbols using the $name syntax
    const x = $abc
    x == $abc // true
    x == $def // false