primitives-dsl:通用游戏架构模式 - Openclaw Skills
作者:互联网
2026-03-28
什么是 primitives-dsl?
primitives-dsl 技能通过六个核心组件(LOOP、TILEGRID、CONTROLBLOCK、POOL、EVENT 和 DISPATCHER)的标准词汇,为构建和分析游戏系统提供了一个强大的框架。通过使用这一 Openclaw Skills 资源,开发人员可以创建在极不相同的环境(从传统的 68K 系统到现代 GPU 驱动的 CUDA 内核和实体组件系统 ECS)之间保持可移植性的架构。
该技能对于需要弥合低级硬件限制与高级架构设计之间差距的开发人员特别有价值。它确保游戏逻辑与特定平台的实现解耦,使其成为跨平台引擎开发以及利用 Openclaw Skills 的力量将遗留代码重构为现代、可维护结构的必备工具。
下载入口:https://github.com/openclaw/skills/tree/main/skills/stusatwork-oss/primitives-dsl
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install primitives-dsl
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 primitives-dsl。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
primitives-dsl 应用场景
- 为多平台部署设计可移植的游戏或模拟循环。
- 在 68K、Cell/PPU、CUDA 和 ECS 环境之间转换现有架构。
- 精简复杂引擎结构与 AI 编码代理之间的沟通。
- 将杂乱的代码重构为显式的、基于状态和流程的架构。
- 创建具有稳定内存占用的受限设备或边缘计算游戏循环。
- 识别游戏系统的核心组件,并将其映射到 Openclaw Skills 中定义的六个通用原语。
- 定义 LOOP 阶段排序和分时逻辑以控制模拟周期。
- 使用 TILEGRID 规则结构化空间索引,用于邻接和区域管理。
- 在权威的 CONTROLBLOCK 状态记录中组织行为和约束。
- 通过有界 POOL 管理内存分配,以防止热路径中的性能瓶颈。
- 配置 DISPATCHER 以路由 EVENT 消息并管理跨 CPU 线程或 GPU 内核的调度策略。
- 生成全面的原语图、数据流简图和可移植性笔记,以完成架构蓝图。
primitives-dsl 配置指南
要将此 Openclaw Skills 模块集成到您的工作流程中,请在代理的技能库中包含 primitives-dsl 定义。您可以在开发环境中使用标准化的提示词调用该技能:
# AI 代理调用示例
"应用 primitives-dsl 为 [您的子系统] 设计一个循环。提供原语图 + 数据流 + 可移植性。"
确保您可以访问快速卡片参考,以获取 Openclaw Skills 文档中指定的原语定义和约束的技术概述。
primitives-dsl 数据架构与分类体系
primitives-dsl 技能使用结构化的输出契约来组织架构数据,以确保不同 Openclaw Skills 实现之间的一致性。
| 原语 | 数据职责 | 关键元数据 |
|---|---|---|
| LOOP | 执行阶段排序 | 时间片预算 |
| TILEGRID | 空间邻接规则 | 网格维度 (2D/3D) |
| CONTROLBLOCK | 权威状态 | 标志、计数器、句柄 |
| POOL | 有界内存分配 | 实体/作业容量 |
| EVENT | 消息负载 | 路由键/通道 |
| DISPATCHER | 工作调度 | FIFO、优先级、固定步长 |
name: primitives-dsl
description: "Universal game architecture DSL with six primitives (LOOP, TILEGRID, CONTROLBLOCK, POOL, EVENT, DISPATCHER). Use when: (1) designing portable game/sim loops, (2) translating between architectures (68K ? Cell ? CUDA ? ECS), (3) explaining engine structure to AI agents, (4) refactoring chaos into explicit state + flow. Invocation produces: Primitive Map, Dataflow Sketch, Worked Example, Portability Notes."
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:
- Primitive Map — Identify which parts of the system correspond to each primitive
- Dataflow Sketch — Text diagram or table describing movement of state/events
- One Worked Example — Or cite an existing example file
- 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
- Quick Card:
assets/quick_card.md— One-page reference - Architecture Mapping:
references/architecture_mapping.md— Platform translation table + full code examples - Worked Examples:
references/example_shooter.md— Classic shooter loopreferences/example_mall_tick.md— GLITCHDEXMALL zone simreferences/example_npc_step.md— NPC state machine step
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
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
信号管道:自动化营销情报工具 - Openclaw Skills
技能收益追踪器:监控 Openclaw 技能并实现变现
AI 合规准备就绪度:评估与治理工具 - Openclaw Skills
FOSMVVM ServerRequest 测试生成器:自动化 API 测试 - Openclaw Skills
酒店搜索器:AI 赋能的住宿与位置情报 - Openclaw Skills
Dub 链接 API:程序化链接管理 - Openclaw Skills
IntercomSwap:P2P BTC 与 USDT 跨链兑换 - Openclaw Skills
spotplay:macOS 原生 Spotify 播放控制 - Openclaw Skills
DeepSeek OCR:AI驱动的图像文本识别 - Openclaw Skills
Web Navigator:自动化网页研究与浏览 - Openclaw Skills
AI精选
