cyberia 2.99.8 → 3.0.2
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.
- package/.env.production +1 -0
- package/.github/workflows/engine-cyberia.cd.yml +1 -0
- package/.github/workflows/gitlab.ci.yml +20 -0
- package/.github/workflows/publish.ci.yml +18 -38
- package/.github/workflows/publish.cyberia.ci.yml +18 -38
- package/.vscode/extensions.json +8 -50
- package/.vscode/settings.json +0 -77
- package/CHANGELOG.md +171 -1
- package/{cli.md → CLI-HELP.md} +49 -44
- package/README.md +139 -0
- package/bin/build.js +7 -15
- package/bin/cyberia.js +385 -71
- package/bin/deploy.js +14 -151
- package/bin/file.js +13 -8
- package/bin/index.js +385 -71
- package/bin/zed.js +63 -2
- package/conf.js +32 -3
- package/deployment.yaml +2 -2
- package/jsdoc.json +1 -2
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +2 -2
- package/manifests/deployment/fastapi/initial_data.sh +4 -52
- package/manifests/ipfs/configmap.yaml +64 -0
- package/manifests/ipfs/headless-service.yaml +35 -0
- package/manifests/ipfs/kustomization.yaml +8 -0
- package/manifests/ipfs/statefulset.yaml +149 -0
- package/manifests/ipfs/storage-class.yaml +9 -0
- package/package.json +15 -11
- package/scripts/k3s-node-setup.sh +89 -0
- package/scripts/lxd-vm-setup.sh +23 -0
- package/scripts/rocky-setup.sh +1 -13
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +2 -0
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.model.js +7 -0
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +93 -2
- package/src/api/file/file.controller.js +3 -13
- package/src/api/file/file.ref.json +0 -21
- package/src/api/ipfs/ipfs.controller.js +104 -0
- package/src/api/ipfs/ipfs.model.js +71 -0
- package/src/api/ipfs/ipfs.router.js +31 -0
- package/src/api/ipfs/ipfs.service.js +193 -0
- package/src/api/object-layer/README.md +139 -0
- package/src/api/object-layer/object-layer.controller.js +3 -0
- package/src/api/object-layer/object-layer.model.js +15 -1
- package/src/api/object-layer/object-layer.router.js +6 -10
- package/src/api/object-layer/object-layer.service.js +311 -182
- package/src/api/user/user.router.js +0 -47
- package/src/cli/baremetal.js +7 -9
- package/src/cli/cluster.js +95 -152
- package/src/cli/deploy.js +8 -5
- package/src/cli/index.js +31 -31
- package/src/cli/ipfs.js +184 -0
- package/src/cli/lxd.js +192 -237
- package/src/cli/repository.js +4 -1
- package/src/cli/run.js +17 -2
- package/src/client/components/core/Docs.js +92 -6
- package/src/client/components/core/LoadingAnimation.js +2 -3
- package/src/client/components/core/Modal.js +1 -1
- package/src/client/components/core/VanillaJs.js +36 -25
- package/src/client/components/cyberia/ObjectLayerEngineModal.js +4 -5
- package/src/client/components/cyberia/ObjectLayerEngineViewer.js +280 -29
- package/src/client/services/ipfs/ipfs.service.js +144 -0
- package/src/client/services/object-layer/object-layer.management.js +161 -8
- package/src/client/services/user/user.management.js +0 -5
- package/src/client/services/user/user.service.js +1 -1
- package/src/index.js +12 -1
- package/src/runtime/express/Express.js +4 -3
- package/src/server/auth.js +18 -18
- package/src/server/client-build-docs.js +178 -41
- package/src/server/conf.js +1 -1
- package/src/server/ipfs-client.js +433 -0
- package/src/server/logger.js +22 -10
- package/src/server/object-layer.js +649 -18
- package/src/server/semantic-layer-generator.js +1083 -0
- package/src/server/shape-generator.js +952 -0
- package/test/shape-generator.test.js +457 -0
- package/.vscode/zed.keymap.json +0 -39
- package/.vscode/zed.settings.json +0 -20
- package/bin/ssl.js +0 -63
- package/manifests/lxd/underpost-setup.sh +0 -163
|
@@ -24,12 +24,14 @@ Key features:
|
|
|
24
24
|
|
|
25
25
|
- Walks the asset directory structure and processes PNG/GIF files.
|
|
26
26
|
- Produces `frame_matrix` and `map_color` arrays from images.
|
|
27
|
+
- **Procedurally generates object layers** from semantic item-id descriptors with deterministic seeds and temporal coherence.
|
|
27
28
|
- Saves processed objects to the `ObjectLayer` model with top-level references to `ObjectLayerRenderFrames`.
|
|
28
29
|
- Creates separate `ObjectLayerRenderFrames` documents for render data.
|
|
29
30
|
- Links ObjectLayers to AtlasSpriteSheet documents via top-level `atlasSpriteSheetId`.
|
|
30
31
|
- Generates unique UUID v4 seeds (via `crypto.randomUUID()`) for SHA256 hash uniqueness.
|
|
31
32
|
- Generates SHA256 hash using `fast-json-stable-stringify` for deterministic serialization.
|
|
32
33
|
- Reconstructs PNG frames from stored tile data for debugging.
|
|
34
|
+
- Writes static asset PNGs, atlas sprite sheets, and metadata to the conventional directory structure.
|
|
33
35
|
|
|
34
36
|
## Getting Started
|
|
35
37
|
|
|
@@ -68,6 +70,104 @@ cyberia ol --import skin,floor
|
|
|
68
70
|
cyberia ol --import all
|
|
69
71
|
```
|
|
70
72
|
|
|
73
|
+
### Procedural generation with `--generate`
|
|
74
|
+
|
|
75
|
+
Produces semantically consistent object layers with controlled, reproducible variation and short-term temporal coherence (consecutive frames stay visually consistent). Uses the parametric shape generator and object layer engine under the hood.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Generate a desert floor tile (single frame, auto seed)
|
|
79
|
+
cyberia ol floor-desert --generate
|
|
80
|
+
|
|
81
|
+
# Full control: 3 frames, explicit seed, density
|
|
82
|
+
cyberia ol floor-desert --generate --count 3 --seed fx-42 --frame-index 0 --frame-count 3 --density 0.5
|
|
83
|
+
|
|
84
|
+
# Grass terrain, sparse, 5 frames
|
|
85
|
+
cyberia ol floor-grass --generate --seed meadow-7 --frame-count 5 --density 0.3
|
|
86
|
+
|
|
87
|
+
# Water surface, dense, high element count
|
|
88
|
+
cyberia ol floor-water --generate --seed ocean-1 --count 5 --density 0.8 --frame-count 4
|
|
89
|
+
|
|
90
|
+
# Stone cobblestone
|
|
91
|
+
cyberia ol floor-stone --generate --seed cobble-99 --count 4 --density 0.6
|
|
92
|
+
|
|
93
|
+
# Lava flow, 3-frame animation
|
|
94
|
+
cyberia ol floor-lava --generate --seed magma-3 --frame-count 3 --density 0.7
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**`--generate` options:**
|
|
98
|
+
|
|
99
|
+
| Option | Default | Description |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| `--seed <str>` | auto UUID | Deterministic seed string. Same seed → same output. |
|
|
102
|
+
| `--count <n>` | `3` | Shape element count multiplier per layer. |
|
|
103
|
+
| `--frame-index <n>` | `0` | Starting frame index. |
|
|
104
|
+
| `--frame-count <n>` | `1` | Number of consecutive frames to generate. |
|
|
105
|
+
| `--density <f>` | `0.5` | Overall density factor (`0`–`1`). Lower = sparser. |
|
|
106
|
+
|
|
107
|
+
**Available semantic item-id prefixes:**
|
|
108
|
+
|
|
109
|
+
| Prefix | Type | Tags | Palette |
|
|
110
|
+
|---|---|---|---|
|
|
111
|
+
| `floor-desert` | floor | sand, dune, arid | warm ochres, sand tones |
|
|
112
|
+
| `floor-grass` | floor | grass, meadow, earth | greens, earth browns |
|
|
113
|
+
| `floor-water` | floor | water, ocean, wave | blues, foam whites |
|
|
114
|
+
| `floor-stone` | floor | stone, rock, cobble | greys, warm/cool stone |
|
|
115
|
+
| `floor-lava` | floor | lava, magma, fire | reds, oranges, dark crust |
|
|
116
|
+
| `skin-*` | skin | character, body | skin tones, clothing darks |
|
|
117
|
+
|
|
118
|
+
#### How generation works
|
|
119
|
+
|
|
120
|
+
Each item-id maps to a **semantic descriptor** that provides `semanticTags`, `paletteHints`, `preferredShapes`, and named **layer specs** (e.g. `base`, `dunes`, `rocks`, `tufts` for `floor-desert`).
|
|
121
|
+
|
|
122
|
+
**Seed derivation** — deterministic at every level:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
layerSeed = hash(seed + ':' + itemId + ':' + layerKey)
|
|
126
|
+
frameSeed = hash(layerSeed + ':' + frameIndex)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Temporal coherence** — shape topology (which shapes, how many, where) is locked to `layerSeed` and never changes between frames. Only smooth, low-frequency noise perturbations (position jitter, slight rotation/scale wobble) are derived from `frameSeed`, so frame N and N+1 differ by ~2% of cells.
|
|
130
|
+
|
|
131
|
+
**Layer naming** — every generated layer gets an id: `<itemId>-<layerKey>` (e.g. `floor-desert-dunes`).
|
|
132
|
+
|
|
133
|
+
**Generation pipeline per layer:**
|
|
134
|
+
|
|
135
|
+
1. Pick generator type (`noise-field` for base fills, `shape` for element placement).
|
|
136
|
+
2. Select palette colors deterministically from `paletteHints` with per-element `colorShift`.
|
|
137
|
+
3. For shape layers: pick shape via weighted `preferredShapes`, compute stable base transform `(x, y, scale, rotation)`, apply frame-level smooth noise.
|
|
138
|
+
4. Stamp shapes onto a 24×24 grid via `intCoords` rasterization from the parametric shape generator.
|
|
139
|
+
5. Composite all layers into a final `frame_matrix` + unified `colors` palette.
|
|
140
|
+
|
|
141
|
+
**Variability factors per layer:**
|
|
142
|
+
`scaleVariance`, `rotationVariance`, `colorShift`, `jitter`, `noiseLevel`, `detailLevel`, `sparsity` — small, deterministic variations that keep each generation unique but semantically coherent.
|
|
143
|
+
|
|
144
|
+
#### What `--generate` persists
|
|
145
|
+
|
|
146
|
+
The full pipeline runs automatically:
|
|
147
|
+
|
|
148
|
+
1. **Static assets** — PNGs written to `./src/client/public/cyberia/assets/{type}/{itemId}/{dirCode}/{frame}.png` + `metadata.json`.
|
|
149
|
+
2. **MongoDB** — `ObjectLayerRenderFrames` + `ObjectLayer` documents created with SHA-256 hash.
|
|
150
|
+
3. **Atlas sprite sheet** — generated, saved to `File` + `AtlasSpriteSheet` collections, and linked via `atlasSpriteSheetId`.
|
|
151
|
+
|
|
152
|
+
#### Reproducibility example
|
|
153
|
+
|
|
154
|
+
Running the same command twice produces byte-identical output:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Run 1
|
|
158
|
+
cyberia ol floor-desert --generate --seed fx-42 --count 3 --frame-count 2
|
|
159
|
+
|
|
160
|
+
# Run 2 (identical output)
|
|
161
|
+
cyberia ol floor-desert --generate --seed fx-42 --count 3 --frame-count 2
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Different seeds produce different but semantically consistent results:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
cyberia ol floor-desert --generate --seed fx-42 # variant A
|
|
168
|
+
cyberia ol floor-desert --generate --seed fx-99 # variant B (same style, different arrangement)
|
|
169
|
+
```
|
|
170
|
+
|
|
71
171
|
## Visualize a processed frame
|
|
72
172
|
|
|
73
173
|
Reconstructs and opens a PNG from the database-stored frame data. Requires item-id as the first positional argument, followed by direction and frame index in the format `[direction]_[frameIndex]`.
|
|
@@ -178,6 +278,45 @@ cyberia ol anon --to-atlas-sprite-sheet
|
|
|
178
278
|
cyberia ol anon --show-atlas-sprite-sheet
|
|
179
279
|
```
|
|
180
280
|
|
|
281
|
+
### Procedural Generation Pipeline
|
|
282
|
+
|
|
283
|
+
Generate an object layer entirely from a semantic descriptor — no source PNGs needed:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# 1. Generate a 3-frame desert floor with explicit seed
|
|
287
|
+
cyberia ol floor-desert --generate --seed fx-42 --frame-count 3 --density 0.5
|
|
288
|
+
|
|
289
|
+
# 2. Inspect the generated frame
|
|
290
|
+
cyberia ol floor-desert --show-frame 08_0
|
|
291
|
+
|
|
292
|
+
# 3. View the auto-generated atlas
|
|
293
|
+
cyberia ol floor-desert --show-atlas-sprite-sheet
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Batch Procedural Generation
|
|
297
|
+
|
|
298
|
+
Generate a full tileset family with consistent seeds:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
cyberia ol floor-desert --generate --seed world-1 --frame-count 3
|
|
302
|
+
cyberia ol floor-grass --generate --seed world-1 --frame-count 3
|
|
303
|
+
cyberia ol floor-water --generate --seed world-1 --frame-count 4
|
|
304
|
+
cyberia ol floor-stone --generate --seed world-1 --frame-count 2
|
|
305
|
+
cyberia ol floor-lava --generate --seed world-1 --frame-count 3
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Exploring Seed Variations
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
# Same item, different seeds — compare visual output
|
|
312
|
+
cyberia ol floor-desert --generate --seed alpha --frame-count 1
|
|
313
|
+
cyberia ol floor-desert --generate --seed beta --frame-count 1
|
|
314
|
+
cyberia ol floor-desert --generate --seed gamma --frame-count 1
|
|
315
|
+
|
|
316
|
+
# Inspect each
|
|
317
|
+
cyberia ol floor-desert --show-frame 08_0
|
|
318
|
+
```
|
|
319
|
+
|
|
181
320
|
### Debugging Asset Issues
|
|
182
321
|
|
|
183
322
|
```bash
|
|
@@ -21,6 +21,8 @@ const ObjectLayerController = {
|
|
|
21
21
|
},
|
|
22
22
|
get: async (req, res, options) => {
|
|
23
23
|
try {
|
|
24
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
25
|
+
res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin');
|
|
24
26
|
const result = await ObjectLayerService.get(req, res, options);
|
|
25
27
|
return res.status(200).json({
|
|
26
28
|
status: 'success',
|
|
@@ -37,6 +39,7 @@ const ObjectLayerController = {
|
|
|
37
39
|
generateWebp: async (req, res, options) => {
|
|
38
40
|
try {
|
|
39
41
|
const result = await ObjectLayerService.generateWebp(req, res, options);
|
|
42
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
40
43
|
res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin');
|
|
41
44
|
res.setHeader('Content-Type', 'image/webp');
|
|
42
45
|
res.setHeader(
|
|
@@ -52,6 +52,8 @@ const ItemSchema = new Schema(
|
|
|
52
52
|
* @property {Data.Stats} data.stats - Statistical attributes of the object layer
|
|
53
53
|
* @property {Data.Item} data.item - Item information this layer represents
|
|
54
54
|
* @property {string} data.seed - Random UUID for unique state generation
|
|
55
|
+
* @property {string} [data.atlasSpriteSheetCid] - IPFS Content Identifier for the consolidated atlas sprite sheet PNG
|
|
56
|
+
* @property {string} [cid] - IPFS Content Identifier for the object layer data JSON (fast-json-stable-stringify)
|
|
55
57
|
* @property {Types.ObjectId} objectLayerRenderFramesId - Reference to ObjectLayerRenderFrames document
|
|
56
58
|
* @property {Types.ObjectId} atlasSpriteSheetId - Reference to AtlasSpriteSheet document
|
|
57
59
|
* @property {string} sha256 - SHA-256 hash of the object layer data
|
|
@@ -72,7 +74,9 @@ const ObjectLayerSchema = new Schema(
|
|
|
72
74
|
'Please provide a valid UUID v4',
|
|
73
75
|
],
|
|
74
76
|
},
|
|
77
|
+
atlasSpriteSheetCid: { type: String, default: '', trim: true },
|
|
75
78
|
},
|
|
79
|
+
cid: { type: String, default: '', trim: true },
|
|
76
80
|
objectLayerRenderFramesId: { type: Schema.Types.ObjectId, ref: 'ObjectLayerRenderFrames' },
|
|
77
81
|
atlasSpriteSheetId: { type: Schema.Types.ObjectId, ref: 'AtlasSpriteSheet' },
|
|
78
82
|
sha256: {
|
|
@@ -115,6 +119,7 @@ ObjectLayerSchema.pre('save', function (next) {
|
|
|
115
119
|
if (!this.data.stats || !this.data.item || !this.data.seed || !this.sha256) {
|
|
116
120
|
throw new Error('Missing required fields');
|
|
117
121
|
}
|
|
122
|
+
// cid (object layer data JSON) and data.atlasSpriteSheetCid (atlas PNG) are optional – default to ''
|
|
118
123
|
next();
|
|
119
124
|
});
|
|
120
125
|
|
|
@@ -126,7 +131,14 @@ const ProviderSchema = ObjectLayerSchema;
|
|
|
126
131
|
const ObjectLayerDto = {
|
|
127
132
|
select: {
|
|
128
133
|
get: () => {
|
|
129
|
-
return {
|
|
134
|
+
return {
|
|
135
|
+
_id: 1,
|
|
136
|
+
'data.item': 1,
|
|
137
|
+
'data.atlasSpriteSheetCid': 1,
|
|
138
|
+
cid: 1,
|
|
139
|
+
objectLayerRenderFramesId: 1,
|
|
140
|
+
atlasSpriteSheetId: 1,
|
|
141
|
+
};
|
|
130
142
|
},
|
|
131
143
|
getMetadata: () => {
|
|
132
144
|
return {
|
|
@@ -134,6 +146,8 @@ const ObjectLayerDto = {
|
|
|
134
146
|
'data.item': 1,
|
|
135
147
|
'data.stats': 1,
|
|
136
148
|
'data.seed': 1,
|
|
149
|
+
'data.atlasSpriteSheetCid': 1,
|
|
150
|
+
cid: 1,
|
|
137
151
|
objectLayerRenderFramesId: 1,
|
|
138
152
|
atlasSpriteSheetId: 1,
|
|
139
153
|
sha256: 1,
|
|
@@ -20,16 +20,12 @@ const ObjectLayerRouter = (options) => {
|
|
|
20
20
|
`/generate-webp/:itemType/:itemId/:directionCode`,
|
|
21
21
|
async (req, res) => await ObjectLayerController.generateWebp(req, res, options),
|
|
22
22
|
);
|
|
23
|
-
router.get(`/render/:id`,
|
|
24
|
-
router.get(`/metadata/:id`,
|
|
25
|
-
router.get(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
);
|
|
30
|
-
router.get(`/:id`, authMiddleware, async (req, res) => await ObjectLayerController.get(req, res, options));
|
|
31
|
-
router.get(`/:id`, authMiddleware, async (req, res) => await ObjectLayerController.get(req, res, options));
|
|
32
|
-
router.get(`/`, authMiddleware, async (req, res) => await ObjectLayerController.get(req, res, options));
|
|
23
|
+
router.get(`/render/:id`, async (req, res) => await ObjectLayerController.get(req, res, options));
|
|
24
|
+
router.get(`/metadata/:id`, async (req, res) => await ObjectLayerController.get(req, res, options));
|
|
25
|
+
router.get(`/frame-counts/:id`, async (req, res) => await ObjectLayerController.get(req, res, options));
|
|
26
|
+
router.get(`/:id`, async (req, res) => await ObjectLayerController.get(req, res, options));
|
|
27
|
+
router.get(`/:id`, async (req, res) => await ObjectLayerController.get(req, res, options));
|
|
28
|
+
router.get(`/`, async (req, res) => await ObjectLayerController.get(req, res, options));
|
|
33
29
|
router.put(
|
|
34
30
|
`/:id/frame-image/:itemType/:itemId/:directionCode`,
|
|
35
31
|
authMiddleware,
|