New Hugo site in website/ with prosperon.dev theme (blue/gold/castle aesthetic), docs sidebar navigation, and content pages. Rewrote all doc files to align with the actual codebase: compositor+film2d rendering, use() modules (no global prosperon object), Pit language, script+JSON entity model. Added entities.md, front matter to all 70+ API docs, and updated API index for current module architecture. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
82 lines
3.6 KiB
Markdown
82 lines
3.6 KiB
Markdown
---
|
|
title: "Features"
|
|
---
|
|
|
|
## Compositor-Driven Rendering
|
|
|
|
Prosperon separates *what to draw* from *how to draw it*. Your game registers sprites, shapes, text, tilemaps, and particles with `film2d`. At render time, the **compositor** queries these drawables, organizes them into planes and layers, applies effects, and produces a command list that the GPU backend executes.
|
|
|
|
This means:
|
|
- **Automatic batching** — sprites sharing a texture and material are drawn together
|
|
- **Layer sorting** — explicit ordering, y-sorting, or engine-optimized ordering per layer
|
|
- **Effects pipeline** — bloom (threshold + multi-pass blur), masks, custom shader passes
|
|
- **Presentation modes** — letterbox, integer scale, or stretch to window
|
|
- **Inspectable** — the render plan is plain data you can log and debug
|
|
|
|
## Duck-Typed Everything
|
|
|
|
Prosperon's API uses duck typing throughout. If an object has `type: 'sprite'`, a position, and an image, it's a valid sprite. No base classes to inherit from, no interfaces to implement.
|
|
|
|
This extends to the entire engine: anything that "looks like" a camera can be used as one. Anything with an `on_input` method can be possessed by a player. This makes prototyping extremely fast — you can test ideas with plain objects before committing to any structure.
|
|
|
|
## Actor-Based Game Logic
|
|
|
|
Games are written in [Pit](https://crumbpit.org), an actor language where:
|
|
- Each **program** (`.ce`) runs as an actor with its own heap
|
|
- Actors communicate via **message passing** (`send`, `$receiver`)
|
|
- Work is scheduled with `$delay` (one-shot) and `$clock` (periodic)
|
|
- Actors spawn children with `$start` and terminate with `$stop`
|
|
- **Modules** (`.cm`) return frozen values — shared, immutable APIs
|
|
|
|
This gives you concurrency without threads, isolation without overhead, and a natural way to structure game systems.
|
|
|
|
## Multi-Device Input
|
|
|
|
The input system normalizes keyboard, mouse, gamepad, and touch into **named actions**. A default action map handles common UI actions (up/down/confirm/cancel), and you define game-specific actions on top.
|
|
|
|
Features:
|
|
- **User pairing** — automatically pair devices to players, or explicit assignment
|
|
- **Control stacks** — possess entities, push/pop UI layers, block input propagation
|
|
- **Emacs-style keybindings** — `C-a` for ctrl+a, `M-x` for alt+x
|
|
- **Gesture recognition** — swipe detection on touch devices
|
|
- **Device-aware icons** — show the right button prompts for the current input device
|
|
|
|
## Asset Management
|
|
|
|
Prosperon finds and loads assets by name. Ask for `"slime"` and it searches the path for `slime.png`, `slime.qoi`, `slime.ase`, etc. Supported formats:
|
|
|
|
| Category | Formats |
|
|
|----------|---------|
|
|
| Images | PNG, QOI, GIF, JPG, Aseprite |
|
|
| Audio | WAV, FLAC, MP3, QOA |
|
|
| Fonts | TTF |
|
|
|
|
Assets are cached after first load. The virtual filesystem (PhysFS) supports mounting ZIP archives for mods and DLC.
|
|
|
|
## Audio
|
|
|
|
Simple audio playback with PCM caching and voice mixing:
|
|
|
|
```javascript
|
|
var audio = use('sound')
|
|
var voice = audio.play("explosion.wav")
|
|
voice.vol = 0.5
|
|
voice.loop = true
|
|
voice.stopped = true // stop it
|
|
```
|
|
|
|
Decodes to a uniform sample rate on load. Multiple voices mix independently.
|
|
|
|
## Text-Based Everything
|
|
|
|
Prosperon projects are entirely text:
|
|
- Game logic: `.cm` and `.ce` script files
|
|
- Config: plain JavaScript objects
|
|
- No binary scene files until you ship
|
|
|
|
This means git diffs are readable, merges are clean, and AI tools can understand your entire project.
|
|
|
|
## Tiny Footprint
|
|
|
|
Prosperon is a single executable. No installer, no SDK, no 2GB download. Drop it in your project folder and run. Version it alongside your code. Build on any machine with the same binary.
|