@bitmagic/world-forger 0.1.41 → 0.1.42-dev.1
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/dist/physics-mode.d.ts +10 -8
- package/dist/physics-mode.d.ts.map +1 -1
- package/dist/physics-mode.js +15 -12
- package/dist/physics-mode.js.map +1 -1
- package/package.json +1 -1
package/dist/physics-mode.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* lanes agree with the engine about what a game actually runs.
|
|
4
4
|
*
|
|
5
5
|
* `game.json` may declare `physicsMode: '2d'` on games the engine cannot run in
|
|
6
|
-
* 2D (only
|
|
6
|
+
* 2D (only a template that opts in with `physics2d: true` has a 2D code path); the engine downgrades those
|
|
7
7
|
* to 3D at boot. Anything that acts on the declared mode — picking which Rapier
|
|
8
8
|
* flavor a published bundle ships, or gating the World-Forger's 2D routing —
|
|
9
9
|
* must apply the same downgrade, or it acts on a mode the game will never run.
|
|
@@ -21,7 +21,13 @@ export type RapierFlavor = '2d' | '3d';
|
|
|
21
21
|
/** Narrow a raw game.json `physicsMode` value; anything unrecognized is treated as absent. */
|
|
22
22
|
export declare function parsePhysicsMode(raw: unknown): PhysicsMode | undefined;
|
|
23
23
|
/** Declared metadata → the physics world the engine actually initializes. */
|
|
24
|
-
export declare function effectivePhysicsMode(
|
|
24
|
+
export declare function effectivePhysicsMode(
|
|
25
|
+
/**
|
|
26
|
+
* Not consulted since the Physics2D genre was retired; kept so this stays
|
|
27
|
+
* call-compatible with the engine's mirror, whose signature frozen scaffolded
|
|
28
|
+
* vite configs depend on.
|
|
29
|
+
*/
|
|
30
|
+
_gameGenre: string, requested: PhysicsMode | undefined,
|
|
25
31
|
/**
|
|
26
32
|
* game.json `physics2d` — the game's own declaration that its TEMPLATE CODE is
|
|
27
33
|
* written against the 2D physics world. `physicsMode` alone cannot carry this:
|
|
@@ -45,13 +51,11 @@ export declare function rapierFlavorForGame(gameGenre: string, physicsModeRaw: u
|
|
|
45
51
|
* - `not-2d`: the game declares nothing 2D; the 3D forge path applies.
|
|
46
52
|
* - `sideon-eligible`: a voxel-lane 2D game a side-view generated level fits
|
|
47
53
|
* (any template — the rule is deliberately template-agnostic).
|
|
48
|
-
* - `refuse-2d`: 2D, but the side-on path is wrong for it —
|
|
49
|
-
*
|
|
54
|
+
* - `refuse-2d`: 2D, but the side-on path is wrong for it — a top-down-camera
|
|
55
|
+
* 2D game.
|
|
50
56
|
*/
|
|
51
57
|
export type Game2DClass = 'not-2d' | 'sideon-eligible' | 'refuse-2d';
|
|
52
58
|
export interface Game2DProfile {
|
|
53
|
-
/** game.json `gameGenre` (e.g. 'Voxel', 'Physics2D'); unknown values are treated as non-Physics2D. */
|
|
54
|
-
gameGenre: string;
|
|
55
59
|
/**
|
|
56
60
|
* game.json `gameDimension`, RAW — '2d' and '3d' are meaningful and so is
|
|
57
61
|
* absence. Callers must pass the raw value through, never a defaulted one: a
|
|
@@ -85,8 +89,6 @@ export declare function classifyGame2D(profile: Game2DProfile): Game2DClass;
|
|
|
85
89
|
* collide on a plane. Only its terrain relief is constrained.
|
|
86
90
|
*/
|
|
87
91
|
export declare function runsGroundPlanePhysics(profile: {
|
|
88
|
-
/** game.json `gameGenre`. */
|
|
89
|
-
gameGenre: string;
|
|
90
92
|
/** game.json `physicsMode`, raw. */
|
|
91
93
|
physicsMode: unknown;
|
|
92
94
|
/** game.json `physics2d` — the template's opt-in; only `true` counts. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physics-mode.d.ts","sourceRoot":"","sources":["../src/physics-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAC/C,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvC,8FAA8F;AAC9F,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,WA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CAAC;IACnB,iGAAiG;IACjG,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,OAAO,CAIV"}
|
package/dist/physics-mode.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* lanes agree with the engine about what a game actually runs.
|
|
4
4
|
*
|
|
5
5
|
* `game.json` may declare `physicsMode: '2d'` on games the engine cannot run in
|
|
6
|
-
* 2D (only
|
|
6
|
+
* 2D (only a template that opts in with `physics2d: true` has a 2D code path); the engine downgrades those
|
|
7
7
|
* to 3D at boot. Anything that acts on the declared mode — picking which Rapier
|
|
8
8
|
* flavor a published bundle ships, or gating the World-Forger's 2D routing —
|
|
9
9
|
* must apply the same downgrade, or it acts on a mode the game will never run.
|
|
@@ -21,7 +21,13 @@ export function parsePhysicsMode(raw) {
|
|
|
21
21
|
return raw === '2d' || raw === '3d' || raw === 'none' ? raw : undefined;
|
|
22
22
|
}
|
|
23
23
|
/** Declared metadata → the physics world the engine actually initializes. */
|
|
24
|
-
export function effectivePhysicsMode(
|
|
24
|
+
export function effectivePhysicsMode(
|
|
25
|
+
/**
|
|
26
|
+
* Not consulted since the Physics2D genre was retired; kept so this stays
|
|
27
|
+
* call-compatible with the engine's mirror, whose signature frozen scaffolded
|
|
28
|
+
* vite configs depend on.
|
|
29
|
+
*/
|
|
30
|
+
_gameGenre, requested,
|
|
25
31
|
/**
|
|
26
32
|
* game.json `physics2d` — the game's own declaration that its TEMPLATE CODE is
|
|
27
33
|
* written against the 2D physics world. `physicsMode` alone cannot carry this:
|
|
@@ -30,12 +36,11 @@ export function effectivePhysicsMode(gameGenre, requested,
|
|
|
30
36
|
* A new field cannot appear in old data, which is the property needed.
|
|
31
37
|
*/
|
|
32
38
|
physics2dCapable = false) {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
if (mode === '2d' && gameGenre !== 'Physics2D' && !physics2dCapable)
|
|
39
|
+
const mode = requested ?? '3d';
|
|
40
|
+
// 2D physics runs only where there is a 2D code path: a game whose template
|
|
41
|
+
// opted in explicitly. Everything else downgrades to 3D so the game runs
|
|
42
|
+
// instead of crashing.
|
|
43
|
+
if (mode === '2d' && !physics2dCapable)
|
|
39
44
|
return '3d';
|
|
40
45
|
return mode;
|
|
41
46
|
}
|
|
@@ -68,11 +73,9 @@ export function classifyGame2D(profile) {
|
|
|
68
73
|
// `gameDimension: '2d'` makes a top-down game a (refused) 2D game.
|
|
69
74
|
const declared2D = profile.gameDimension === '2d';
|
|
70
75
|
const legacy2D = profile.gameDimension !== '3d' && profile.physicsMode === '2d'
|
|
71
|
-
&&
|
|
76
|
+
&& profile.cameraMode !== 'top-down';
|
|
72
77
|
if (!declared2D && !legacy2D)
|
|
73
78
|
return 'not-2d';
|
|
74
|
-
if (profile.gameGenre === 'Physics2D')
|
|
75
|
-
return 'refuse-2d';
|
|
76
79
|
if (profile.cameraMode === 'top-down')
|
|
77
80
|
return 'refuse-2d';
|
|
78
81
|
return 'sideon-eligible';
|
|
@@ -95,7 +98,7 @@ export function classifyGame2D(profile) {
|
|
|
95
98
|
export function runsGroundPlanePhysics(profile) {
|
|
96
99
|
if (profile.cameraMode !== 'top-down')
|
|
97
100
|
return false;
|
|
98
|
-
const mode = effectivePhysicsMode(
|
|
101
|
+
const mode = effectivePhysicsMode('', parsePhysicsMode(profile.physicsMode), profile.physics2d === true);
|
|
99
102
|
return mode === '2d';
|
|
100
103
|
}
|
|
101
104
|
//# sourceMappingURL=physics-mode.js.map
|
package/dist/physics-mode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physics-mode.js","sourceRoot":"","sources":["../src/physics-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,8FAA8F;AAC9F,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,CAAC,CAA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AA4E;IAC5E,qCAAqC;IACrC,EAAE;IACF,wEAAwE;IACxE,yEAAyE;IACzE,6EAA6E;IAC7E,6EAA6E;IAC7E,4EAA4E;IAC5E,mEAAmE;IACnE,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,KAAK,IAAI,CAAC;IAClD,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,KAAK,IAAI,IAAI,OAAO,CAAC,WAAW,KAAK,IAAI;WAC1E,OAAO,CAAC,UAAU,KAAK,UAAU,CAAC;IACvC,IAAI,CAAC,UAAU,IAAI,CAAC,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9C,IAAI,OAAO,CAAC,UAAU,KAAK,UAAU;QAAE,OAAO,WAAW,CAAC;IAC1D,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAOtC;IACC,IAAI,OAAO,CAAC,UAAU,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC;IACpD,MAAM,IAAI,GAAG,oBAAoB,CAAC,EAAE,EAAE,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC;IACzG,OAAO,IAAI,KAAK,IAAI,CAAC;AACvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitmagic/world-forger",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42-dev.1",
|
|
4
4
|
"description": "Client half of the Bitmagic world forger: the forged-level artifact schema, the host seams, and the browser pipeline steps that bake archetypes, bake a level and place its instances.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Bitmagic Oy",
|