Skip to content

Commit b4b5bc4

Browse files
authored
Merge pull request #283 from Indy2222/feature/object-file
2 parents 996a3a2 + fb89663 commit b4b5bc4

File tree

3 files changed

+125
-1
lines changed

3 files changed

+125
-1
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ Topologically sorted crates:
136136
* [/assets/maps](/assets/maps) — game maps.
137137
* [/assets/models](/assets/models) — 3D models in [glTF
138138
2.0](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html) format.
139-
* [/assets/objects](/assets/objects) — game object definitions.
139+
* [/assets/objects](/assets/objects) — game [object
140+
definitions](https://docs.de-game.org/objects/).
140141
*
141142

142143
* [/crates](/crates) — the game comprises many small crates in a single

docs/content/objects/_index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
+++
2+
title = "Map Objects"
3+
weight = 2
4+
sort_by = "weight"
5+
+++
6+
7+
Every object which can be placed on the game map has an associated object info
8+
file. It is an ordinary JSON file containing various information about the
9+
object. The file name has suffix `.obj.json`.
10+
11+
See [object info JSON schema](schema.json).

docs/content/objects/schema.json

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://example.com/product.schema.json",
4+
"title": "Object Info",
5+
"type": "object",
6+
"description": "Description of a game object.",
7+
"properties": {
8+
"footprint": {
9+
"type": "object",
10+
"description": "A 2D footprint of the object used for path planning and collision avoidance.",
11+
"properties": {
12+
"convex_hull": {
13+
"type": "array",
14+
"description": "A convex polygon fully containing the object.",
15+
"items": {
16+
"type": "array",
17+
"description": "2D coordinates in the object space.",
18+
"items": {
19+
"type": "number"
20+
},
21+
"minItems": 2,
22+
"maxItems": 2
23+
},
24+
"minItems": 3
25+
}
26+
},
27+
"required": [
28+
"convex_hull"
29+
]
30+
},
31+
"shape": {
32+
"type": "object",
33+
"description": "A tri-mesh collider of the object. The object 3D model is fully contained inside the buffer. Due to performance reasons, the number of triangles should be very small.",
34+
"properties": {
35+
"vertices": {
36+
"type": "array",
37+
"description": "Array of unique vertices of the tri-mesh.",
38+
"items": {
39+
"type": "array",
40+
"description": "A 3D point in object space.",
41+
"items": {
42+
"type": "number"
43+
},
44+
"minItems": 3,
45+
"maxItems": 3
46+
},
47+
"minItems": 4,
48+
"uniqueItems": true
49+
},
50+
"indices": {
51+
"type": "array",
52+
"description": "Triangle vertex triplets. Each triplets is counter clockwise.",
53+
"items": {
54+
"type": "array",
55+
"description": "An index of `vertices` array.",
56+
"items": {
57+
"type": "integer"
58+
},
59+
"minItems": 3,
60+
"maxItems": 3,
61+
"minimum": 0
62+
},
63+
"minItems": 4
64+
}
65+
},
66+
"required": [
67+
"vertices",
68+
"indices"
69+
]
70+
},
71+
"cannon": {
72+
"type": "object",
73+
"description": "Properties of a laser cannon.",
74+
"properties": {
75+
"muzzle": {
76+
"type": "array",
77+
"description": "3D coordinates of the cannon muzzle in object space.",
78+
"items": {
79+
"type": "number"
80+
},
81+
"minItems": 3,
82+
"maxItems": 3
83+
},
84+
"range": {
85+
"type": "number",
86+
"description": "Maximum firing distance of the cannon.",
87+
"exclusiveMinimum": 0
88+
},
89+
"damage": {
90+
"type": "number",
91+
"description": "Enemy damage when hit by the gun.",
92+
"exclusiveMinimum": 0
93+
},
94+
"recharge_interval": {
95+
"type": "number",
96+
"description": "Minimum time between two gun shots.",
97+
"exclusiveMinimum": 0
98+
}
99+
},
100+
"required": [
101+
"muzzle",
102+
"range",
103+
"damage",
104+
"recharge_interval"
105+
]
106+
}
107+
},
108+
"required": [
109+
"footprint",
110+
"shape"
111+
]
112+
}

0 commit comments

Comments
 (0)