build-game-monster-system

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Build Game Monster System

构建游戏怪物系统

Build monsters as gameplay-compatible runtime assets, not decorative meshes.
将怪物构建为符合游戏玩法的运行时资源,而非装饰性网格模型。

Establish the contract

确立资源合约

Read references/monster-contract.md before implementation or audit. Check the real game content model, combat events, enemy state machine, collision API, camera distance, and asset loader before extending the contract.
Use related skills when applicable:
  • Use
    img2threejs
    for image-driven procedural reconstruction and its staged visual gates.
  • Use
    build-hybrid-game-assets
    to choose procedural versus imported representation and record provenance/budgets.
  • Use
    tune-enemy-ai
    for perception, intent, movement, and behavior transitions.
  • Use
    design-action-combat
    for startup/active/recovery timing and authoritative contact.
在实现或审核前,请阅读references/monster-contract.md。在扩展合约前,请确认真实游戏内容模型、战斗事件、敌人状态机、碰撞API、相机距离及资源加载器。
适用时可使用相关技能:
  • 使用
    img2threejs
    实现图像驱动的程序化重构及其分阶段视觉校验。
  • 使用
    build-hybrid-game-assets
    选择程序化或导入式资源表现形式,并记录来源与预算。
  • 使用
    tune-enemy-ai
    处理感知、意图、移动及行为转换。
  • 使用
    design-action-combat
    设置蓄力/生效/恢复时长及权威判定接触。

Separate four layers

拆分四层架构

  1. MonsterDefinition
    : serializable authored facts, tags, scale, stats, attacks, locomotion, asset provenance, and budgets.
  2. MonsterRig
    : semantic transform hierarchy, joints, sockets, secondary-motion anchors, materials, and LOD visuals.
  3. MonsterRuntime
    : current state, timers, target intent, health/posture, cooldowns, and authoritative combat events.
  4. MonsterViewAdapter
    : drives rig poses, VFX, audio, visibility, and LOD from runtime state; never decides hits from rendered pose.
Do not duplicate authored combat values in the rig or UI.
  1. MonsterDefinition
    :可序列化的创作信息、标签、比例、属性、攻击方式、移动方式、资源来源及预算。
  2. MonsterRig
    :语义变换层级、关节、插槽、次级运动锚点、材质及LOD视觉效果。
  3. MonsterRuntime
    :当前状态、计时器、目标意图、生命值/姿态、冷却时间及权威战斗事件。
  4. MonsterViewAdapter
    :根据运行时状态驱动绑定姿态、视觉特效(VFX)、音频、可见性及LOD;绝不通过渲染姿态判定命中。
请勿在绑定系统或UI中重复创作好的战斗数值。

Build the rig

构建绑定系统

  • Use
    +Y
    up,
    +Z
    forward, meters, and a ground-contact root.
  • Keep
    root -> motion -> body
    stable across every monster and LOD.
  • Parent limb segments as real joint chains so shoulder/hip motion propagates through elbows/knees to wrists/ankles.
  • Name semantic equivalents for nonhumanoids; do not fake absent anatomy.
  • Provide sockets for attack origins, VFX, audio, targeting, ground contact, attachments, and death effects.
  • Keep visual meshes out of physics by default. Provide simple solid, navigation, hurt, attack, and trigger shapes separately.
  • Preserve root, joints, sockets, collision, and animation state across LOD changes.
  • 采用
    +Y
    轴向上、
    +Z
    轴向前的坐标系,单位为米,并设置地面接触根节点。
  • 确保所有怪物及LOD的
    root -> motion -> body
    结构保持稳定。
  • 按照真实关节链连接肢体段,使肩/髋部运动能传递至肘/膝,再到腕/踝。
  • 为非人形怪物命名语义等效的关节;不要伪造不存在的解剖结构。
  • 为攻击原点、视觉特效、音频、目标定位、地面接触、附加组件及死亡效果提供插槽。
  • 默认将视觉网格排除在物理系统之外。单独提供简单的实体碰撞、导航碰撞、受击盒、攻击范围及触发区域形状。
  • 在LOD切换时保留根节点、关节、插槽、碰撞及动画状态。

Connect behavior and combat

关联行为与战斗系统

Support at least
idle
,
investigate
,
pursue
,
reposition
,
windup
,
attack
,
recover
,
stagger
, and
defeated
. Each attack definition must declare startup, active, recovery, cooldown, contact shape/socket, damage/posture output, facing rule, and interrupt/cancel policy.
Drive contacts from authoritative action IDs and collision events. Animation may expose a normalized phase, but it must not create damage by itself.
至少支持
idle
investigate
pursue
reposition
windup
attack
recover
stagger
defeated
状态。每个攻击定义必须声明蓄力阶段、生效阶段、恢复阶段、冷却时间、碰撞形状/插槽、伤害/姿态输出、朝向规则以及中断/取消策略。
通过权威动作ID及碰撞事件驱动接触判定。动画可暴露归一化进度,但不得自行产生伤害判定。

Compose testable movesets

构建可测试的动作集

  • Author movesets as serializable sequences of intent states and attack IDs. Keep attack timing in the attack definitions; the moveset references it instead of copying it.
  • Compile attack steps into explicit startup, active, and recovery phases.
  • Provide a pure sampler from
    (movesetId, elapsed)
    to state, attack, normalized phase, active flag, interruptibility, and stable action ID.
  • Give every loop cycle a new action ID while preserving one ID across an attack's startup, active, and recovery phases.
  • Expose queryable or seeded fixtures for the midpoint and boundaries of every phase so reviewers can freeze and reproduce them without campaign playthrough.
  • 将动作集创作为由可序列化的意图状态及攻击ID组成的序列。将攻击时长保留在攻击定义中;动作集仅引用该时长,而非复制。
  • 将攻击步骤编译为明确的蓄力、生效及恢复阶段。
  • 提供从
    (movesetId, elapsed)
    到状态、攻击、归一化进度、生效标记、可中断性及稳定动作ID的纯采样器。
  • 在攻击的蓄力、生效及恢复阶段保留同一ID,同时为每个循环周期分配新的动作ID。
  • 暴露可查询或可种子化的测试组件,用于每个阶段的中点及边界,以便审核人员无需进行完整关卡流程即可冻结并复现这些状态。

Verify conformance

验证合规性

  • Add deterministic fixtures for all required states, each attack phase, interrupt/stagger, death, LOD switching, and reset.
  • Test moveset timeline continuity, exact active-window boundaries, full attack coverage, per-action ID stability, and per-loop ID renewal.
  • Test joint propagation, socket stability, collider coverage, single-contact idempotence, and disposal.
  • Render the monster at real encounter distance in the in-app browser.
  • Measure triangles, draw calls, textures, frame time, and mobile pixel-ratio behavior.
  • Fail the asset if it has floating attachments, missing mandatory states, pose-derived damage, LOD socket drift, or unbounded resource cost.
Report whether the monster fully conforms, conforms with documented exceptions, or needs a new archetype capability added to the shared contract.
  • 为所有必需状态、每个攻击阶段、中断/ stagger、死亡、LOD切换及重置添加确定性测试组件。
  • 测试动作集时间线连续性、精确的生效窗口边界、完整攻击覆盖、每个动作ID的稳定性及每个循环ID的更新情况。
  • 测试关节运动传递、插槽稳定性、碰撞体覆盖范围、单次接触幂等性及资源释放。
  • 在应用内浏览器中以真实遭遇距离渲染怪物。
  • 测量三角形数量、绘制调用次数、纹理、帧时间及移动端像素比表现。
  • 若资源存在悬浮附加组件、缺失必需状态、基于姿态的伤害判定、LOD插槽偏移或无限制资源消耗,则判定该资源不合格。
报告怪物是否完全合规、存在文档化例外情况的合规,或是需要向共享合约添加新的原型能力。