Noble Engine Documentation

repository·main·Indexed 19 days ago

https://github.com/noblerobot/nobleengine

A scene-based game engine for the Playdate console that extends the Playdate SDK. It provides high-level abstractions for scene lifecycle management, transitions, input handling, save/load data via a Settings/SaveGame API, animated sprites, and a menu system.

Tokens
696
Snippets
2
Records
5
Agent score
18%

What's inside Noble Engine

  1. Overview of Noble Engine features

    main

    Noble Engine is a state/scene-based game engine for the Playdate console. Key features include:

    • Scene Lifecycle Management: Handles update loops, sprites, input, and initialization on a per-scene basis.
    • Scene Transitions: An API and animation library with over a dozen transition types (e.g., cross dissolve, dip-to-black).
    • Settings/SaveGame API: Supports up to 1000 save slots with automatic disk updates during development.
    • Menu System: A boilerplate menu object with simple item management and click handlers.
    • Input Handling: Additional input methods and per-scene inputHandler logic.
    • Animated Sprites: Custom sprite objects with a state manager for multiple imagetables.
    • Text & Fonts: Unified text drawing (normal/aligned/localized) and support for Japanese katakana.
    • Developer Utilities: One-line methods for showing/hiding the crank indicator and FPS counter.
  2. Noble Engine coding style and conventions

    main

    Noble Engine uses specific naming conventions that may differ from standard Lua or the Playdate SDK. Note these when writing code or reading documentation:

    • Methods and variables: camelCase (e.g., myMethod).
    • Class names: TitleCase (e.g., Noble.Text).
    • Constants: ALL_CAPS_SNAKE_CASE (e.g., Noble.TransitionType.DIP_TO_BLACK).
    • Argument names: Prefixed with a double underscore (e.g., __displayName).
    • Verbosity: Names are verbose and do not use abbreviations. For example, playdate.graphics is aliased as Graphics rather than gfx.
  3. Install Noble Engine manually

    main

    To add Noble Engine to an existing project, download or clone this repository and place it into the libraries/noble/ directory relative to your main.lua file.

    It is highly recommended to follow the folder layout defined in the Project Template to ensure the best experience with the engine's features.

  4. Install Noble Engine via GitHub Template

    main

    The recommended way to start a new project is to use the Noble Engine Project Template repository.

    This template is available as a GitHub Template, which allows you to generate a new repository based on it. The template includes Noble Engine as a git submodule, allowing you to manage the engine independently from your game code. It also includes usage examples and a recommended folder structure.

    https://github.com/NobleRobot/NobleEngine-ProjectTemplate
  5. Initialize Noble Engine in main.lua

    main

    Once the library is placed in libraries/noble/, you can initialize the engine by importing the Noble module and passing your initial scene to Noble.new().

    import libraries/noble/Noble
    import scenes/MyStartingScene -- Or whatever your game's first scene is.
    
    Noble.new(MyStartingScene)