Get the FREE Ultimate OpenClaw Setup Guide →
s

Universal Game Primitives

Verified

@stusatwork-oss

npx machina-cli add skill @stusatwork-oss/primitives-dsl --openclaw
Files (1)
SKILL.md
4.3 KB

primitives-dsl — Universal Game Architecture Patterns

What this skill does

Provides a small, portable DSL of six universal primitives that appear across 68K-era loops, Cell/PPU+SPU orchestration, CUDA/GPU kernels, and modern ECS engines.

Primitives: LOOP · TILEGRID · CONTROLBLOCK · POOL · EVENT · DISPATCHER

Use this skill to:

  • Design a game/sim loop that ports cleanly across platforms
  • Translate between architectures (68K ↔ Cell ↔ CUDA ↔ ECS)
  • Explain engine structure to AI agents with minimal ambiguity
  • Produce "worked examples" using the same primitive vocabulary every time

When to use it

  • Starting a new subsystem and want a portable mental model
  • Refactoring chaos into explicit state + flow
  • Mapping legacy code to modern patterns
  • Designing constrained-device / edge / "shareware for the future" loops

When NOT to use it

  • Don't invent new primitives (keep the vocabulary stable)
  • Don't debate engine religion (Unity vs Unreal vs custom). Translate, don't preach.
  • Don't skip the concrete artifact: every use must end in a diagram, table, or pseudocode

The DSL (definitions)

LOOP A repeated update cycle with explicit phases. Owns time slicing and ordering.

TILEGRID A spatial index with stable adjacency rules (2D/3D grids, nav tiles, zone cells, chunk maps).

CONTROLBLOCK A compact, authoritative state record (flags, counters, handles, timers) used to coordinate behavior and enforce constraints.

POOL A bounded allocator for frequently-created things (entities, bullets, particles, jobs). No unbounded new in hot paths.

EVENT A structured message representing "something happened" with minimal payload and explicit routing metadata.

DISPATCHER Routes work and events to handlers (CPU threads, SPUs, GPU kernels, ECS systems). Also where scheduling policy lives.

Output contract (what you must produce)

When invoked, produce:

  1. Primitive Map — Identify which parts of the system correspond to each primitive
  2. Dataflow Sketch — Text diagram or table describing movement of state/events
  3. One Worked Example — Or cite an existing example file
  4. Portability Notes — How this maps to 68K / Cell / CUDA / ECS

Invocation patterns (copy/paste prompts)

"Apply primitives-dsl to design a loop for ___ . Provide a Primitive Map + Dataflow + Portability."

"Translate this architecture into LOOP/TILEGRID/CONTROLBLOCK/POOL/EVENT/DISPATCHER."

"Given these constraints (___), propose a primitives-dsl design and a worked example."

Guardrails / style rules

  • Use primitive names in ALL CAPS
  • Prefer tables over paragraphs for mappings
  • Use tight pseudocode (no full implementations)
  • Always name the CONTROLBLOCK fields explicitly
  • Always specify POOL bounds (even if guessed)
  • EVENTS must have a routing key or channel
  • DISPATCHER must declare policy: FIFO, priority, fixed-step, budgeted, etc.

References

External Resources

  • Anthropic Skills Repository — Skill creation patterns
  • Alien Bash II — 68K source extraction (Glenn Cumming, open domain)
  • NVIDIA CUDA Programming Guide — Modern GPU primitive patterns
  • Cell Broadband Engine Programming Handbook — SPE work distribution

Source

git clone https://clawhub.ai/stusatwork-oss/primitives-dslView on GitHub

Overview

primitives-dsl provides a compact, portable DSL built around six universal primitives used across legacy loops and modern ECS. It lets you express core loop behavior, spatial layout, state records, object pools, events, and dispatch policies. Invocation always yields a Primitive Map, a Dataflow Sketch, a Worked Example, and Portability Notes.

How This Skill Works

You map your system components to the six primitives, then create a Primitive Map and describe dataflow via EVENTS routed by a DISPATCHER. The Dataflow Sketch then shows how state and events move through LOOP phases, TILEGRID adjacency, and POOL allocations. This structure supports cross-architecture translation (68K/Cell/CUDA/ECS) and produces consistent worked examples and portability notes.

When to Use It

  • Starting a new subsystem and want a portable mental model
  • Refactoring chaos into explicit state + flow
  • Mapping legacy code to modern patterns
  • Designing constrained-device / edge / "shareware for the future" loops
  • Translating across architectures (68K ↔ Cell ↔ CUDA ↔ ECS)

Quick Start

  1. Step 1: Map your system components to LOOP, TILEGRID, CONTROLBLOCK, POOL, EVENT, DISPATCHER
  2. Step 2: Draft a Primitive Map and a Dataflow Sketch showing state and event flow
  3. Step 3: Produce a Worked Example and Portability Notes for cross-architecture translation

Best Practices

  • Use PRIMITIVE NAMES in ALL CAPS in diagrams and code
  • Prefer tables over paragraphs for mappings
  • Provide tight pseudocode instead of full implementations
  • Explicitly name CONTROLBLOCK fields (flags, counters, handles, timers)
  • Specify POOL bounds (maxEntities, maxParticles, etc.) and avoid unbounded allocations

Example Use Cases

  • Classic shooter loop (references/example_shooter.md)
  • GLITCHDEXMALL zone simulation (references/example_mall_tick.md)
  • NPC state machine step (references/example_npc_step.md)
  • Porting a 68K loop to an ECS-based engine: Primitive Map + Dataflow Sketch
  • Translating a CUDA kernel-like loop into LOOP/TILEGRID/CONTROLBLOCK/POOL/EVENT/DISPATCHER

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers