mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-14 12:27:29 +08:00
2.8 KiB
2.8 KiB
Unreal World Sync
This document defines the recommended integration contract between clawgo and an Unreal Engine client.
See also:
Authority
clawgoremains the authoritative world server.- Unreal is a renderer and input client.
- Web and Unreal should consume the same world APIs and action APIs.
Read Path
Unreal should subscribe to:
GET /api/world- runtime websocket snapshots from
/api/runtime
Key world payloads to consume:
world_idticklocationsentitiesroomsoccupancyentity_occupancyroom_occupancynpc_statesrecent_events
Write Path
Player-originated actions should map to:
world_player_actionmovespeakinteractquest_acceptquest_progressquest_complete
World admin / god-view edits should map to:
world_entity_updateworld_entity_createworld_npc_createworld_quest_create
Placement Contract
Entities expose a stable placement payload:
{
"id": "bench",
"location_id": "commons",
"placement": {
"model": "entity.table",
"scale": [1.2, 1.2, 1.2],
"rotation": [0, 1.57, 0],
"offset": [0.8, 0, -0.4]
}
}
Interpretation:
model: shared logical asset keyscale: local model scalerotation: radians, XYZ orderoffset: local offset inside the owning location
Unreal should treat location_id + offset as the effective placement anchor.
Asset Pipeline
Recommended source workflow:
- Author in Blender / Maya / DCC source files.
- Export web assets as
GLB. - Export Unreal assets as
FBXor Unreal-preferred import format. - Keep the logical asset key the same across clients.
Example:
- logical key:
entity.table - web asset:
/models/furniture/table.glb - unreal asset:
/Game/World/Furniture/SM_Table
Animation Contract
Recommended shared action set for humanoid characters:
IdleWalkTalkInteract
Unreal should choose animations from world state intent/status:
- idle state ->
Idle - moving between anchors ->
Walk - speaking event ->
Talk - room/task work ->
Interact
Rooms
Rooms are task execution spaces created by the world mind.
Unreal should render them as:
- isolated interior pods
- task sub-scenes
- linked challenge spaces
Use:
roomsroom_occupancy
to render membership and lifecycle.
Replication Model
Do not replicate game authority into Unreal.
Recommended flow:
- Unreal receives latest snapshot.
- Unreal interpolates transforms locally.
- Unreal submits user actions back to
clawgo. clawgoarbitrates and publishes the new truth.
This keeps:
- world logic in one place
- web and Unreal behavior aligned
- NPC autonomy consistent across clients