用這些包製作的遊戲讀寫的每一種檔案:它的檔名、它宣告的版本、讀寫它的 Go 函式、說明其欄位的指南,以及一個示例,讓人或 AI 不讀程式碼也能編輯它。
除了下文“JSON 檔案”和“其他工具的格式”中列出的檔案,遊戲作者編寫的檔案都是 YAML。本頁的每個示例都由測試檢查:YAML 示例是其格式的規範形式,即其編碼器寫出的位元組,載入再儲存後不變,所以沒有一個示例含有格式會拒絕的鍵或會被改寫的排版;JSON 和 Yarn 示例能被該格式的讀取函式載入。
每種 YAML 格式的共同規則
- 版本。 文件頂層的
version 鍵是一個整數,表示文件採用該格式的哪個版本;模組清單中這個鍵叫 manifestVersion。缺少它、寫成 version: 0 或版本比程式碼能讀的更新的檔案都會被拒絕。
- 嚴格的鍵。 格式未定義的鍵會被拒絕,檔案中的第二個 YAML 文件和重複給出的鍵也一樣,錯誤會指出檔案、行號和欄位並說明如何修復(錯誤)。
- 唯一的規範形式。 儲存時按固定順序寫出鍵,對本身沒有順序的內容排序,並且不寫時間戳或隨機 ID,因此同一個值總是得到相同的位元組,規範形式的檔案載入再儲存後不會改變。手寫檔案第一次儲存時會丟掉註釋並把排版改寫成規範形式;此後每次儲存只改動真正變化的部分。
- Schema。 場景檔案和匯入設定旁註檔案有已釋出的 JSON Schema,資料表的 Schema 由其行型別生成,因此編輯器在編寫時就能補全和檢查它們(YAML 檔案的 Schema)。
專案與資源
專案檔案
| 檔案 |
版本 |
讀寫函式 |
欄位 |
專案根目錄的 game.yaml |
version: 1 |
project.Parse、project.Encode |
專案檔案;Schema 為 https://game.nsgo.dev/schemas/game.v1.json |
version: 1
name: Cave Run
id: dev.nsgo.caverun
appVersion: 0.1.0
window:
title: Cave Run
width: 960
height: 540
display:
width: 320
height: 180
mode: fit
autoload:
mainScene: title
scenes:
- name: title
path: scenes/title.scene.yaml
遊戲簡報
| 檔案 |
版本 |
讀寫函式 |
欄位 |
專案根目錄的 brief.yaml |
version: 1 |
project.ParseBrief、project.EncodeBrief |
編輯器;Schema 為 https://game.nsgo.dev/schemas/brief.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/brief.v1.json
version: 1
pitch: 'A short, tense dungeon platformer: a knight with one sword and three hearts dives through five floors, each ending in a door that only opens once its lever is found.'
genre: [2D platformer, action]
tags: [dungeon, pixel-art]
platforms: [desktop, 'phones, touch', web]
artDirection: 16 px pixel art, 4-colour shading, cold stone with warm torch light. No outlines on tiles; 1 px dark outline on characters.
feel:
summary: Snappy, forgiving jumps (coyote time). A first-time player clears floor 1 in under a minute and dies 2–4 times on floor 3.
targets:
- metric: median_time
scene: floor_01
summary: first-time player clears floor 1 in under a minute
unit: s
max: 60
- metric: deaths
scene: floor_03
summary: 2–4 deaths on floor 3
min: 2
max: 4
編輯器設定
| 檔案 |
版本 |
讀寫函式 |
欄位 |
位於專案之外的使用者配置目錄中的 editor.yaml(editor.DefaultSettingsPath) |
version: 1 |
editor.ParseEditorSettings、editor.EncodeEditorSettings |
編輯器;Schema 為 https://game.nsgo.dev/schemas/editor-settings.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/editor-settings.v1.json
version: 1
language: system
appearance: system
autoSave: true
viewportOverlays:
- collision_shapes
- connections
- navigation
- triggers
overlayLegend:
- added
- agent
- changed
- problem
- removed
- selection
shortcuts:
view.frame: g
seenTips:
- first_review.ask_selection
- first_review.hold_b
- first_review.keep_revert
agent:
builtInProvider: Anthropic API
tools:
game_delete_file: false
mcpServers:
- name: nsgo-game
title: Running game · nsgo dev
description: inspect and drive the live game
command: go
args:
- tool
- nsgo
- mcp
enabled: true
weeklyRequestLimit: 300
privacy:
sceneAndData: true
viewportImages: true
goSource: false
artAndAudio: false
編輯器 MCP 許可權規則
| 檔案 |
版本 |
讀寫函式 |
欄位 |
位於 game.yaml 旁的 permissions.yaml(納入 Git 追蹤並與團隊共享) |
version: 1 |
editor.ParsePermissions、editor.EncodePermissions |
編輯器;Schema 為 https://game.nsgo.dev/schemas/permissions.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/permissions.v1.json
version: 1
profile: balanced
rules:
- action: edit
patterns:
- scenes/**
- prefabs/**
- data/**
decision: allow
- action: run
patterns:
- game check
- playtests
decision: allow
- action: edit
patterns:
- game.yaml
- brief.yaml
decision: ask
- action: code
patterns:
- '**/*.go'
decision: ask
- action: create
patterns:
- '**'
decision: ask
- action: delete
patterns:
- '**'
decision: deny
- action: run
patterns:
- shell
decision: deny
智慧體後臺任務執行緒
| 檔案 |
版本 |
讀寫函式 |
欄位 |
專案根目錄下的 .nsgo/threads/<id>.thread.yaml(預設 default.thread.yaml) |
version: 1 |
editor.ParseAgentThread、editor.EncodeAgentThread |
編輯器 |
version: 1
id: default
scene: scenes/level_01.scene.yaml
tasks:
- id: task-1
number: 1
title: slime_02 jumps the gap at x 360
source: you
startMode: queue
state: running
scene: scenes/level_01.scene.yaml
stepSummary: placing the jump arc
editingObjects:
- slime_02
- id: task-2
number: 2
title: Coin pickup sound a little higher
source: you
startMode: queue
state: queued
startsAfterTaskId: task-1
編輯器自動化
| 檔案 |
版本 |
讀寫函式 |
欄位 |
位於專案根目錄 game.yaml 旁的 automations.yaml |
version: 1 |
editor.ParseAutomations、editor.EncodeAutomations |
編輯器;Schema 為 https://game.nsgo.dev/schemas/automations.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/automations.v1.json
version: 1
automations:
- id: level-check
name: A level file changes
enabled: true
trigger:
event: file_changed
glob: scenes/level_*.scene.yaml
instruction: runs game check and 5 playtests, reports only problems
- id: review-brief
name: You keep a review
enabled: true
trigger:
event: review_kept
instruction: updates the brief's open questions if the change answers one
- id: new-prefab-example
name: A new prefab is added
enabled: true
trigger:
event: file_added
kind: prefab
instruction: writes its example scene and a test
- id: before-export-mobile
name: Before export
enabled: false
trigger:
event: before_export
instruction: checks frame time and memory on a low-end phone profile
- id: nightly-balance
name: Every night
enabled: false
trigger:
event: daily
time: "02:00"
instruction: plays all floors 50 times and leaves a balance report
匯入設定旁註檔案
| 檔案 |
版本 |
讀寫函式 |
欄位 |
圖片、聲音、字型或模型旁邊的 <資源>.import.yaml,如 hero.png.import.yaml |
version: 1 |
importsettings.Parse、importsettings.Encode |
命令列;Schema 為 https://game.nsgo.dev/schemas/import.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/import.v1.json
version: 1
image:
filter: nearest
slice:
width: 16
height: 16
count: 6
pivot:
default: [0.5, 1]
cells:
- cell: 2
pivot: [0.25, 0.75]
credit:
author: Kenney
license: CC0-1.0
source: https://kenney.nl/assets/kenney-fonts
生成資源來源旁註檔案
| 檔案 |
版本 |
讀寫函式 |
欄位 |
生成圖片或聲音旁邊的 <資源>.source.yaml,如 slime_frost.png.source.yaml |
version: 1 |
importsettings.ParseAssetSource、importsettings.EncodeAssetSource |
編輯器;Schema 為 https://game.nsgo.dev/schemas/source.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/source.v1.json
version: 1
generator: pixel-gen
model: pixflux-1
prompt: ice slime, 16 px pixel art, 4-colour shading, 1 px dark outline, facing right
seed: 81515
references:
- art/characters/slime.png
- brief.yaml#art
license: pixellab-commercial-1.2
commercialUse: true
approvedBy: kim
專案索引
| 檔案 |
版本 |
讀寫函式 |
欄位 |
game.yaml 旁邊的 game.index.yaml,由 game index、game mv 和編輯器維護 |
version: 1 |
refs.ParseIndex、refs.EncodeIndex |
穩定引用 |
# The stable IDs of this project's files, kept by game index, game mv and the editor. Keep it in version control.
version: 1
files:
- path: art/hero.png
sha256: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
- path: scenes/room.scene.yaml
uid: scene00000001
資源庫包清單
| 檔案 |
版本 |
讀寫函式 |
欄位 |
資源包或外掛包根目錄的 pack.yaml |
version: 1 |
library.ParseManifest、library.EncodeManifest |
資源與外掛庫 |
version: 1
name: coins
kind: asset
packVersion: 1.0.0
description: A spinning coin.
license: CC0-1.0
files:
- coin.png
autoload:
resources:
- name: coin
path: coin.png
資源庫索引
| 檔案 |
版本 |
讀寫函式 |
欄位 |
包庫根目錄的 index.yaml |
version: 1 |
library.ParseIndex、library.EncodeIndex |
資源與外掛庫 |
version: 1
packs:
- name: dungeon-tiles
kind: asset
packVersion: "1"
description: Stone tiles.
tags: [2d, tiles]
license: CC0-1.0
source: b
sha256: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
本地化資源清單
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 assets.yaml |
version: 1 |
l10n.ParseAssetManifest、l10n.EncodeAssetManifest |
l10n |
version: 1
base_locale: en
assets:
ui/title_banner.png:
en: ui/title_banner.png
zh-Hans: ui/title_banner.zh-Hans.png
voice/intro.wav:
en: locales/en/voice/intro.wav
ja: locales/ja/voice/intro.wav
groups:
voice:
- voice/intro.wav
本地化字串表(YAML)
| 檔案 |
版本 |
讀寫函式 |
欄位 |
每種語言一個 .yaml 檔案,如 locales/en.yaml |
version: 1 |
l10n.ParseYAML、l10n.EncodeYAML、l10n.Catalog.LoadYAML |
l10n |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/l10n.v1.json
version: 1
locale: en
strings:
hud.score: 'Score: {score}'
menu.play: Play
menu.quit: Quit
plurals:
coins:
zero: No coins
one: '{count} coin'
other: '{count} coins'
模組清單
| 檔案 |
版本 |
讀寫函式 |
欄位 |
模組目錄根部的 mod.yaml |
manifestVersion: 1 |
modding.ParseManifest、modding.EncodeManifest |
modding |
manifestVersion: 1
id: com.example.boss-rush
name: Boss Rush
version: 1.2.0
author: Example Studio
description: Spawns a slime every five seconds and shows a HUD badge while the rush runs.
entry: mod.tsx
gameVersion: '>=0.2.0'
capabilities: [readState, spawnEntity, emitEvent, ui]
Steam 創意工坊後設資料
| 檔案 |
版本 |
讀寫函式 |
欄位 |
釋出到 Steam 創意工坊的模組目錄中、mod.yaml 旁的 workshop.yaml |
version: 1 |
modding.ParseWorkshopMetadata、modding.EncodeWorkshopMetadata |
modding |
version: 1
appId: 480
publishedFileId: 1001
title: Boss Rush
description: Spawns a slime every five seconds.
tags: [gameplay, survival]
visibility: public
preview: preview.png
3D 著色器材質
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.material.yaml,在 game dev 中熱過載 |
version: 1 |
hotreload.ParseMaterial、hotreload.EncodeMaterial |
render3d |
version: 1
name: Crate
shader: shaders/lit.wgsl
blend: opaque
cull: back
frontFace: ccw
depthCompare: less
scalars:
roughness: 0.4
colors:
tint: '#d9c6a5'
textures:
albedo: textures/crate.png
體素世界
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.voxel.yaml |
version: 1 |
voxel.Parse、voxel.Encode |
voxel;Schema 為 https://game.nsgo.dev/schemas/voxel.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/voxel.v1.json
version: 1
name: hill
chunkSize: 4
voxelSize: 1
palette:
- id: 1
name: stone
chunks:
- x: 0
"y": 0
z: 0
runs:
- 1*4
- 0*60
3D 網格地圖
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.gridmap.yaml |
version: 1 |
world3d.ParseGridMap、world3d.EncodeGridMap、world3d.LoadGridMapFS |
world3d;Schema 為 https://game.nsgo.dev/schemas/gridmap.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/gridmap.v1.json
version: 1
name: Stone Keep
cellSize:
- 2
- 2
- 2
meshLibrary: models/dungeon_tiles.gltf
boxes:
- min:
- 0
- 0
- 0
max:
- 4
- 0
- 4
tile: stone_floor
cells:
- at:
- 0
- 1
- 0
tile: stone_pillar
- at:
- 4
- 1
- 0
tile: stone_pillar
orientation: 1
地形定義
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.terrain.yaml |
version: 1 |
world3d.ParseTerrain、world3d.EncodeTerrain、world3d.LoadTerrainFS |
world3d;Schema 為 https://game.nsgo.dev/schemas/terrain.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/terrain.v1.json
version: 1
name: Alpine Valley
heightmap: terrain/alpine_height.png
cellSize: 2
heightScale: 40
splatMaps:
- terrain/alpine_splat0.png
heightBlendContrast: 0.65
triplanar:
enabled: true
slopeThreshold: 0.7
slopeBlend: 0.15
sharpness: 4
scale: 0.25
layers:
- name: grass
albedo: textures/grass_albedo.png
normal: textures/grass_normal.png
height: textures/grass_height.png
roughness: 0.85
uvScale:
- 16
- 16
- name: dirt
albedo: textures/dirt_albedo.png
normal: textures/dirt_normal.png
height: textures/dirt_height.png
roughness: 0.9
uvScale:
- 12
- 12
heightBias: -0.05
- name: rock
albedo: textures/rock_albedo.png
normal: textures/rock_normal.png
height: textures/rock_height.png
roughness: 0.8
uvScale:
- 8
- 8
heightBias: 0.1
- name: snow
albedo: textures/snow_albedo.png
normal: textures/snow_normal.png
roughness: 0.5
uvScale:
- 10
- 10
heightBias: 0.05
3D 植被層
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.foliage.yaml |
version: 1 |
world3d.ParseFoliage、world3d.EncodeFoliage、world3d.LoadFoliageFS |
world3d;Schema 為 https://game.nsgo.dev/schemas/foliage.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/foliage.v1.json
version: 1
name: Alpine Meadow
terrain: terrain/alpine.terrain.yaml
layers:
- name: grass
mesh: models/grass_clump.glb
material: materials/grass.material.yaml
density: 1.5
minScale: 0.8
maxScale: 1.3
alignToNormal: 0.6
maxSlopeDeg: 35
baseMaxDistance: 80
seed: 42
- name: pine_tree
mesh: models/pine_tree.glb
densityMap: terrain/forest_density.png
spacing: 4
minScale: 0.85
maxScale: 1.25
maxSlopeDeg: 28
minHeight: 2
maxHeight: 32
baseMaxDistance: 160
boundingRadius: 3.5
seed: 108
場景、資源與動畫
場景
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.scene.yaml,如 scenes/cave_room.scene.yaml |
version: 1、version: 2(例項化、繼承、glTF 模型、粒子發射器、分層瓦片地圖、LDtk 關卡)、version: 3(視差與重複圖層、瓦片地圖偏移)或 version: 4(3D 光源、場景環境、3D 相機、反射探針、光照探針網格);內建物理元件 version: 1;內建 2D 光照元件 version: 1;內建 2D 導航區域元件 version: 1 |
sceneformat.Parse、sceneformat.Encode |
編輯器與場景格式;Schema 為 https://game.nsgo.dev/schemas/scene.v1.json、scene.v2.json、scene.v3.json 和 scene.v4.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/scene.v1.json
version: 1
name: Cave Room
virtualWidth: 320
virtualHeight: 180
layers:
- name: actors
space: world
order: 10
objects:
- id: hero
x: 48
"y": 40
sprite:
atlas: actors
frame: hero
遊戲介面(HUD 與選單螢幕)
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.screen.yaml,如 screens/hud.screen.yaml 和 screens/pause.screen.yaml |
version: 1 |
gameui.ParseScreen、gameui.EncodeScreen、gameui.LoadScreenFS、gameui.BuildScreen |
gameui;Schema 為 https://game.nsgo.dev/schemas/screen.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/screen.v1.json
version: 1
name: hud
designWidth: 640
designHeight: 360
nodes:
- id: status
type: vbox
anchor: top_left
offset:
x: 12
"y": 12
spacing: 4
children:
- id: hearts
type: sprite_row
width: 52
height: 14
sprite: art/ui/heart.png
spriteCount: 3
- id: coins
type: label
sizeMode: fit_text
height: 16
textKey: hud.coins
- id: touch
type: container
deviceClasses:
- phone
- tablet
children:
- id: jump
type: touch_button
anchor: bottom_right
offset:
x: 24
"y": 28
width: 52
height: 52
textKey: hud.jump
touchHitSize: 64
場景合併衝突報告
| 檔案 |
版本 |
讀寫函式 |
欄位 |
三路場景合併存在衝突時由 game merge 寫出(覆蓋未合併的 *.scene.yaml 或寫入 -conflict-out) |
version: 1 |
sceneformat.ParseConflict、sceneformat.EncodeConflict |
編輯器與場景格式、命令列 |
version: 1
path: scenes/level_01.scene.yaml
merged:
- scope: object
target: slime_03
side: ours
action: added
conflicts:
- kind: field
scope: object
layer: actors
object: door
field: x
base: 584
ours: 560
theirs: 600
- kind: delete-modify
scope: object
layer: actors
object: slime_02
message: modified on ours, deleted on theirs
base:
id: slime_02
x: 240
"y": 280
ours:
components:
patrol:
speed: 30
id: slime_02
x: 240
"y": 280
theirs: null
3D 導航網格
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.navmesh.yaml,如 levels/level1.navmesh.yaml,由場景的 navMesh 引用 |
version: 1 |
navbake3d.Parse、navbake3d.Encode;由 game navmesh 烘焙 |
navbake3d |
version: 1
settings:
cellSize: 0.3
cellHeight: 0.2
minRegionArea: 1
maxEdgeLength: 12
maxSimplificationError: 0.4
maxVertsPerPoly: 6
detailSampleDistance: 1.8
detailSampleMaxError: 0.2
layerMask: 4294967295
meshes:
- agent:
name: humanoid
radius: 0.6
height: 2
maxSlope: 45
maxClimb: 0.9
vertices:
- [0, 0, 0]
- [0, 0, 4]
- [4, 1, 4]
- [4, 1, 0]
- [8, 1, 4]
- [8, 1, 0]
polygons:
- vertices: [0, 1, 2, 3]
detail:
- [2, 0.75, 2]
triangles:
- [0, 1, 4]
- [1, 2, 4]
- [2, 3, 4]
- [3, 0, 4]
- vertices: [3, 2, 4, 5]
triangles:
- [0, 1, 2]
- [0, 2, 3]
烘焙光照探針網格
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.probes.yaml,如 probes/room.probes.yaml,由場景物件的 lightProbeGrid.data 引用 |
version: 1 |
render3d.ParseLightProbeGrid、render3d.EncodeLightProbeGrid、render3d.LoadLightProbeGridFS |
render3d;Schema 為 https://game.nsgo.dev/schemas/lightprobes.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/lightprobes.v1.json
version: 1
boundsMin: [-4, 0, -4]
boundsMax: [4, 4, 4]
counts: [2, 1, 1]
probes:
- sh:
- [0.5, 0.4, 0.3]
- [0.1, 0.05, 0]
- [0, 0, 0]
- [0.15, 0.02, 0.02]
- [0, 0, 0]
- [0, 0, 0]
- [0, 0, 0]
- [0, 0, 0]
- [0, 0, 0]
- sh:
- [0.3, 0.4, 0.5]
- [0.05, 0.05, 0.1]
- [0, 0, 0]
- [-0.02, 0.02, 0.15]
- [0, 0, 0]
- [0, 0, 0]
- [0, 0, 0]
- [0, 0, 0]
- [0, 0, 0]
圖塊集
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.tileset.yaml,如 tilesets/cave.tileset.yaml,由場景的內聯或分層瓦片地圖(tilesetFile)引用 |
version: 1 |
tilemap.ParseTileset、tilemap.EncodeTileset、tilemap.LoadTilesetFS;由 Tilemap.AddTilesetDoc 構建 |
tilemap;Schema 為 https://game.nsgo.dev/schemas/tileset.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/tileset.v1.json
version: 1
name: cave
tileWidth: 16
tileHeight: 16
image: tiles/cave.png
columns: 4
tileCount: 8
terrains:
- name: rock
mode: cardinal
tiles:
- id: 0
solid: true
terrain: rock
- id: 1
solid: true
properties:
friction: 0.5
terrain: rock
neighbors: [east]
- id: 2
shapes:
- kind: polygon
points: [[0, 16], [16, 0], [16, 16]]
- id: 4
animation:
- tile: 4
duration: 200ms
- tile: 5
duration: 200ms
共享資源
| 檔案 |
版本 |
讀寫函式 |
欄位 |
<名稱>.<型別>.yaml,如 stone.material.yaml;type 為 material、curve、gradient、animation、theme、busLayout 或 physicsMaterial |
version: 1 |
resource.Parse、resource.Encode |
resource |
type: material
version: 1
uid: mat0000000004
name: Stone
baseColor: '#8a8f99'
texture: textures/stone.png
opacity: 0.75
blend: multiply
roughness: 0.9
type: curve
version: 1
name: Jump height
keys:
- time: 0
value: 0
interp: smooth
- time: 0.5
value: 1
- time: 1
value: 0
interp: step
type: animation
version: 1
name: Hero walk
length: 0.4
loop: true
tracks:
- property: sprite.frame
frames:
- time: 0
frame: hero_walk_0
- time: 0.1
frame: hero_walk_1
- time: 0.2
frame: hero_walk_2
- time: 0.3
frame: hero_walk_3
events:
- time: 0.1
name: footstep
- time: 0.3
name: footstep
精靈狀態機
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.states.yaml,如 anim/knight.states.yaml |
version: 1 |
animclip.ParseStateMachine、animclip.EncodeStateMachine |
animclip;模式 https://game.nsgo.dev/schemas/states.v1.json |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/states.v1.json
version: 1
name: Knight
entry: idle
parameters:
- name: move.x
type: float
- name: velocity.y
type: float
- name: on_floor
type: bool
default: true
- name: jump
type: trigger
- name: attack
type: trigger
- name: hurt
type: trigger
states:
- name: idle
clip: anim/knight_idle.animation.yaml
x: 40
"y": 230
- name: run
clip: anim/knight_run.animation.yaml
x: 330
"y": 230
- name: jump
clip: anim/knight_jump.animation.yaml
x: 190
"y": 70
- name: fall
clip: anim/knight_fall.animation.yaml
x: 430
"y": 70
- name: attack
clip: anim/knight_attack.animation.yaml
x: 190
"y": 400
- name: hurt
clip: anim/knight_hurt.animation.yaml
x: 430
"y": 400
transitions:
- from: idle
to: run
label: moving
when: '|move.x| > 0.1'
- from: run
to: idle
label: stopped
when: '|move.x| <= 0.1'
- from: idle
to: jump
label: jump pressed, on floor
when: jump && on_floor
- from: run
to: jump
label: jump pressed, on floor
when: jump && on_floor
- from: jump
to: fall
label: falling
when: velocity.y > 0
- from: fall
to: run
label: lands
when: on_floor
- from: idle
to: attack
label: attack pressed
when: attack
- from: run
to: attack
label: attack pressed
when: attack
- from: attack
to: idle
label: clip ends
onEnd: true
- from: '*'
to: hurt
label: took damage
when: hurt
- from: hurt
to: idle
label: clip ends
onEnd: true
粒子發射器
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.particles.yaml / *.emitter.yaml(或遊戲載入的任意 .yaml 檔案,如 sparks.yaml) |
version: 1 |
particles.UnmarshalConfigYAML、particles.MarshalConfigYAML;相同欄位的 JSON 形式用 UnmarshalConfigJSON 和 MarshalConfigJSON |
particles;Schema 為 https://game.nsgo.dev/schemas/particles.v1.json |
version: 1
space: local
shape:
kind: circle
radius: 6
rate: 45
maxParticles: 128
lifetimeMin: 300ms
lifetimeMax: 700ms
speedMin: 20
speedMax: 65
alphaCurve:
- t: 0
value: 1
- t: 1
value: 0
frameNames:
- spark_0
骨骼繫結
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.skel.yaml |
version: 1 |
skeletal.Load、skeletal.Encode |
skeletal |
version: 1
name: waver
bones:
- {name: root}
- {name: arm, parent: root, y: -14, length: 12}
slots:
- {name: arm, bone: arm}
skins:
default:
arm: {frame: arm, originX: 3, originY: 2}
animations:
wave:
duration: 0.8
loop: true
bones:
arm:
rotate:
- {time: 0, angle: 0.4}
- {time: 0.4, angle: -0.4}
- {time: 0.8, angle: 0.4}
過場動畫
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.cutscene.yaml(或遊戲載入的任意 .yaml 檔案),如 cutscenes/floor1_intro.cutscene.yaml |
version: 1(影片)、version: 2(影片或時間軸) |
cutscene.Parse、cutscene.Encode |
cutscene |
version: 1
source: asset:cutscenes/intro.mp4
group: cutscenes
skippable: true
skipAfter: 1.5s
fit: cover
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/cutscene.v2.json
version: 2
kind: timeline
scene: scenes/level_01.scene.yaml
length: 12s
skippable: true
skipAfter: 1s
tracks:
- id: camera
name: Camera
kind: camera
clips:
- id: cam1
start: 0s
duration: 1.6s
easing: hold
action: hold
target: door
- id: cam2
start: 1.6s
duration: 2.4s
easing: easeInOut
action: pan
target: knight
- id: cam3
start: 4s
duration: 8s
action: follow
target: knight
- id: knight
name: Knight
kind: actor
target: knight
clips:
- id: kn1
start: 1s
duration: 2.4s
easing: easeOut
action: walk
fromX: 60
toX: 220
state: run
- id: kn2
start: 3.4s
duration: 4.6s
action: state
state: idle
- id: dialogue
name: Dialogue
kind: dialogue
clips:
- id: dl1
start: 3.6s
duration: 2.4s
line: intro.knight.01
- id: sfx
name: Sound
kind: sound
group: sfx
clips:
- id: sx1
start: 200ms
duration: 600ms
source: audio/door_slam.wav
- id: music
name: Music
kind: music
group: music
clips:
- id: mu1
start: 2s
duration: 10s
source: audio/cellar_theme.ogg
fadeIn: 2s
房間地圖
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 castle.rooms.yaml |
version: 1 |
rooms.Parse、rooms.Encode |
rooms |
version: 1
transition:
kind: slide
duration: 300ms
rooms:
- id: entrance
x: 0
"y": 0
width: 320
height: 180
- id: hall
x: 320
"y": 0
width: 640
height: 180
transition:
kind: fade
color: '#102030'
世界地圖
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 castle.yaml |
version: 1 |
worldmap.Parse、worldmap.Encode |
worldmap |
version: 1
rooms:
- id: entrance
name: Castle Gate
x: 0
"y": 0
width: 320
height: 180
links: [hall]
- id: hall
name: Great Hall
x: 320
"y": 0
width: 320
height: 180
markers:
- id: save-gate
kind: save
room: entrance
x: 40
"y": 90
label: Gate shrine
卡牌桌面
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 board.yaml |
version: 1 |
cards.ParseBoardDoc、cards.EncodeBoardDoc |
cards |
version: 1
card_size:
w: 63
h: 88
slots:
- id: hand
rect:
x: 40
"y": 400
w: 560
h: 120
layout:
fan:
arc: 24
sag: 14
遊戲資料
資料表
| 檔案 |
版本 |
讀寫函式 |
欄位 |
.yaml 或 .yml,如 weapons.yaml;也能載入 .csv 和 .json 匯出檔案,它們沒有版本 |
version: 1 |
datatable.LoadYAML、datatable.MarshalYAML;datatable.LoadFile 按副檔名選擇讀取方式 |
datatable;Schema 用 datatable.Schema 按行型別生成 |
version: 1
rows:
- id: sword
damage: 12
cooldown: 400ms
tags: [melee]
- id: bow
damage: 8
cooldown: 1s
tags: [ranged, two-handed]
屬性
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 hero.yaml |
version: 1 |
stats.Parse、stats.Encode |
stats |
version: 1
stats:
- name: health
base: 100
min: 0
- name: attack
base: 12
effects:
- name: berserk
steps: 300
modifiers:
- stat: attack
op: mul
value: 1.5
技能集
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 hero.abilities.yaml |
version: 1 |
ability.Parse、ability.Encode |
ability |
version: 1
abilities:
- id: fireball
name: ability.fireball
action: cast
costs:
- resource: mana
amount: 20
cooldown: 2s
castTime: 500ms
conditions: [grounded, '!silenced']
- id: dash
action: dash
cooldown: 250ms
charges: 3
recharge: 4s
物品目錄
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 items.yaml |
version: 1 |
inventory.Parse、inventory.Catalog.Encode |
inventory |
version: 1
items:
- id: potion
name: items.potion.name
icon: asset:icons/potion.png
maxStack: 20
tags: [consumable, healing]
stats:
heal: 25
- id: iron-helm
name: items.iron-helm.name
equip: head
stats:
armor: 3
任務書
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 village.yaml |
version: 1 |
quest.Parse、quest.Encode |
quest |
version: 1
quests:
- id: welcome
title: quest.welcome.title
autoStart: true
objectives:
- id: meet-elder
kind: talk
target: elder
- id: herbs
title: quest.herbs.title
requires: [welcome]
objectives:
- id: moonleaf
kind: collect
target: moonleaf
count: 4
rewards:
- kind: xp
id: xp
amount: 20
掉落表
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 chest.yaml |
version: 1 |
loot.Parse、loot.Encode |
loot |
version: 1
tables:
- name: chest
rolls:
min: 1
max: 3
entries:
- item: sword
weight: 2.5
- nothing: true
weight: 6.5
成就
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲嵌入的任意 .yaml 檔案,如 achievements.yaml |
version: 1 |
achievements.Parse、achievements.Encode |
achievements |
version: 1
achievements:
- id: gem-collector
title: Gem Collector
description: Clear 500 gems.
steps: 500
platforms:
gameCenter: dev.nsgo.test.gem_collector
playGames: CgkIabc123EAIQAg
排行榜
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲嵌入的任意 .yaml 檔案,如 leaderboards.yaml |
version: 1 |
leaderboard.Parse、leaderboard.Catalog.Encode |
leaderboard |
version: 1
leaderboards:
- name: high-score
gameCenter: dev.nsgo.game.example.high_score
playGames: CgkI6v7z8vQREAIQAQ
招式集
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 moves.yaml |
version: 1 |
fighting.Parse、fighting.Encode |
fighting |
version: 1
input:
up: up
down: down
left: left
right: right
moves:
- name: lp
press:
- lp
- name: hadoken
motion:
- "2"
- "3"
- "6"
window: 12
press:
- lp
buffer: 8
priority: 20
幀資料
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 fighter.yaml |
version: 1 |
framedata.Parse、framedata.Encode |
framedata |
version: 1
moves:
- name: idle
animation: idle
length: 8
loop: true
boxes:
- kind: hurt
start: 1
end: 8
x: -12
"y": -80
width: 24
height: 80
平臺跳躍控制器
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 hero.yaml |
version: 1 |
platformer.ParseConfig、platformer.EncodeConfig |
platformer |
version: 1
coyote_time: 100ms
jump_buffer: 100ms
jump_speed: 284
jump_cut: 0.55
jump_cut_min_speed: 110
gravity: 720
max_fall_speed: 320
run_speed: 98
ground_accel: 960
ground_decel: 1150
air_accel: 680
wall_slide_speed: 60
wall_coyote_time: 80ms
wall_jump_speed_x: 150
wall_jump_speed_y: 260
wall_jump_lock: 150ms
載具
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 car.yaml |
version: 1 |
vehicle.ParseConfig、vehicle.EncodeConfig |
vehicle |
version: 1
name: kart
mass: 300
chassisHalfExtents: [0.6, 0.2, 1]
chassisOffset: [0, 0, 0]
engineForce: 2000
reverseForce: 0
maxSpeed: 20
maxReverseSpeed: 5
brakeForce: 4000
handbrakeGrip: 0
maxSteerAngle: 25
steerRate: 90
drag: 0
rollingResistance: 0
rollInfluence: 0
angularDamping: 0
wheels:
- name: front
anchor: [0, -0.1, -0.8]
radius: 0.25
restLength: 0.2
stiffness: 20000
damping: 2000
maxForce: 10000
friction: 1.2
steer: true
brake: true
- name: rear
anchor: [0, -0.1, 0.8]
radius: 0.25
restLength: 0.2
stiffness: 20000
damping: 2000
maxForce: 10000
friction: 1.2
drive: true
brake: true
彈幕模式
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 patterns.yaml |
version: 1 |
bullets.Parse、bullets.Encode |
bullets |
version: 1
patterns:
- name: bloom
kind: ring
frame: orb
count: 24
speed: 90
spin: 7.5
shots: 6
interval: 400ms
lifetime: 6s
radius: 4
陣型
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 formations.yaml |
version: 1 |
rts.ParseFormations、rts.Formations.Encode |
rts |
version: 1
formations:
- name: line
shape: line
spacing: 1.5
- name: wedge
shape: wedge
spacing: 1.5
效用 AI
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 guard.utility.yaml |
version: 1 |
ai.ParseUtility、ai.EncodeUtility |
ai |
version: 1
momentum: 0.1
actions:
- name: attack
weight: 1.2
considerations:
- name: target_close
input: target_distance
max: 200
curve:
kind: linear
slope: -1
shiftY: 1
- name: healthy
input: health_ratio
curve:
kind: logistic
slope: 1
exponent: 10
shiftX: 0.35
- name: heal
weight: 1.1
considerations:
- name: low_health
input: health_ratio
curve:
kind: polynomial
slope: -1
exponent: 2
shiftY: 1
- name: has_potion
input: potion_count
curve:
kind: step
slope: 1
shiftX: 0.5
GOAP 動作集
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 camp.goap.yaml |
version: 1 |
ai.ParseGOAP、ai.EncodeGOAP |
ai |
version: 1
nodeBudget: 512
facts:
bools:
- has_axe
- has_fire
ints:
- wood
actions:
- name: fetch_axe
cost: 1
check: axe_available
effects:
bools:
- fact: has_axe
value: true
- name: chop_wood
cost: 1
preconditions:
bools:
- fact: has_axe
value: true
effects:
ints:
- fact: wood
op: add
value: 1
- name: gather_sticks
cost: 3
effects:
ints:
- fact: wood
op: add
value: 1
- name: build_fire
cost: 1
preconditions:
ints:
- fact: wood
op: gte
value: 2
effects:
bools:
- fact: has_fire
value: true
ints:
- fact: wood
op: add
value: -2
goals:
- name: light_campfire
priority: 10
target:
bools:
- fact: has_fire
value: true
行為樹
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.bt.yaml,如 guard.bt.yaml |
version: 1 |
ai.ParseBehaviorTree、ai.EncodeBehaviorTree、ai.LoadBehaviorTreeFS、ai.BuildBehaviorTree |
ai · schema |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/bt.v1.json
version: 1
name: guard
blackboard:
- key: enemy_seen
type: bool
default: false
- key: enemy_distance
type: float
default: 999
root:
type: selector
children:
- type: blackboard_condition
key: enemy_seen
op: eq
value: true
abort: both
child:
type: selector
children:
- type: blackboard_condition
key: enemy_distance
op: lte
value: 32
abort: both
child:
type: cooldown
duration: 500ms
child:
type: action
action: attack
params:
damage: 15
- type: action
action: chase
params:
speed: 120
- type: subtree
path: patrol.bt.yaml
params:
wait: 200ms
keys:
home: home_pos
導航網格
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 crypt.navmesh.yaml,通常每個關卡、每種代理一個 |
version: 1 |
navbake.Parse、navbake.Mesh.Encode |
navbake |
version: 1
agent: small
radius: 2
polygons:
- [[2.0078125, 2.0078125], [37.992188, 2.0078125], [37.992188, 17.992188], [19.601562, 17.992188]]
- [[2.0078125, 2.0078125], [19.601562, 17.992188], [18.863281, 18.296875]]
- [[2.0078125, 2.0078125], [18.863281, 18.296875], [18.296875, 18.863281]]
- [[2.0078125, 2.0078125], [18.296875, 18.863281], [17.992188, 19.601562]]
- [[2.0078125, 2.0078125], [17.992188, 19.601562], [17.992188, 37.992188], [2.0078125, 37.992188]]
圖塊規則
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 ruins.yaml |
version: 1 |
procgen.ParseRules、procgen.EncodeRules |
procgen |
version: 1
tiles:
- name: floor
weight: 6
walkable: true
- name: water
weight: 2
neighbors:
- left: floor
right: floor
- left: floor
right: water
- left: water
right: floor
- left: water
right: water
- up: floor
down: floor
- up: floor
down: water
- up: water
down: floor
- up: water
down: water
地牢房間模板
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 rooms.yaml |
version: 1 |
procgen.ParseRoomTemplates、procgen.EncodeRoomTemplates |
procgen |
version: 1
rooms:
- id: start_hub
weight: 1
tags:
- start
doors:
- side: north
offset: 3
- side: south
offset: 3
- side: east
offset: 2
- side: west
offset: 2
tiles:
- '###.###'
- '#.....#'
- '.......'
- '#.....#'
- '###.###'
- id: boss_vault
tags:
- goal
width: 7
height: 5
source: rooms/boss_vault.tmj
doors:
- side: north
offset: 3
- side: south
offset: 3
- side: east
offset: 2
- side: west
offset: 2
視覺小說角色表
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 cast.yaml |
version: 1 |
vn.ParseCast、vn.EncodeCast |
vn |
version: 1
slots:
- name: left
x: 0.25
characters:
- id: aiko
name: Aiko
color: '#e07a5f'
slot: left
defaultExpression: neutral
expressions:
- name: neutral
frame: aiko_neutral
- name: smile
frame: aiko_smile
節拍圖
| 檔案 |
版本 |
讀寫函式 |
欄位 |
曲目旁邊的 .yaml 檔案,如 opening.beatmap.yaml |
version: 1 |
rhythm.ParseBeatMap、rhythm.EncodeBeatMap |
rhythm |
version: 1
title: Opening
offsetMs: 120
tempos:
- beat: 0
bpm: 120
- beat: 62.5
bpm: 140
meters:
- beat: 0
beatsPerBar: 4
數字區域設定
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 de.yaml |
version: 1 |
idle.ParseLocale、idle.EncodeLocale |
idle |
version: 1
name: de
decimal: ','
group: .
exponent: E
units:
- exp: 3
suffix: ' Tsd.'
- exp: 6
suffix: ' Mio.'
畫質預設
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲載入的任意 .yaml 檔案,如 quality.yaml |
version: 1 |
quality.ParseConfig、quality.EncodeConfig |
quality |
version: 1
presets:
low:
resolution_scale: 0.5
particle_scale: 0.25
effects: false
shadows: false
medium:
resolution_scale: 0.75
particle_scale: 0.6
effects: true
shadows: false
high:
resolution_scale: 1
particle_scale: 1
effects: true
shadows: true
devices:
- model: Samsung SM-A
os: android
level: low
adapt:
target_fps: 30
window_frames: 120
upgrade_windows: 3
伺服器
賬號服務
| 檔案 |
版本 |
讀寫函式 |
欄位 |
accounts.yaml,傳給 accountsd -config |
version: 1 |
accounts.ParseConfig、accounts.Config.Marshal |
accounts |
version: 1
issuer: https://accounts.example.com
audience: my-game
tokenTTL: 1h30m30s
disableGuests: true
password:
minLength: 10
argon2id:
time: 2
memoryKiB: 19456
threads: 1
令牌金鑰集
| 檔案 |
版本 |
讀寫函式 |
欄位 |
keys.yaml,由 accountsd genkey 寫出 |
version: 1 |
token.ParseKeySet、token.KeySet.Marshal |
accounts |
version: 1
issuer: https://accounts.example.com
audience: my-game
keys:
- id: 2317febd373fcbcd
key: hze+0cYruVRddgjkbHzgCeWWJbEsBkn6K8JNHRDf6Wg=
雲存檔服務
| 檔案 |
版本 |
讀寫函式 |
欄位 |
cloudsave.yaml,傳給 cloudsaved -config |
version: 1 |
cloudsave.ParseConfig、cloudsave.Config.Marshal |
cloudsave |
version: 1
maxSlotBytes: 1048576
maxSlots: 32
keepVersions: 5
allowedOrigins:
- https://play.example.com
排行榜服務
| 檔案 |
版本 |
讀寫函式 |
欄位 |
leaderboards.yaml,傳給 leaderboardd -config |
version: 1 |
selfhost.ParseConfig、selfhost.Config.Marshal |
leaderboard/selfhost |
version: 1
proofTTL: 10m
boards:
- name: high-score
order: descending
reset: allTime
- name: weekly-sprint
order: ascending
reset: weekly
weekStart: sunday
keep: 4
程式寫出的 YAML 檔案
這些檔案由程式寫給自己用,但出於同樣的理由也是 YAML:人能讀懂它、在評審中看它的 diff,必要時還能編輯它。
編輯器檢視狀態
| 檔案 |
版本 |
讀寫函式 |
欄位 |
.game/editor.yaml(editor.ViewStateFile) |
version: 1 |
編輯器(Editor.SaveViewState,以及開啟場景時) |
編輯器 |
scenes 列出編輯器顯示過的每個場景,按 path 排序,path 是場景檔案相對專案根目錄、以斜槓分隔的路徑。camera3D 是該場景上次被切走、儲存或關閉時 3D 視口的相機:注視點 target、以弧度表示的 yaw 與 pitch、到注視點的距離 distance、以弧度表示的垂直視場角 fov、近裁剪面 near 與遠裁剪面 far,以及設定時的 orthographic。可選的 snap 儲存該專案的編輯器吸附偏好(grid、gridSize、pixel、rotation、rotationStepDeg、scale、scaleStep、showGrid),各項均為預設值時省略。同一場景列出兩次、專案外的路徑、負數的吸附步長和非有限的數值都會被拒絕;無法解析的檔案會被重新寫出,而 version 更高的檔案保持原樣。含有非有限數值的相機會以預設相機儲存。
version: 1
scenes:
- path: levels/courtyard.scene.yaml
camera3D:
target: [12, 0, -40]
yaw: 0.61
pitch: 0.49
distance: 320
fov: 1.0471976
near: 0.5
far: 10000
orthographic: true
編輯器最近開啟的專案
| 檔案 |
版本 |
讀寫函式 |
欄位 |
使用者配置目錄中的 recent-projects.yaml(<UserConfigDir>/nsgo-game/recent-projects.yaml,位於任何專案之外) |
version: 1 |
editor.ParseRecentProjects、editor.EncodeRecentProjects |
編輯器與場景格式 |
version: 1
projects:
- name: Dungeon Run
path: /Users/alex/games/dungeon-run
lastOpened: "2026-11-25T05:00:00Z"
- name: Kart Test
path: /Users/alex/games/kart-test
lastOpened: "2026-11-24T12:30:00Z"
編輯器智慧體執行緒
| 檔案 |
版本 |
讀寫函式 |
欄位 |
.nsgo/threads/<id>.yaml(editor.AgentThreadsDir,由 .nsgo/.gitignore 忽略) |
version: 1 |
editor.ParseAgentThreadYAML、editor.EncodeAgentThreadYAML |
編輯器;Schema 為 https://game.nsgo.dev/schemas/agent-thread.v1.json |
每條工作線對應一個嚴格版本化的 YAML 檔案,記錄 id、title(由首條請求自動命名)、scenePath(為空表示“專案 · 無場景”執行緒)、sessionId(便於後續請求延續同一外部智慧體會話)、RFC3339 時間戳以及按時間順序排列的 requests(包含 steps、審查結果 outcome(pending、kept、reverted)、修改計數、受影響的 objects 與 historyStep 引用)。
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/agent-thread.v1.json
version: 1
id: door-lever-pulls
title: Door opens after two lever pulls
scenePath: scenes/level_01.scene.yaml
sessionId: sess_claude_01
createdAt: "2026-11-26T13:40:00Z"
updatedAt: "2026-11-26T14:18:00Z"
requests:
- id: req-001
title: Door opens after two lever pulls
prompt: Keep the door shut until the lever is pulled twice, then let it open.
createdAt: "2026-11-26T13:40:00Z"
updatedAt: "2026-11-26T13:41:00Z"
outcome: kept
changesTotal: 3
changesKept: 3
files:
- prefabs/door.prefab.yaml
- scenes/level_01.scene.yaml
objects:
- Door
- lever_01
detail: Door.locked, Door.opens_after_pulls, lever_01.pulls
historyStep: 'Agent: Door opens after two lever pulls'
historyIndex: 1
steps:
- id: step-001
label: Read level_01.scene.yaml and door.prefab.yaml
status: done
編輯器回合檢查點
| 檔案 |
版本 |
讀寫函式 |
欄位 |
.nsgo/checkpoints/<id>/manifest.yaml(editor.CheckpointsDir、editor.CheckpointManifestFile),寫入前的原始檔案內容按原樣儲存在 .nsgo/checkpoints/<id>/files/<path> 下並由 Git 忽略 |
version: 1 |
editor.ParseCheckpointManifest、editor.EncodeCheckpointManifest、Editor.BeginCheckpointTurn、Editor.RestoreCheckpoint |
編輯器與場景格式 |
每個智慧體回合、自主任務或自動化在首次寫入任何專案檔案之前都會記錄其原始位元組(場景、預製體、資料表、game.yaml、Go 程式碼與二進位制媒體一視同仁)。files 按相對專案根目錄的斜槓路徑 path 排序。當 existed 為 true 時,size 與 sha256 描述儲存在 files/<path> 下的原始位元組,非預設許可權通過 4 位八進位制 mode 記錄;當 existed 為 false 時,恢復操作會刪除該回合新建的檔案。容量上限(Editor.CheckpointMaxBytes,預設 128 MiB)會自動清理最舊的已完成檢查點。
version: 1
id: 20261126T144100Z-0001
createdAt: "2026-11-26T14:41:00Z"
who: agent
kind: turn
title: Coin spin, bob and sparkle
detail: 2 files
files:
- path: fx/sparkle.particles.yaml
existed: false
- path: prefabs/coin.prefab.yaml
existed: true
size: 142
sha256: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
- path: scenes/level_01.scene.yaml
existed: true
size: 512
sha256: fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210
編輯器面板佈局
| 檔案 |
版本 |
讀寫函式 |
欄位 |
使用者配置目錄中的 layout.yaml(<UserConfigDir>/nsgo-game/layout.yaml,位於任何專案之外) |
version: 1 |
editor.ParseLayout、editor.EncodeLayout、Editor.SetLayoutPath |
編輯器與場景格式 |
按使用者跨會話儲存編輯器可停靠面板的排布:center(包含 viewport 及停靠在其旁的面板的標籤組或分割樹)、可選的 left、right 與 bottom 停靠區(各自包含以點為單位的 size、可選的 closed 以及 root),以及可選的已排序 hidden 面板鍵列表。每個節點要麼是標籤組(panels 與可選的當前標籤索引 active),要麼是分割節點(axis 為 "horizontal" 或 "vertical"、可選的 sizes 點數陣列與 children)。內建面板鍵包括 viewport、scene_tree、layers、assets、files、library、inspector、problems、output、profiler、animation、search、states、tileset、terrain、rig、particles、material、environment、datatable、navmesh 與 localization;外掛面板鍵使用 plugin:<plugin>:<id>。未知欄位、重複鍵、重複面板條目與不支援的版本均會被拒絕;啟動恢復時不再存在的面板會被自動丟棄。
version: 1
center:
panels:
- viewport
left:
size: 444
root:
axis: horizontal
sizes: [220, 224]
children:
- axis: vertical
sizes: [0, 200]
children:
- panels:
- scene_tree
- panels:
- layers
- axis: vertical
children:
- panels:
- assets
- panels:
- files
- inspector
active: 1
bottom:
size: 164
root:
panels:
- problems
- output
hidden:
- layers
資源構建快取
| 檔案 |
版本 |
讀寫函式 |
欄位 |
.game/assets-cache.yaml,或 game.yaml 中 assets.cache 指定的路徑 |
version: 1 |
game assets |
命令列 |
version: 1
targets:
- target: atlas:ui
key: 3f79bb7b435b05321651daefd374cdc681dc06faa65e374e38337b88ca046dea
outputs:
- path: assets/atlases/ui.json
sha256: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
- path: assets/atlases/ui.png
sha256: 60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752
基準測試基線
| 檔案 |
版本 |
讀寫函式 |
欄位 |
benchmarks/baseline.yaml,由 game bench -update 寫出 |
version: 1 |
bench.Decode、bench.Baseline.Encode |
命令列 |
version: 1
note: Update with nsgo game bench -update.
max_regression_pct: {ns_per_op: 25, bytes_per_op: 30, allocs_per_op: 12.5}
benchmarks:
BenchmarkBatchDraw1000: {ns_per_op: 3500000, bytes_per_op: 80128, allocs_per_op: 1000}
BenchmarkRaycast: {ns_per_op: 420.5, bytes_per_op: 0, allocs_per_op: 0}
成就進度
| 檔案 |
版本 |
讀寫函式 |
欄位 |
core.Storage 中的一個鍵,由 achievements.Tracker.Persist 維護 |
version: 1 |
achievements.ParseProgress、achievements.EncodeProgress |
achievements |
version: 1
achievements:
- id: first-match
steps: 1
- id: gem-collector
steps: 120
reported:
gameCenter: 120
playGames: 100
延遲校準
| 檔案 |
版本 |
讀寫函式 |
欄位 |
core.Storage 中的一個鍵,由 rhythm.OffsetStore 維護 |
version: 1 |
rhythm.ParseCalibrations、rhythm.EncodeCalibrations |
rhythm |
version: 1
devices:
android/Google Pixel 8:
audioMs: 41.25
videoMs: -3
輸入錄製
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.replay.yaml,由 replay.Recorder 寫出 |
version: 2 |
replay.Decode、replay.Recording.Encode |
replay |
version: 2
seed: 99537266
rate: 60
actions: [left, right, jump]
axes: [move_x]
total_steps: 140
steps:
- {step: 6, press: [right], axes: {move_x: 1}}
- {step: 85, press: [jump]}
- {step: 95, release: [jump]}
- {step: 130, release: [right], axes: {move_x: 0}}
幽靈圈
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.ghost.yaml,由 vehicle.GhostRecorder 的錄製結果寫出 |
version: 1 |
vehicle.ParseGhost、vehicle.EncodeGhost |
vehicle |
version: 1
name: reference lap
rate: 60
interval: 2
lapSteps: 2
frames:
- p: [0, 0.5, 0]
r: [0, 0, 0, 1]
- p: [0, 0.5, 1.25]
r: [0, 0.0499792, 0, 0.99875]
撤銷日誌
| 檔案 |
版本 |
讀寫函式 |
欄位 |
| 遊戲存放它的任何地方,如存檔槽;其中的操作是遊戲自己的操作型別 |
version: 1 |
undo.DecodeLog、undo.EncodeLog |
undo |
version: 1
applied: 2
moves:
- dir: right
- dir: down
- dir: down
狀態轉儲
| 檔案 |
版本 |
讀寫函式 |
欄位 |
*.state.yaml,由 statedump.WriteFile 寫出 |
version: 1 |
statedump.Parse、statedump.Encode |
statedump |
version: 1
seed: 42
rate: 60
steps: 90
scene:
depth: 1
current: level
values:
score: 40
entities:
- index: 0
generation: 1
components:
- type: pos
data:
x: 4
y: 12
試玩配置
| 檔案 |
版本 |
讀寫函式 |
欄位 |
playtest.yaml,由 nsgo game playtest 與 game_playtest 讀取 |
version: 1 |
playtest.ParseConfig、playtest.EncodeConfig |
playtest |
# yaml-language-server: $schema=https://game.nsgo.dev/schemas/playtest.v1.json
version: 1
scope:
project: dungeon-run
scene: level_01
template: platformer2d
runs:
count: 20
seedStart: 1
rate: 60
speed: 1
maxDuration: 1m30s
bot:
profile: platformer-runner
reactionMin: 120ms
reactionMax: 220ms
metrics:
- name: finished
label: Finished
measure:
kind: outcome
key: finished
aggregate: count
goal:
summary: most first-timers clear floor 1
source: brief.yaml
min: 16
- name: deaths
label: Deaths
measure:
kind: event
key: death
aggregate: sum
heatMap: true
試玩報告
| 檔案 |
版本 |
讀寫函式 |
欄位 |
playtest.report.yaml,由 nsgo game playtest 與 playtest.SaveReportFile 寫出 |
version: 1 |
playtest.ParseReport、playtest.EncodeReport |
playtest |
version: 1
scope:
project: dungeon-run
scene: level_01
bot:
profile: platformer-runner
reactionMin: 120ms
reactionMax: 220ms
rate: 60
speed: 1
seedCount: 1
passed: false
metrics:
- name: finished
label: Finished
aggregate: count
value: 0
goal:
summary: most first-timers clear floor 1
source: brief.yaml
min: 1
status: missed
heatMaps:
- metric: deaths
event: death
points:
- seed: 1
step: 140
x: 300
"y": 144
tag: slime_pit
runs:
- index: 1
seed: 1
outcome: failed
reason: out of lives
steps: 140
durationSeconds: 2.3333333333333335
recording: recordings/run_001_seed_1.replay.yaml
events:
- kind: death
step: 140
timeSeconds: 2.3333333333333335
x: 300
"y": 144
tag: slime_pit
瓦片地圖分塊
| 檔案 |
版本 |
讀寫函式 |
欄位 |
chunk_<x>_<y>.yaml(或 .json),由 tilemap.DirChunkStore 及 tilemap.EncodeChunkYAML / EncodeChunkJSON 寫出 |
version: 1 |
tilemap.DecodeChunkYAML、tilemap.EncodeChunkYAML、tilemap.DecodeChunkJSON、tilemap.EncodeChunkJSON |
tilemap |
version: 1
x: -2
"y": 1
size: 4
runs:
- 0*5
- "1"
- "2147483650"
- 3*4
- 0*5
JSON 檔案
這些格式是 JSON:大多由程式寫給自己用,其餘是與其他服務和工具交換的資料。各自的指南給出了它們的欄位。
存檔槽
| 檔案 |
版本 |
讀寫函式 |
欄位 |
目錄中的 <槽>.json 和 <槽>.json.bak,或 core.Storage 中的一個鍵 |
外層封裝的 version,即遊戲自己的資料結構版本,由其遷移函式逐級升級 |
save.Store.Save、save.Store.Load |
save |
{"version":2,"data":{"level":4,"coins":120,"name":"Ann"}}
data 存放遊戲自己的值,即 encoding/json 寫出的內容,例如一個包含 quest.Snapshot 和背包快照的結構體。
玩家設定
| 檔案 |
版本 |
讀寫函式 |
欄位 |
存檔後端中的 settings 槽(如 settings.json)或 core.Storage 中的一個鍵,與存檔槽分開 |
外層封裝的 version,由設定儲存的遷移函式逐級升級 |
save.SettingsStore |
save.Settings:audio、bindings、display、locale、accessibility 和 custom,或遊戲自己的型別 |
{"version":1,"data":{"audio":{"master":1,"groups":{"music":1,"sfx":1,"ui":1},"muted":false},"bindings":{"jump":["Space"]},"display":{"fullscreen":false,"display_index":0,"scale_mode":"fit","integer_scale":false,"frame_cap":0,"vsync":true,"auto_drop_low_power":true,"quality":"auto"},"locale":"en","accessibility":{"captions":false,"caption_scale":1,"color_blind_mode":"none","reduce_motion":false,"high_contrast":false,"screen_shake":1,"game_speed":1}}}
世界地圖探索狀態
| 檔案 |
版本 |
讀寫函式 |
欄位 |
| 存檔槽內 |
version: 1 |
worldmap.State 的 JSON 形式 |
worldmap |
{"version":1,"current":"hall","visited":["cave","hall"],"revealed":["crypt"],"markers":[{"id":"m1","kind":"pin","room":"hall","x":12,"y":4,"label":"Key"}]}
任務進度
| 檔案 |
版本 |
讀寫函式 |
欄位 |
| 存檔槽內,JSON 或 YAML 形式 |
version: 1 |
quest.Log.Snapshot、quest.Log.Restore |
quest |
{"version":1,"quests":[{"id":"find-key","state":"active","progress":{"rats":3}},{"id":"intro","state":"completed"}]}
state 為 active、completed、failed 或 abandoned;尚未開始的任務不寫出,沒有進度的目標也不寫出。
戰爭迷霧
| 檔案 |
版本 |
讀寫函式 |
欄位 |
| 存檔槽內 |
version: 1 |
fog.Fog 的 JSON 形式 |
fog |
{"version":1,"width":3,"height":2,"tileWidth":8,"tileHeight":8,"opaque":[".#.","..."],"nextSource":2,"sources":[{"id":1,"team":2,"col":2,"row":1,"radius":1},{"id":2,"team":1,"col":0,"row":0,"radius":0}],"teams":[{"team":1,"explored":["#..","..."]},{"team":2,"explored":[".##",".##"]}]}
世界快照
| 檔案 |
版本 |
讀寫函式 |
欄位 |
存檔槽內;只包含用 RegisterCodec 註冊過的元件 |
無 |
entities.World.Snapshot、entities.World.Restore |
entities |
{"entities":[{"index":0,"generation":1,"components":[{"type":"health","data":{"hp":10}},{"type":"position","data":{"x":3,"y":4}}]},{"index":1,"generation":1,"components":[{"type":"position","data":{"x":-1,"y":0.5}}]}]}
type 是元件的編解碼器用 RegisterCodec 註冊時的名稱,data 是 encoding/json 寫出的元件。
輸入繫結
| 檔案 |
版本 |
讀寫函式 |
欄位 |
core.Storage 中的一個鍵 |
version: 1 |
input.Actions.Save、input.Actions.Load |
input |
{"version":1,"actions":{"fire":[{"kind":"mouse_button","button":"left"}],"jump":[{"kind":"key","key":"space"},{"kind":"gamepad_button","button":"south"}]},"axes":{"move_x":{"negative":"left","positive":"right"}}}
控制台可調引數
| 檔案 |
版本 |
讀寫函式 |
欄位 |
core.Storage 中的一個鍵,預設為 debug.console.tunables |
無 |
debug.Console.SaveTunables、debug.Console.LoadTunables |
以各引數名為鍵、引數值為值的物件 |
{"cheat.god":false,"level.name":"cave_1","player.lives":3,"player.speed":1.5}
引數名是遊戲用 RegisterFloat、RegisterInt、RegisterBool 和 RegisterString 註冊的名稱;LoadTunables 跳過沒有註冊的名稱,拒絕超出範圍或 JSON 型別不符的值,且只要拒絕其中一個值,就一個值也不應用。
開發會話快照
| 檔案 |
版本 |
讀寫函式 |
欄位 |
一個檔案或 core.Storage 中的一個鍵,遊戲重新構建後從中恢復狀態 |
狀態 Go 型別的雜湊,型別變化時跳過恢復 |
devstate.Store.Save、devstate.Store.LoadSnapshot |
devstate.SessionSnapshot |
{"scene_id":"level-1","schema_hash":"90b889efbda2b1fbe5fd7122b8919ac57b14cef258a4a60664a39e4ee3caee5b","loop_tick":1200,"loop_elapsed":20000000000,"payload":"eyJsZXZlbCI6Mn0=","saved_at":"2026-11-24T09:15:02Z"}
payload 是 encoding/json 寫出的遊戲狀態,以 base64 編碼;loop_elapsed 的單位是納秒。
雲存檔載荷
| 檔案 |
版本 |
讀寫函式 |
欄位 |
平臺雲端儲存中的 <字首><槽>.json,如 save.main.json |
version: 1 |
liveops.EncodeCloudSave、liveops.DecodeCloudSave |
liveops |
{
"format": "nsgo-cloud-save",
"version": 1,
"revision": 3,
"hash": "sha256:b30e459ab9ad862b330d89d42e3422a3e3193071345b1de6b9e4038b27f2ee01",
"modified": "2026-11-24T09:15:02Z",
"device": "phone-1",
"data": "{\"version\":2,\"data\":{\"level\":4}}"
}
hash 是存檔位元組的 SHA-256;存檔位元組是 UTF-8 時以文本存放在 data 中,否則以 base64 存放在 data_base64 中。
雲同步狀態
| 檔案 |
版本 |
讀寫函式 |
欄位 |
core.Storage 中每個槽一個鍵 <StateKey>.<槽>,如 liveops.cloudsync.main |
version: 1 |
liveops.CloudSyncer,僅供其自身使用 |
liveops |
{"version":1,"revision":3,"hash":"sha256:b30e459ab9ad862b330d89d42e3422a3e3193071345b1de6b9e4038b27f2ee01","local_modified":"2026-11-24T09:15:02Z","local_hash":"sha256:b30e459ab9ad862b330d89d42e3422a3e3193071345b1de6b9e4038b27f2ee01"}
它記錄上次同步後兩端共有的雲端修訂號和內容雜湊,以及本裝置上次寫入本地副本的時間。
排行榜記錄
{"account":"3f9a...","score":4200,"achieved":"2026-11-24T09:15:02.5Z"}
字串表
| 檔案 |
版本 |
讀寫函式 |
欄位 |
每種語言一個 .json 檔案,可以是扁平、巢狀或帶 CLDR 複數形式的 |
無 |
l10n.Catalog.LoadJSON |
l10n |
{
"menu": {"play": "Play"},
"hud": {"score": "Score: {score}"},
"coins": {"zero": "No coins", "one": "{count} coin", "other": "{count} coins"}
}
片段事件
| 檔案 |
版本 |
讀寫函式 |
欄位 |
模型旁邊的 JSON 旁註檔案,或 glTF 動畫的 extras |
旁註檔案中為 version: 1 |
anim3d.LoadEventsSidecar、anim3d.MarshalEventsSidecar、anim3d.LoadEventsFromGLTFExtras |
anim3d、從 Blender 匯入 3D 模型 |
{
"version": 1,
"clips": {
"attack": [
{
"time": 0.4,
"name": "hit",
"data": {
"damage": 12
}
}
],
"run": [
{
"time": 0.25,
"name": "footstep",
"payload": "left"
},
{
"time": 0.75,
"name": "footstep",
"payload": "right"
}
]
}
}
DLC 包清單
| 檔案 |
版本 |
讀寫函式 |
欄位 |
遊戲下載的 .json 檔案,列出可以安裝的包 |
無;每個包有自己的 version |
assets.ParsePackManifest |
assets |
{"packs": [{"id": "forest", "url": "https://cdn.example.com/forest.zip", "version": "1.0.0", "sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"}]}
WebAssembly 體積預算
| 檔案 |
版本 |
讀寫函式 |
欄位 |
檢查 .wasm 時傳給 sizecheck -budget 的 .json 檔案,如 benchmarks/web-budget.json |
無 |
sizecheck 命令(cmd/sizecheck) |
包體積預算 |
{
"target": "./cmd/wasmprobe",
"ldflags": "-s -w",
"max_raw_bytes": 8388608,
"max_gzip_bytes": 2359296,
"note": "WebAssembly size budget for ./cmd/wasmprobe"
}
移動端包體積預算
| 檔案 |
版本 |
讀寫函式 |
欄位 |
檢查 .aab、.apk 或 .ipa 時傳給 sizecheck -budget 的 .json 檔案,如 benchmarks/android-aab-budget.json |
無 |
sizecheck 命令(cmd/sizecheck) |
包體積預算 |
{
"max_total_bytes": 52428800,
"max_per_abi_bytes": 20971520,
"max_category_bytes": {
"native_libs": 36700160,
"dex": 5242880
},
"note": "Release budget for MyGame Android AAB"
}
API 參考
| 檔案 |
版本 |
讀寫函式 |
欄位 |
api.json,釋出在 https://game.nsgo.dev/api.json |
version: 1 |
apiref.Marshal、apiref.Unmarshal |
包 |
{
"version": 1,
"module": "example.com/mygame",
"packages": [
{
"importPath": "example.com/mygame/score",
"name": "score",
"dir": "score",
"page": "score",
"synopsis": "Package score keeps a player's score.",
"doc": "Package score keeps a player's score.\n",
"consts": [],
"vars": [],
"funcs": [
{
"name": "Add",
"anchor": "Add",
"decl": "func Add(a, b int) int",
"doc": "Add returns a plus b.\n",
"file": "score/score.go",
"line": 4
}
],
"types": []
}
]
}
其他工具的格式
這些檔案按生成它們的工具所寫的樣子讀取,從不轉換成本倉庫自己的形式。
Tiled 地圖
| 檔案 |
讀取函式 |
指南 |
Tiled XML(.tmx)與 JSON(.tmj)地圖,圖塊集可內嵌或外接(.tsx、.tsj),瓦片資料支援 CSV、XML 或 base64(未壓縮、zlib、gzip) |
tilemap.LoadTiled;rooms.FromTiledLayer 從物件層生成房間 |
tilemap、rooms |
Tiled 世界檔案
| 檔案 |
讀取函式 |
指南 |
Tiled 世界檔案(.world),列出地圖世界座標或帶倍率與偏移的正則檔名模式 |
tilemap.ParseTiledWorld、tilemap.LoadTiledWorld |
tilemap |
LDtk 專案
| 檔案 |
讀取函式 |
指南 |
LDtk 專案(.ldtk) |
tilemap.LoadLDtk、tilemap.LoadLDtkAll、tilemap.LoadLDtkWorld;rooms.FromLDtk 從一個世界的關卡生成房間 |
tilemap、rooms |
精靈圖集
| 檔案 |
讀取函式 |
指南 |
TexturePacker 的“JSON (Hash)”和“JSON (Array)”,Aseprite 的 json-hash 和 json-array;game pack 寫出 TexturePacker 的 JSON (Hash) |
sprite.LoadAtlas |
sprite |
字型
| 檔案 |
讀取函式 |
指南 |
| 文本、XML 或 JSON 形式的 AngelCode BMFont;有向距離場字型用 msdf-atlas-gen 的 JSON |
text.LoadBMFont、text.LoadSDFFont |
text |
glTF 模型
| 檔案 |
讀取函式 |
指南 |
glTF 2.0(.gltf 及其緩衝區檔案,或 .glb),包括 Draco 和 meshopt 壓縮 |
gltf.Load、gltf.LoadFS |
從 Blender 匯入 3D 模型 |
網格地圖網格庫
| 檔案 |
讀取函式 |
指南 |
glTF 2.0 JSON 文件,其中帶網格的節點成為庫中的圖塊,包圍盒取自 POSITION 訪問器 |
world3d.LoadMeshLibraryFromGLTF |
world3d |
效能分析器跟蹤
| 檔案 |
寫出函式 |
指南 |
Chrome 的跟蹤事件 JSON,可在 Perfetto 或 chrome://tracing 中開啟 |
debug.Profiler.WriteChromeTrace |
debug.Profiler |
Yarn 對話指令碼
| 檔案 |
讀取函式 |
指南 |
手寫的 Yarn Spinner 指令碼(.yarn):由臺詞、-> 選項和 <<命令>> 組成的節點,每個節點以 title: 頭開始,位於 --- 和 === 之間 |
flow.ParseYarn;由 vn.Presenter 播放 |
vn |
title: Start
---
Aiko: Welcome to the old observatory. #line:obs_01
-> Look through the telescope #line:obs_c1
Aiko: Careful, the lens is old. #line:obs_05
<<jump Telescope>>
-> Leave #line:obs_c2
===
title: Telescope
---
<<set $looked = true>>
Ren: The sky is the same size. #line:obs_06
===
二進位制檔案
本身就是二進位制的媒體仍保持二進位制:圖片(PNG)、聲音(WAV、AAC、MP3)、字型頁、glTF 緩衝區和 .glb 檔案,以及 game assets 編碼的 KTX2 紋理。net 的網路包(傳輸中的資料)和格鬥輸入識別器的回滾狀態(只存在於記憶體)也是二進位制。它們需要設定時,都由上面的某個文本檔案描述:匯入設定旁註檔案、game.yaml 或 glTF 文件。
保持本頁與程式碼一致
每個條目以一行 <!-- format: <包>[#<名稱>] --> 開始。每種 YAML 格式的一致性測試(internal/formattest)以此指明它的條目,並檢查其中的每個 YAML 示例(本頁和英文頁)載入再儲存後位元組不變。其餘由 倉庫根目錄的 TestFormatsPage 檢查:兩種語言列出相同的條目且順序相同;其他每個條目都在該測試中登記了讀取其格式的宣告,該包必須仍有這個宣告,且條目中的 JSON 和 Yarn 示例能被該格式的讀取函式載入;每個解碼 JSON 的包都有條目,除非測試說明了它為何不需要;每個名稱以 Version 結尾的匯出整數常量都是本頁所列某種格式的版本。這些檢查都發現不了的格式仍可能漏掉,例如某個已有條目的包中一種沒有版本的文本格式,所以新增格式時在同一次改動中把條目加到本頁。