openworldformat 0.4.5__tar.gz → 0.4.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openworldformat-0.4.5 → openworldformat-0.4.6}/PKG-INFO +26 -1
- {openworldformat-0.4.5 → openworldformat-0.4.6}/README.md +25 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat/__init__.py +35 -0
- openworldformat-0.4.6/openworldformat/schema/extensions/ext-cinematography.schema.json +96 -0
- openworldformat-0.4.6/openworldformat/schema/extensions/ext-h3.schema.json +79 -0
- openworldformat-0.4.6/openworldformat/schema/extensions/ext-physics.schema.json +84 -0
- openworldformat-0.4.6/openworldformat/schema/state.schema.json +33 -0
- openworldformat-0.4.6/openworldformat/schema/world.schema.json +3129 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat.egg-info/PKG-INFO +26 -1
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat.egg-info/SOURCES.txt +6 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/pyproject.toml +7 -1
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_alignment.py +2 -1
- openworldformat-0.4.6/tests/test_schema_files.py +60 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat/agent.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat/cinematography.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat/dataset.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat/entity_refs.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat/eval.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat/physics.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat/soundtrack.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat.egg-info/dependency_links.txt +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/openworldformat.egg-info/top_level.txt +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/setup.cfg +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_agent.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_authoring_outcomes.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_cinematography.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_dataset.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_entity_refs.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_eval.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_example.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_fold.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_head_first.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_merge_corpus.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_physics.py +0 -0
- {openworldformat-0.4.5 → openworldformat-0.4.6}/tests/test_soundtrack.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openworldformat
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.6
|
|
4
4
|
Summary: The Open World Format research package: parse and fold a .world in pure Python, no engine required.
|
|
5
5
|
Author: The Open World Format contributors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -220,6 +220,30 @@ counts branches; fold each with `fold_path` and the counterfactuals
|
|
|
220
220
|
come with the corpus. `summarize(dir)` gives the row as a dict for
|
|
221
221
|
notebooks.
|
|
222
222
|
|
|
223
|
+
## Schemas
|
|
224
|
+
|
|
225
|
+
The normative JSON Schemas ship with the package, so a consumer
|
|
226
|
+
validates against its installed dependency instead of a checkout of
|
|
227
|
+
the format repository:
|
|
228
|
+
|
|
229
|
+
```python
|
|
230
|
+
import json
|
|
231
|
+
from openworldformat import schema_path
|
|
232
|
+
|
|
233
|
+
world = json.loads(schema_path("world.schema.json").read_text())
|
|
234
|
+
jsonschema.validate(manifest, world) # or the validator of your choice
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
`schema_path` takes the name as the repository's `schema/` holds it:
|
|
238
|
+
`"state.schema.json"`, `"extensions/ext-physics.schema.json"`,
|
|
239
|
+
`"extensions/ext-cinematography.schema.json"`,
|
|
240
|
+
`"extensions/ext-h3.schema.json"`. They are byte-identical copies of
|
|
241
|
+
the repository's [`schema/`](../schema/) — never hand-edited;
|
|
242
|
+
`tests/test_schema_files.py` fails when they drift, so refresh them
|
|
243
|
+
when the schema changes. (The entity-reference list,
|
|
244
|
+
`schema/entity-refs.json`, is already embedded as source:
|
|
245
|
+
`openworldformat.entity_refs`.)
|
|
246
|
+
|
|
223
247
|
## API
|
|
224
248
|
|
|
225
249
|
| Export | What it does |
|
|
@@ -246,6 +270,7 @@ notebooks.
|
|
|
246
270
|
| `merge_patch(current, change)` | JSON merge patch, RFC 7396 — the rule partial transforms merge by |
|
|
247
271
|
| `compact(world_dir, head_revision=None)` | move the base up to the head (or a revision): `snapshots/base.json` rewritten, the entries it holds archived |
|
|
248
272
|
| `ext_provenance(manifest)` | the provenance extension's five lineage fields, or None |
|
|
273
|
+
| `schema_path(name)` | the location of a shipped normative schema — `schema_path("world.schema.json").read_text()`, then your validator |
|
|
249
274
|
|
|
250
275
|
`openworldformat.physics` mirrors the npm package's
|
|
251
276
|
`openworldformat/physics`: `collect_physics`, `simulate_physics`,
|
|
@@ -196,6 +196,30 @@ counts branches; fold each with `fold_path` and the counterfactuals
|
|
|
196
196
|
come with the corpus. `summarize(dir)` gives the row as a dict for
|
|
197
197
|
notebooks.
|
|
198
198
|
|
|
199
|
+
## Schemas
|
|
200
|
+
|
|
201
|
+
The normative JSON Schemas ship with the package, so a consumer
|
|
202
|
+
validates against its installed dependency instead of a checkout of
|
|
203
|
+
the format repository:
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
import json
|
|
207
|
+
from openworldformat import schema_path
|
|
208
|
+
|
|
209
|
+
world = json.loads(schema_path("world.schema.json").read_text())
|
|
210
|
+
jsonschema.validate(manifest, world) # or the validator of your choice
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
`schema_path` takes the name as the repository's `schema/` holds it:
|
|
214
|
+
`"state.schema.json"`, `"extensions/ext-physics.schema.json"`,
|
|
215
|
+
`"extensions/ext-cinematography.schema.json"`,
|
|
216
|
+
`"extensions/ext-h3.schema.json"`. They are byte-identical copies of
|
|
217
|
+
the repository's [`schema/`](../schema/) — never hand-edited;
|
|
218
|
+
`tests/test_schema_files.py` fails when they drift, so refresh them
|
|
219
|
+
when the schema changes. (The entity-reference list,
|
|
220
|
+
`schema/entity-refs.json`, is already embedded as source:
|
|
221
|
+
`openworldformat.entity_refs`.)
|
|
222
|
+
|
|
199
223
|
## API
|
|
200
224
|
|
|
201
225
|
| Export | What it does |
|
|
@@ -222,6 +246,7 @@ notebooks.
|
|
|
222
246
|
| `merge_patch(current, change)` | JSON merge patch, RFC 7396 — the rule partial transforms merge by |
|
|
223
247
|
| `compact(world_dir, head_revision=None)` | move the base up to the head (or a revision): `snapshots/base.json` rewritten, the entries it holds archived |
|
|
224
248
|
| `ext_provenance(manifest)` | the provenance extension's five lineage fields, or None |
|
|
249
|
+
| `schema_path(name)` | the location of a shipped normative schema — `schema_path("world.schema.json").read_text()`, then your validator |
|
|
225
250
|
|
|
226
251
|
`openworldformat.physics` mirrors the npm package's
|
|
227
252
|
`openworldformat/physics`: `collect_physics`, `simulate_physics`,
|
|
@@ -24,6 +24,7 @@ import copy
|
|
|
24
24
|
import hashlib
|
|
25
25
|
import json
|
|
26
26
|
import re
|
|
27
|
+
from importlib.resources import files as _package_files
|
|
27
28
|
from pathlib import Path
|
|
28
29
|
from typing import Any
|
|
29
30
|
|
|
@@ -39,6 +40,7 @@ __all__ = [
|
|
|
39
40
|
"EXT_PROVENANCE_FIELDS",
|
|
40
41
|
"ENTITY_REFS",
|
|
41
42
|
"WorldFormatError",
|
|
43
|
+
"schema_path",
|
|
42
44
|
"parse_manifest",
|
|
43
45
|
"classify_op",
|
|
44
46
|
"op_kind_shape_ok",
|
|
@@ -100,6 +102,7 @@ REGISTERED_EXTENSIONS = (
|
|
|
100
102
|
"ext-cinematography",
|
|
101
103
|
"ext-provenance",
|
|
102
104
|
"ext-h3",
|
|
105
|
+
"ext-game",
|
|
103
106
|
)
|
|
104
107
|
|
|
105
108
|
#: The edit kinds in the spec's own order — the order error messages
|
|
@@ -1764,3 +1767,35 @@ def compact(world_dir, head_revision: int | None = None) -> Path:
|
|
|
1764
1767
|
(world / "ops.archive.jsonl").write_text("\n".join(archived) + "\n")
|
|
1765
1768
|
log_path.write_text("".join(line + "\n" for line in kept))
|
|
1766
1769
|
return world
|
|
1770
|
+
|
|
1771
|
+
|
|
1772
|
+
# ---------------------------------------------------------------------------
|
|
1773
|
+
# The normative schemas (schema/, shipped as package data)
|
|
1774
|
+
# ---------------------------------------------------------------------------
|
|
1775
|
+
|
|
1776
|
+
|
|
1777
|
+
def schema_path(name: str) -> Any:
|
|
1778
|
+
"""The location of one of the normative JSON Schemas the package
|
|
1779
|
+
ships — ``schema_path("world.schema.json")``,
|
|
1780
|
+
``schema_path("state.schema.json")`` and the extension schemas
|
|
1781
|
+
(``"extensions/ext-physics.schema.json"``,
|
|
1782
|
+
``"extensions/ext-cinematography.schema.json"``,
|
|
1783
|
+
``"extensions/ext-h3.schema.json"``) — so a consumer validates a
|
|
1784
|
+
``.world`` against its installed dependency instead of a checkout of
|
|
1785
|
+
the format repository. The name is the schema's path as the
|
|
1786
|
+
repository's ``schema/`` holds it; the copies are byte-identical to
|
|
1787
|
+
it, never hand-edited, and ``tests/test_schema_files.py`` fails when
|
|
1788
|
+
one drifts.
|
|
1789
|
+
|
|
1790
|
+
The return is an ``importlib.resources`` traversable;
|
|
1791
|
+
``.read_text()`` is the schema, to hand to the validator of choice.
|
|
1792
|
+
|
|
1793
|
+
:param name: the schema's name, as the repository's schema/ holds it
|
|
1794
|
+
:return: the schema's location
|
|
1795
|
+
:raises FileNotFoundError: when the name is no schema this package
|
|
1796
|
+
ships
|
|
1797
|
+
"""
|
|
1798
|
+
path = _package_files("openworldformat").joinpath("schema").joinpath(name)
|
|
1799
|
+
if not path.is_file():
|
|
1800
|
+
raise FileNotFoundError(f"no schema '{name}' ships with this package")
|
|
1801
|
+
return path
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "ExtCinematography",
|
|
4
|
+
"description": "The ext-cinematography extension, version 0.3 (experimental). Everything rides under the namespaced 'ext-cinematography' key on entities: the 'camera' component makes an entity a camera, the 'shot' component makes it a setup in the shot list. The core schema leaves room for the key (unknown fields are allowed and must-ignored); this schema pins the extension's own shape. The camera's aim_entity and focus_entity are entity references in the core sense — marked x-entity-ref here, so the generated schema/entity-refs.json carries them and every reference binds, rewrites and validates them like parent. Spec: spec/extensions/cinematography.md.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"$defs": {
|
|
7
|
+
"CameraComponent": {
|
|
8
|
+
"description": "An entity's ext-cinematography camera: a filmback and a lens. Defaults apply per absent field, so an empty object is a 35 mm lens on Super 35 looking down the entity's local -Z.",
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"sensor_mm": {
|
|
12
|
+
"description": "Sensor (filmback) size [w, h] in millimeters. Default Super 35.",
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": { "type": "number", "exclusiveMinimum": 0 },
|
|
15
|
+
"minItems": 2,
|
|
16
|
+
"maxItems": 2,
|
|
17
|
+
"default": [24.89, 18.66]
|
|
18
|
+
},
|
|
19
|
+
"focal_length_mm": {
|
|
20
|
+
"description": "Lens focal length in millimeters.",
|
|
21
|
+
"type": "number",
|
|
22
|
+
"exclusiveMinimum": 0,
|
|
23
|
+
"default": 35
|
|
24
|
+
},
|
|
25
|
+
"aspect_ratio": {
|
|
26
|
+
"description": "The frame's width/height. The frame is the largest rectangle of this aspect inside the desqueezed sensor, centred; absent means the whole desqueezed sensor.",
|
|
27
|
+
"type": "number",
|
|
28
|
+
"exclusiveMinimum": 0
|
|
29
|
+
},
|
|
30
|
+
"squeeze": {
|
|
31
|
+
"description": "Anamorphic squeeze factor; the desqueezed sensor is sensor_mm[0] * squeeze wide.",
|
|
32
|
+
"type": "number",
|
|
33
|
+
"exclusiveMinimum": 0,
|
|
34
|
+
"default": 1
|
|
35
|
+
},
|
|
36
|
+
"aim": {
|
|
37
|
+
"description": "A world point the camera looks at, +Y up. Absent: the camera looks down the entity's local -Z.",
|
|
38
|
+
"type": "array",
|
|
39
|
+
"items": { "type": "number" },
|
|
40
|
+
"minItems": 3,
|
|
41
|
+
"maxItems": 3
|
|
42
|
+
},
|
|
43
|
+
"aim_entity": {
|
|
44
|
+
"description": "An entity the camera looks at — its origin (transform position composed through its parents), +Y up — over aim while the entity exists. A name at intake, an id in the document (x-entity-ref bindable: bound at ingestion, rewritten at merge, like parent).",
|
|
45
|
+
"x-entity-ref": "bindable",
|
|
46
|
+
"oneOf": [
|
|
47
|
+
{ "type": "integer", "minimum": 0 },
|
|
48
|
+
{ "type": "string", "minLength": 1 }
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"focus_distance_m": {
|
|
52
|
+
"description": "Focus distance in meters.",
|
|
53
|
+
"type": "number",
|
|
54
|
+
"exclusiveMinimum": 0
|
|
55
|
+
},
|
|
56
|
+
"focus_entity": {
|
|
57
|
+
"description": "An entity the camera focuses on: the focus distance is the distance from the camera to the entity's origin, over focus_distance_m while the entity exists. An entity reference like aim_entity (x-entity-ref bindable).",
|
|
58
|
+
"x-entity-ref": "bindable",
|
|
59
|
+
"oneOf": [
|
|
60
|
+
{ "type": "integer", "minimum": 0 },
|
|
61
|
+
{ "type": "string", "minLength": 1 }
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"f_stop": {
|
|
65
|
+
"description": "Aperture f-number.",
|
|
66
|
+
"type": "number",
|
|
67
|
+
"exclusiveMinimum": 0
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"additionalProperties": false
|
|
71
|
+
},
|
|
72
|
+
"ShotComponent": {
|
|
73
|
+
"description": "An entity's ext-cinematography shot: the camera as a setup in the shot list. The entity's name is the shot's name.",
|
|
74
|
+
"type": "object",
|
|
75
|
+
"properties": {
|
|
76
|
+
"scene": { "description": "Scene slug, free text.", "type": "string" },
|
|
77
|
+
"order": { "description": "Shot list sort key; ties break by entity id.", "type": "integer" },
|
|
78
|
+
"in_s": { "description": "Setup start on the clock, seconds; <= out_s.", "type": "number" },
|
|
79
|
+
"out_s": { "description": "Setup end on the clock, seconds.", "type": "number" },
|
|
80
|
+
"size": { "description": "Shot size, free text; conventionally EWS, WS, MS, MCU, CU, ECU, INSERT, OTS, POV, TWO.", "type": "string" },
|
|
81
|
+
"description": { "description": "What the setup is, free text.", "type": "string" }
|
|
82
|
+
},
|
|
83
|
+
"additionalProperties": false
|
|
84
|
+
},
|
|
85
|
+
"EntityBlock": {
|
|
86
|
+
"description": "The entity's ext-cinematography block: a camera, optionally also a shot.",
|
|
87
|
+
"type": "object",
|
|
88
|
+
"properties": {
|
|
89
|
+
"camera": { "$ref": "#/$defs/CameraComponent" },
|
|
90
|
+
"shot": { "$ref": "#/$defs/ShotComponent" }
|
|
91
|
+
},
|
|
92
|
+
"additionalProperties": false,
|
|
93
|
+
"minProperties": 1
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "ExtH3",
|
|
4
|
+
"description": "The ext-h3 extension, version 0.1 (proposed): where an entity sits on a globe, as an H3 cell and an integer-only transform in that cell's frame, beside the core transform a reader without the extension draws. Everything rides under the namespaced 'ext-h3' key: on entities (the placement) and on the environment (the package's frame: the cell whose centre is the local origin). The core schema leaves room for the key (unknown fields are allowed and must-ignored); this schema pins the extension's own shape. The H3 fields are authoritative and the core transform is derived from them by the producer (spec/extensions/h3.md, 'The one invariant'). Spec: spec/extensions/h3.md.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"$defs": {
|
|
7
|
+
"Cell": {
|
|
8
|
+
"description": "An H3 cell index, as H3's 15-digit lowercase hexadecimal string.",
|
|
9
|
+
"type": "string",
|
|
10
|
+
"pattern": "^[0-9a-f]{15}$"
|
|
11
|
+
},
|
|
12
|
+
"Resolution": {
|
|
13
|
+
"description": "The cell's H3 resolution, 0 to 15. Stated so a reader without an H3 library knows the translation unit; it MUST equal what the index encodes.",
|
|
14
|
+
"type": "integer",
|
|
15
|
+
"minimum": 0,
|
|
16
|
+
"maximum": 15
|
|
17
|
+
},
|
|
18
|
+
"Body": {
|
|
19
|
+
"description": "The body the grid is laid on. 'earth' is the default and the only body this version defines a unit table for; a reader that does not know the body draws the core transform.",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"pattern": "^[a-z][a-z0-9-]*$",
|
|
22
|
+
"default": "earth"
|
|
23
|
+
},
|
|
24
|
+
"Int3": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"items": { "type": "integer" },
|
|
27
|
+
"minItems": 3,
|
|
28
|
+
"maxItems": 3
|
|
29
|
+
},
|
|
30
|
+
"Frame": {
|
|
31
|
+
"description": "The environment's ext-h3 block: the package's local frame. Its origin is the cell's centre on the body's sphere; +X east, +Y up, +Z south; metres (the core's conventions).",
|
|
32
|
+
"type": "object",
|
|
33
|
+
"properties": {
|
|
34
|
+
"cell": { "$ref": "#/$defs/Cell" },
|
|
35
|
+
"resolution": { "$ref": "#/$defs/Resolution" },
|
|
36
|
+
"body": { "$ref": "#/$defs/Body" }
|
|
37
|
+
},
|
|
38
|
+
"required": ["cell", "resolution"],
|
|
39
|
+
"additionalProperties": false
|
|
40
|
+
},
|
|
41
|
+
"Placement": {
|
|
42
|
+
"description": "An entity's ext-h3 block: its cell, and its transform relative to the cell's centre in the cell's own frame (+X east, +Y up, +Z south), as integers.",
|
|
43
|
+
"type": "object",
|
|
44
|
+
"properties": {
|
|
45
|
+
"cell": { "$ref": "#/$defs/Cell" },
|
|
46
|
+
"resolution": { "$ref": "#/$defs/Resolution" },
|
|
47
|
+
"body": { "$ref": "#/$defs/Body" },
|
|
48
|
+
"translation": {
|
|
49
|
+
"description": "Hundredths of the mean edge length of a cell at `resolution` (H3 4's getHexagonEdgeLengthAvgM: 0.584169 m at 15, so one unit is 5.84169 mm), along the cell frame's east, up and south.",
|
|
50
|
+
"$ref": "#/$defs/Int3",
|
|
51
|
+
"default": [0, 0, 0]
|
|
52
|
+
},
|
|
53
|
+
"rotation": {
|
|
54
|
+
"description": "Hundredths of a degree, intrinsic XYZ Euler like the core's rotation_degrees; each in -18000..=18000.",
|
|
55
|
+
"type": "array",
|
|
56
|
+
"items": { "type": "integer", "minimum": -18000, "maximum": 18000 },
|
|
57
|
+
"minItems": 3,
|
|
58
|
+
"maxItems": 3,
|
|
59
|
+
"default": [0, 0, 0]
|
|
60
|
+
},
|
|
61
|
+
"scale": {
|
|
62
|
+
"description": "Log2 fixed point per axis: round(log2(factor) * 1024). 0 is 1x, 1024 is 2x, -1024 is 0.5x.",
|
|
63
|
+
"$ref": "#/$defs/Int3",
|
|
64
|
+
"default": [0, 0, 0]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": ["cell", "resolution"],
|
|
68
|
+
"additionalProperties": false
|
|
69
|
+
},
|
|
70
|
+
"EntityBlock": {
|
|
71
|
+
"description": "What an entity carries under 'ext-h3'.",
|
|
72
|
+
"$ref": "#/$defs/Placement"
|
|
73
|
+
},
|
|
74
|
+
"EnvironmentBlock": {
|
|
75
|
+
"description": "What the environment carries under 'ext-h3'.",
|
|
76
|
+
"$ref": "#/$defs/Frame"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "ExtPhysics",
|
|
4
|
+
"description": "The ext-physics extension, version 0.1 (experimental). Everything rides under the namespaced 'ext-physics' key: on entities (the body component), on the environment (gravity), and as a log op kind (sampled trajectories). The core schema leaves room for these keys (unknown fields are allowed and must-ignored); this schema pins the extension's own shape. Spec: spec/extensions/physics.md.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"$defs": {
|
|
7
|
+
"Collider": {
|
|
8
|
+
"description": "The collision volume: derived from the entity's parametric shape, or an explicit primitive.",
|
|
9
|
+
"anyOf": [
|
|
10
|
+
{ "const": "shape" },
|
|
11
|
+
{
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"sphere": { "type": "number", "exclusiveMinimum": 0 },
|
|
15
|
+
"cuboid": {
|
|
16
|
+
"type": "array",
|
|
17
|
+
"items": { "type": "number", "exclusiveMinimum": 0 },
|
|
18
|
+
"minItems": 3,
|
|
19
|
+
"maxItems": 3
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"additionalProperties": false,
|
|
23
|
+
"minProperties": 1,
|
|
24
|
+
"maxProperties": 1
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"BodyComponent": {
|
|
29
|
+
"description": "An entity's ext-physics component: what the body is, never how it moves.",
|
|
30
|
+
"type": "object",
|
|
31
|
+
"properties": {
|
|
32
|
+
"body": { "enum": ["static", "kinematic", "dynamic"] },
|
|
33
|
+
"mass": { "type": "number", "exclusiveMinimum": 0, "default": 1.0 },
|
|
34
|
+
"collider": { "$ref": "#/$defs/Collider", "default": "shape" },
|
|
35
|
+
"restitution": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.5 },
|
|
36
|
+
"friction": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.5 },
|
|
37
|
+
"gravity_scale": { "type": "number", "default": 1.0 },
|
|
38
|
+
"linear_damping": { "type": "number", "minimum": 0, "default": 0.0 }
|
|
39
|
+
},
|
|
40
|
+
"required": ["body"],
|
|
41
|
+
"additionalProperties": false
|
|
42
|
+
},
|
|
43
|
+
"EnvironmentBlock": {
|
|
44
|
+
"description": "The environment's ext-physics block.",
|
|
45
|
+
"type": "object",
|
|
46
|
+
"properties": {
|
|
47
|
+
"gravity": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"items": { "type": "number" },
|
|
50
|
+
"minItems": 3,
|
|
51
|
+
"maxItems": 3,
|
|
52
|
+
"default": [0.0, -9.81, 0.0]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"additionalProperties": false
|
|
56
|
+
},
|
|
57
|
+
"TrajectoryOp": {
|
|
58
|
+
"description": "The extension's op kind: sampled transforms of dynamic bodies. Folds to nothing for the document fold; readers interpolate. Writers sample at or below 10 Hz.",
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"t_s": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"items": { "type": "number", "minimum": 0 },
|
|
64
|
+
"minItems": 1
|
|
65
|
+
},
|
|
66
|
+
"bodies": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"additionalProperties": {
|
|
69
|
+
"type": "array",
|
|
70
|
+
"items": {
|
|
71
|
+
"type": "array",
|
|
72
|
+
"items": { "type": "number" },
|
|
73
|
+
"minItems": 3,
|
|
74
|
+
"maxItems": 3
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"minProperties": 1
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"required": ["t_s", "bodies"],
|
|
81
|
+
"additionalProperties": false
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "StateDocument",
|
|
4
|
+
"description": "The typed state document (state.json): what a world's game state is and its initial values — score, inventory, quests, flags. A save game is base + state declaration + a player's session log (spec/state.md). Experimental until 1.0 pins it, like the document it describes.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"format_version": {
|
|
8
|
+
"description": "The state document's own version.",
|
|
9
|
+
"type": "integer",
|
|
10
|
+
"const": 1
|
|
11
|
+
},
|
|
12
|
+
"fields": {
|
|
13
|
+
"description": "The declared fields, keyed by dotted name. A dot-prefix is a namespace by convention (score., quest., inv.); a world's own state SHOULD stay in one namespace.",
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"type": {
|
|
19
|
+
"description": "The field's type.",
|
|
20
|
+
"enum": ["int", "float", "bool", "string", "map", "list", "json"]
|
|
21
|
+
},
|
|
22
|
+
"initial": {
|
|
23
|
+
"description": "The field's initial value; absent means null (or the empty map, for map fields)."
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": ["type"],
|
|
27
|
+
"additionalProperties": false
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": ["format_version", "fields"],
|
|
32
|
+
"additionalProperties": false
|
|
33
|
+
}
|