Skip to content

Application‐Lifecycle

Gustavo Adrien Polli edited this page Jul 13, 2026 · 1 revision

Application Lifecycle & Operational Flows

The execution loop of FantasyConsole functions via a structured, deterministic 60Hz processing pipeline managed directly by the Rust runtime environment and its underlying SDL2 ticker.

🔄 Execution Flow Diagram

       Cold Boot Execution
                │
     ┌──────────▼──────────┐
     │  _init() Lifecycle  │ ◄─── Once per environment initialization
     └──────────┬──────────┘
                │
  ┌─────────────►─────────────┐
  │                           │
┌─┴───────────────────────────┴─┐
│     _update() Loop (60Hz)     │ ◄─── Resolves network replication, button maps, game logic
└─┬───────────────────────────┬─┘
  │                           │
┌─▼───────────────────────────▼─┐
│      _draw() Loop (60Hz)      │ ◄─── Compiles primitive geometry and outputs frame
└─┬───────────────────────────┬─┘
  │                           │
  └─────────────◄─────────────┘

🔌 Operational Subsystems Lifecycle

1. The Cold Boot Phase

When an executable binary initializes, the CartLoader intercepts the targeted .p8 text layout or .p8.png steganographic canvas shell.

  • It checks metadata boundaries to execute automatic polymorphism, reshaping core internal memory maps to fit either PICO-8 (128x128) or TIC-80 (240x136) architectural layouts.
  • Once memory offsets are stabilized, the internal context loads the script code into the LuaVM platform environment and triggers the native _init() callback function exactly once.

2. The Asynchronous Update Cycle (_update)

Locked at a stable 60Hz frequency, the main thread calls the internal _update() callback loop to process active state transformations:

  • Polling local multidimensional player matrices to capture physical real-time game controllers (WASD and Arrow Keys).
  • Advancing mathematical physics counters, custom procedural arrays, or audio tracker registers.

3. The Pure Software Drawing Cycle (_draw)

Immediately following the physics update phase, the thread triggers the _draw() callback loop to commit graphic modifications downstream onto the screen buffer:

  • The system evaluates active hardware scissoring regions (clip()) on the pure CPU rasterizer layer before processing drawing streams to prevent VRAM buffer overflow hazards.
  • The software rasterizer parses layout tables, computes unrolled Bresenham line steps, and converts text bitmaps.
  • Finally, the internal SDL2 texture backend receives the pixel streaming buffer, updating the surface visor to maintain fluid visual execution without drop frames.

📸 Media Showcase

🏗️ Architecture

🔌 API Matrix

🛠️ Development

Clone this wiki locally