lantern-engine 0.0.0-stage → 0.4.0

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.
Files changed (178) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/LICENSE +21 -0
  3. package/README.md +113 -2
  4. package/dist/assets/takeCleanerWorker-DTcI_Jqr.js +31 -0
  5. package/dist/assets/takeCleanerWorker-DTcI_Jqr.js.map +1 -0
  6. package/dist/constants-CjYVdFid.js +252 -0
  7. package/dist/constants-CjYVdFid.js.map +1 -0
  8. package/dist/lantern-engine.js +3473 -0
  9. package/dist/lantern-engine.js.map +1 -0
  10. package/dist/pixel.js +1404 -0
  11. package/dist/pixel.js.map +1 -0
  12. package/dist/types/anim/Animator.d.ts +50 -0
  13. package/dist/types/anim/Animator.d.ts.map +1 -0
  14. package/dist/types/anim/animationSystem.d.ts +13 -0
  15. package/dist/types/anim/animationSystem.d.ts.map +1 -0
  16. package/dist/types/assets/AssetLoader.d.ts +85 -0
  17. package/dist/types/assets/AssetLoader.d.ts.map +1 -0
  18. package/dist/types/audio/MusicPlayer.d.ts +57 -0
  19. package/dist/types/audio/MusicPlayer.d.ts.map +1 -0
  20. package/dist/types/audio/SoundEngine.d.ts +42 -0
  21. package/dist/types/audio/SoundEngine.d.ts.map +1 -0
  22. package/dist/types/audio/cleanTake.d.ts +3 -0
  23. package/dist/types/audio/cleanTake.d.ts.map +1 -0
  24. package/dist/types/audio/sampleBank.d.ts +27 -0
  25. package/dist/types/audio/sampleBank.d.ts.map +1 -0
  26. package/dist/types/audio/soundTable.d.ts +14 -0
  27. package/dist/types/audio/soundTable.d.ts.map +1 -0
  28. package/dist/types/audio/synth.d.ts +34 -0
  29. package/dist/types/audio/synth.d.ts.map +1 -0
  30. package/dist/types/audio/takeCleanerWorker.d.ts +2 -0
  31. package/dist/types/audio/takeCleanerWorker.d.ts.map +1 -0
  32. package/dist/types/core/BitmapLabel.d.ts +26 -0
  33. package/dist/types/core/BitmapLabel.d.ts.map +1 -0
  34. package/dist/types/core/Camera.d.ts +90 -0
  35. package/dist/types/core/Camera.d.ts.map +1 -0
  36. package/dist/types/core/Clock.d.ts +11 -0
  37. package/dist/types/core/Clock.d.ts.map +1 -0
  38. package/dist/types/core/Graphics.d.ts +37 -0
  39. package/dist/types/core/Graphics.d.ts.map +1 -0
  40. package/dist/types/core/Group.d.ts +15 -0
  41. package/dist/types/core/Group.d.ts.map +1 -0
  42. package/dist/types/core/Image.d.ts +25 -0
  43. package/dist/types/core/Image.d.ts.map +1 -0
  44. package/dist/types/core/ObjectFactory.d.ts +34 -0
  45. package/dist/types/core/ObjectFactory.d.ts.map +1 -0
  46. package/dist/types/core/Pointer.d.ts +27 -0
  47. package/dist/types/core/Pointer.d.ts.map +1 -0
  48. package/dist/types/core/Rectangle.d.ts +26 -0
  49. package/dist/types/core/Rectangle.d.ts.map +1 -0
  50. package/dist/types/core/Stage.d.ts +58 -0
  51. package/dist/types/core/Stage.d.ts.map +1 -0
  52. package/dist/types/core/Text.d.ts +22 -0
  53. package/dist/types/core/Text.d.ts.map +1 -0
  54. package/dist/types/core/TextureRegistry.d.ts +51 -0
  55. package/dist/types/core/TextureRegistry.d.ts.map +1 -0
  56. package/dist/types/core/Tweener.d.ts +53 -0
  57. package/dist/types/core/Tweener.d.ts.map +1 -0
  58. package/dist/types/core/atlas.d.ts +16 -0
  59. package/dist/types/core/atlas.d.ts.map +1 -0
  60. package/dist/types/core/atlasPlan.d.ts +34 -0
  61. package/dist/types/core/atlasPlan.d.ts.map +1 -0
  62. package/dist/types/core/eases.d.ts +3 -0
  63. package/dist/types/core/eases.d.ts.map +1 -0
  64. package/dist/types/core/gameObject.d.ts +42 -0
  65. package/dist/types/core/gameObject.d.ts.map +1 -0
  66. package/dist/types/core/pixiPatches.d.ts +9 -0
  67. package/dist/types/core/pixiPatches.d.ts.map +1 -0
  68. package/dist/types/core/types.d.ts +4 -0
  69. package/dist/types/core/types.d.ts.map +1 -0
  70. package/dist/types/ecs/SparseSet.d.ts +25 -0
  71. package/dist/types/ecs/SparseSet.d.ts.map +1 -0
  72. package/dist/types/ecs/World.d.ts +133 -0
  73. package/dist/types/ecs/World.d.ts.map +1 -0
  74. package/dist/types/ecs/fields.d.ts +34 -0
  75. package/dist/types/ecs/fields.d.ts.map +1 -0
  76. package/dist/types/engine/Engine.d.ts +80 -0
  77. package/dist/types/engine/Engine.d.ts.map +1 -0
  78. package/dist/types/engine/FixedLoop.d.ts +32 -0
  79. package/dist/types/engine/FixedLoop.d.ts.map +1 -0
  80. package/dist/types/engine/Scene.d.ts +37 -0
  81. package/dist/types/engine/Scene.d.ts.map +1 -0
  82. package/dist/types/engine/SceneManager.d.ts +31 -0
  83. package/dist/types/engine/SceneManager.d.ts.map +1 -0
  84. package/dist/types/events/EventBus.d.ts +20 -0
  85. package/dist/types/events/EventBus.d.ts.map +1 -0
  86. package/dist/types/fx/hitStop.d.ts +20 -0
  87. package/dist/types/fx/hitStop.d.ts.map +1 -0
  88. package/dist/types/fx/viewCull.d.ts +14 -0
  89. package/dist/types/fx/viewCull.d.ts.map +1 -0
  90. package/dist/types/index.d.ts +68 -0
  91. package/dist/types/index.d.ts.map +1 -0
  92. package/dist/types/input/Actions.d.ts +75 -0
  93. package/dist/types/input/Actions.d.ts.map +1 -0
  94. package/dist/types/input/Keyboard.d.ts +25 -0
  95. package/dist/types/input/Keyboard.d.ts.map +1 -0
  96. package/dist/types/input/aimAxis.d.ts +9 -0
  97. package/dist/types/input/aimAxis.d.ts.map +1 -0
  98. package/dist/types/input/longPress.d.ts +21 -0
  99. package/dist/types/input/longPress.d.ts.map +1 -0
  100. package/dist/types/input/stickAxis.d.ts +26 -0
  101. package/dist/types/input/stickAxis.d.ts.map +1 -0
  102. package/dist/types/input/touchDetect.d.ts +18 -0
  103. package/dist/types/input/touchDetect.d.ts.map +1 -0
  104. package/dist/types/light/LightLayer.d.ts +65 -0
  105. package/dist/types/light/LightLayer.d.ts.map +1 -0
  106. package/dist/types/net/Connection.d.ts +66 -0
  107. package/dist/types/net/Connection.d.ts.map +1 -0
  108. package/dist/types/net/InterpolationBuffer.d.ts +36 -0
  109. package/dist/types/net/InterpolationBuffer.d.ts.map +1 -0
  110. package/dist/types/net/PredictedMover.d.ts +43 -0
  111. package/dist/types/net/PredictedMover.d.ts.map +1 -0
  112. package/dist/types/net/Room.d.ts +69 -0
  113. package/dist/types/net/Room.d.ts.map +1 -0
  114. package/dist/types/net/RoomHost.d.ts +74 -0
  115. package/dist/types/net/RoomHost.d.ts.map +1 -0
  116. package/dist/types/net/cadence.d.ts +22 -0
  117. package/dist/types/net/cadence.d.ts.map +1 -0
  118. package/dist/types/net/constants.d.ts +24 -0
  119. package/dist/types/net/constants.d.ts.map +1 -0
  120. package/dist/types/net/movement.d.ts +50 -0
  121. package/dist/types/net/movement.d.ts.map +1 -0
  122. package/dist/types/net/protocol.d.ts +59 -0
  123. package/dist/types/net/protocol.d.ts.map +1 -0
  124. package/dist/types/net/serverClock.d.ts +14 -0
  125. package/dist/types/net/serverClock.d.ts.map +1 -0
  126. package/dist/types/net/snapshotCodec.d.ts +55 -0
  127. package/dist/types/net/snapshotCodec.d.ts.map +1 -0
  128. package/dist/types/pixel/Darkness.d.ts +78 -0
  129. package/dist/types/pixel/Darkness.d.ts.map +1 -0
  130. package/dist/types/pixel/Evaporation.d.ts +30 -0
  131. package/dist/types/pixel/Evaporation.d.ts.map +1 -0
  132. package/dist/types/pixel/PixelLayer.d.ts +85 -0
  133. package/dist/types/pixel/PixelLayer.d.ts.map +1 -0
  134. package/dist/types/pixel/index.d.ts +22 -0
  135. package/dist/types/pixel/index.d.ts.map +1 -0
  136. package/dist/types/pixel/lights.d.ts +34 -0
  137. package/dist/types/pixel/lights.d.ts.map +1 -0
  138. package/dist/types/pixel/palette.d.ts +54 -0
  139. package/dist/types/pixel/palette.d.ts.map +1 -0
  140. package/dist/types/pixel/pixel.d.ts +80 -0
  141. package/dist/types/pixel/pixel.d.ts.map +1 -0
  142. package/dist/types/pixel/pixelPaint.d.ts +43 -0
  143. package/dist/types/pixel/pixelPaint.d.ts.map +1 -0
  144. package/dist/types/pixel/pixelTone.d.ts +49 -0
  145. package/dist/types/pixel/pixelTone.d.ts.map +1 -0
  146. package/dist/types/pixel/propKit.d.ts +26 -0
  147. package/dist/types/pixel/propKit.d.ts.map +1 -0
  148. package/dist/types/pixel/ramp.d.ts +31 -0
  149. package/dist/types/pixel/ramp.d.ts.map +1 -0
  150. package/dist/types/pixel/selout.d.ts +3 -0
  151. package/dist/types/pixel/selout.d.ts.map +1 -0
  152. package/dist/types/pixel/spritePixels.d.ts +29 -0
  153. package/dist/types/pixel/spritePixels.d.ts.map +1 -0
  154. package/dist/types/platform/touch.d.ts +5 -0
  155. package/dist/types/platform/touch.d.ts.map +1 -0
  156. package/dist/types/rig/PosePlayer.d.ts +64 -0
  157. package/dist/types/rig/PosePlayer.d.ts.map +1 -0
  158. package/dist/types/rig/RigView.d.ts +68 -0
  159. package/dist/types/rig/RigView.d.ts.map +1 -0
  160. package/dist/types/rig/Skeleton.d.ts +14 -0
  161. package/dist/types/rig/Skeleton.d.ts.map +1 -0
  162. package/dist/types/rig/humanoid.d.ts +4 -0
  163. package/dist/types/rig/humanoid.d.ts.map +1 -0
  164. package/dist/types/rig/humanoidPoses.d.ts +117 -0
  165. package/dist/types/rig/humanoidPoses.d.ts.map +1 -0
  166. package/dist/types/rig/poseMath.d.ts +14 -0
  167. package/dist/types/rig/poseMath.d.ts.map +1 -0
  168. package/dist/types/rig/rigTypes.d.ts +82 -0
  169. package/dist/types/rig/rigTypes.d.ts.map +1 -0
  170. package/dist/types/settings.d.ts +25 -0
  171. package/dist/types/settings.d.ts.map +1 -0
  172. package/dist/types/tilemap/TilemapView.d.ts +42 -0
  173. package/dist/types/tilemap/TilemapView.d.ts.map +1 -0
  174. package/dist/types/tilemap/collision.d.ts +16 -0
  175. package/dist/types/tilemap/collision.d.ts.map +1 -0
  176. package/dist/types/tilemap/tiled.d.ts +104 -0
  177. package/dist/types/tilemap/tiled.d.ts.map +1 -0
  178. package/package.json +82 -4
@@ -0,0 +1,68 @@
1
+ import { Container } from 'pixi.js';
2
+ import type { TextureRegistry } from '../core/TextureRegistry.js';
3
+ import type { Joints, Point, RigDef, RigPose } from './rigTypes.js';
4
+ /** The parts a humanoid rig is drawn with, back to front in this order. */
5
+ export declare const RIG_PARTS: readonly ["upperArmB", "forearmB", "thighB", "shinB", "torso", "thighF", "shinF", "head", "upperArmF", "forearmF"];
6
+ export type RigPart = (typeof RIG_PARTS)[number];
7
+ /**
8
+ * How one part looks. A textured part is an image drawn with its top-centre on the bone's root joint and turned to
9
+ * follow the bone (cut-out animation, any art style); a vector part is a capsule (limbs), a rounded box (torso) or a
10
+ * circle (head) in `color`.
11
+ */
12
+ export interface PartSkin {
13
+ /** Texture key (and frame) in the stage's registry; leave out for a vector part. */
14
+ texture?: string;
15
+ frame?: string | number;
16
+ /** Stretch the image along the bone to the next joint instead of drawing it at its own size. */
17
+ stretch?: boolean;
18
+ /** Where on the image the root joint sits, as a share of its size (default 0.5, 0). */
19
+ anchorX?: number;
20
+ anchorY?: number;
21
+ /** Vector fill (default by part). */
22
+ color?: number;
23
+ /** Vector thickness in grid px (default the rig's `limbWidth`; the torso's width; the head's diameter). */
24
+ width?: number;
25
+ /** Vector outline colour, or null for none (default a dark outline). */
26
+ outline?: number | null;
27
+ }
28
+ export type RigSkin = Partial<Record<RigPart, PartSkin>>;
29
+ export interface RigViewOptions {
30
+ /** World px per grid px (default 1). */
31
+ scale?: number;
32
+ /** Head radius in grid px (default 5) and how far above the chest point its centre sits (default 5.5). */
33
+ headRadius?: number;
34
+ headRise?: number;
35
+ /** A broader build: shoulders set wider. */
36
+ bulky?: boolean;
37
+ }
38
+ /**
39
+ * A character drawn from a rig pose: give it a pose each frame (`setPose`, from a `PosePlayer`) and it places every
40
+ * part. The container's origin is the character's feet (bottom centre of the rig's frame); `facing` mirrors it.
41
+ */
42
+ export declare class RigView extends Container {
43
+ private readonly def;
44
+ private readonly skin;
45
+ private readonly skeleton;
46
+ private readonly sprites;
47
+ private readonly layers;
48
+ private joints;
49
+ private curl;
50
+ private readonly scaleGrid;
51
+ private readonly headRadius;
52
+ private readonly headRise;
53
+ private readonly bulky;
54
+ constructor(def: RigDef, skin?: RigSkin, textures?: TextureRegistry, options?: RigViewOptions);
55
+ /** 1 faces right, -1 faces left. */
56
+ set facing(dir: 1 | -1);
57
+ get facing(): 1 | -1;
58
+ /** The joints of the last pose, in grid px of the rig's frame (for attaching a held item, an effect). */
59
+ get lastJoints(): Joints | null;
60
+ /** Where a joint of the last pose is in this view's parent, in world px. */
61
+ jointInParent(name: keyof Omit<Joints, 'forearm'>): Point | null;
62
+ setPose(pose: RigPose): this;
63
+ destroy(options?: Parameters<Container['destroy']>[0]): void;
64
+ private place;
65
+ /** The two points a part spans: a limb's joints, the torso from chest to hips, the head's centre (twice). */
66
+ private ends;
67
+ }
68
+ //# sourceMappingURL=RigView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RigView.d.ts","sourceRoot":"","sources":["../../../src/rig/RigView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,SAAS,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEjE,2EAA2E;AAC3E,eAAO,MAAM,SAAS,oHAAqH,CAAC;AAC5I,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,gGAAgG;IAChG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,u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C,CAAC,EAErB;IAED,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,CAEnB;IAED,yGAAyG;IACzG,IAAI,UAAU,IAAI,MAAM,GAAG,IAAI,CAE9B;IAED,4EAA4E;IAC5E,aAAa,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,GAAG,IAAI;IAMhE,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAQnB,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAIrE,OAAO,CAAC,KAAK;IAqDb,6GAA6G;IAC7G,OAAO,CAAC,IAAI;CASb"}
@@ -0,0 +1,14 @@
1
+ import type { Joints, Limb, Point, RigDef, RigPose } from './rigTypes.js';
2
+ /** Turns a pose (bone angles and lengths) into joint positions on the character's 20x24 grid. */
3
+ export declare class Skeleton {
4
+ private readonly def;
5
+ constructor(def: RigDef);
6
+ solve(pose: RigPose, bulky?: boolean): Joints;
7
+ /**
8
+ * Elbow, wrist and forearm direction of the front arm (or of its motion smear) hung from `shoulder`. The fist keeps
9
+ * the frame's last column for its outline: an arm reaching past that (a swing, a thrust, a draw on a bulky body) is
10
+ * pulled back whole, so the forearm — and the weapon laid along it — keeps its angle.
11
+ */
12
+ frontArm(shoulder: Point, limb: Limb): [Point, Point, number];
13
+ }
14
+ //# sourceMappingURL=Skeleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../src/rig/Skeleton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAkBvE,iGAAiG;AACjG,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,GAAG,EAAE,MAAM;IAIvB,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,UAAQ,GAAG,MAAM;IAkB3C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC;CAM9D"}
@@ -0,0 +1,4 @@
1
+ import type { RigDef } from './rigTypes.js';
2
+ /** The proportions of the built-in 20×24 humanoid: chest, shoulders, hips and limb width. */
3
+ export declare const HUMANOID_RIG: RigDef;
4
+ //# sourceMappingURL=humanoid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humanoid.d.ts","sourceRoot":"","sources":["../../../src/rig/humanoid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,6FAA6F;AAC7F,eAAO,MAAM,YAAY,EAAE,MAAsB,CAAC"}
@@ -0,0 +1,117 @@
1
+ import type { RigPose } from './rigTypes.js';
2
+ /**
3
+ * The built-in humanoid's pose library: 72 poses for `HUMANOID_RIG`, made for a 20×24 character facing right, and
4
+ * clips that string them into motion. Use them as they are, mix them (`overlay`, `upperOver`), or as the starting
5
+ * point for your own.
6
+ */
7
+ export declare const HUMANOID_POSES: Readonly<Record<string, RigPose>>;
8
+ /** Ready-made clips over `HUMANOID_POSES`. Looping clips blend from their last pose back into the first. */
9
+ export declare const HUMANOID_CLIPS: {
10
+ idle: {
11
+ poses: string[];
12
+ fps: number;
13
+ };
14
+ walk: {
15
+ poses: string[];
16
+ fps: number;
17
+ };
18
+ run: {
19
+ poses: string[];
20
+ fps: number;
21
+ };
22
+ roll: {
23
+ poses: string[];
24
+ fps: number;
25
+ loop: false;
26
+ blend: false;
27
+ };
28
+ dash: {
29
+ poses: string[];
30
+ fps: number;
31
+ loop: false;
32
+ };
33
+ hurt: {
34
+ poses: string[];
35
+ fps: number;
36
+ loop: false;
37
+ };
38
+ dizzy: {
39
+ poses: string[];
40
+ fps: number;
41
+ };
42
+ crouch: {
43
+ poses: string[];
44
+ fps: number;
45
+ loop: false;
46
+ };
47
+ kneel: {
48
+ poses: string[];
49
+ fps: number;
50
+ loop: false;
51
+ };
52
+ sit: {
53
+ poses: string[];
54
+ fps: number;
55
+ loop: false;
56
+ };
57
+ sitGround: {
58
+ poses: string[];
59
+ fps: number;
60
+ loop: false;
61
+ };
62
+ pick: {
63
+ poses: string[];
64
+ fps: number;
65
+ loop: false;
66
+ };
67
+ lookBack: {
68
+ poses: string[];
69
+ fps: number;
70
+ loop: false;
71
+ };
72
+ stretch: {
73
+ poses: string[];
74
+ fps: number;
75
+ loop: false;
76
+ };
77
+ cheer: {
78
+ poses: string[];
79
+ fps: number;
80
+ loop: false;
81
+ };
82
+ wave: {
83
+ poses: string[];
84
+ fps: number;
85
+ };
86
+ dance: {
87
+ poses: string[];
88
+ fps: number;
89
+ };
90
+ slash: {
91
+ poses: string[];
92
+ durations: number[];
93
+ loop: false;
94
+ };
95
+ thrust: {
96
+ poses: string[];
97
+ durations: number[];
98
+ loop: false;
99
+ };
100
+ overhead: {
101
+ poses: string[];
102
+ durations: number[];
103
+ loop: false;
104
+ };
105
+ cast: {
106
+ poses: string[];
107
+ durations: number[];
108
+ loop: false;
109
+ };
110
+ throw: {
111
+ poses: string[];
112
+ durations: number[];
113
+ loop: false;
114
+ };
115
+ };
116
+ export type HumanoidClip = keyof typeof HUMANOID_CLIPS;
117
+ //# sourceMappingURL=humanoidPoses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humanoidPoses.d.ts","sourceRoot":"","sources":["../../../src/rig/humanoidPoses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAI1C;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAA+C,CAAC;AAI7G,4GAA4G;AAC5G,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuBS,CAAC;AAErC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,cAAc,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { RigPose } from './rigTypes.js';
2
+ /**
3
+ * The in-between of two poses at `k` (0 = a, 1 = b): bones turn along the shortest way and stretch, offsets slide.
4
+ * What cannot be in between (face, cape trail, the curled torso) stays `a`'s until `b` is reached.
5
+ */
6
+ export declare function blendPose(a: RigPose, b: RigPose, k: number): RigPose;
7
+ /** `top` laid over `base`: every field `top` sets wins. */
8
+ export declare function overlay(base: RigPose, top: RigPose): RigPose;
9
+ /**
10
+ * An action's upper body over a moving (or seated) body: the arms, head and face act while the legs keep the gait.
11
+ * The chest takes both bobs, but rises at most a pixel so a tall hat keeps its headroom.
12
+ */
13
+ export declare function upperOver(action: RigPose, legs: RigPose): RigPose;
14
+ //# sourceMappingURL=poseMath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poseMath.d.ts","sourceRoot":"","sources":["../../../src/rig/poseMath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,YAAY,CAAC;AAwBhD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAkBpE;AAED,2DAA2D;AAC3D,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAI5D;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAYjE"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * A limb of two bones: [upper angle, upper length, lower angle relative to the upper, lower length]. Angles in
3
+ * degrees in sprite space of a character facing right (0 = forward, 90 = down), lengths in grid pixels.
4
+ */
5
+ export type Limb = [number, number, number, number];
6
+ export type Face = 'blink' | 'happy' | 'tired' | 'dizzy';
7
+ /**
8
+ * A pose of the humanoid rig (a JSON object of bone angles). Every field is optional: a pose that leaves one
9
+ * out takes it from the pose it is laid over (a guard only moves the weapon arm, an attack keeps the running legs).
10
+ */
11
+ export interface RigPose {
12
+ /** Pixels the chest (torso, head, shoulders) sits below its rest height; negative rises. */
13
+ by?: number;
14
+ armF?: Limb;
15
+ armB?: Limb;
16
+ legF?: Limb;
17
+ legB?: Limb;
18
+ /** Offset of both hips from their rest place. */
19
+ hipDx?: number;
20
+ hipDy?: number;
21
+ /** Offset of the head from the chest. */
22
+ headDx?: number;
23
+ headDy?: number;
24
+ face?: Face;
25
+ /** The head faces backwards. */
26
+ lookBack?: boolean;
27
+ /** Pixels the cape and ponytail stream behind while running. */
28
+ trail?: number;
29
+ /** Chest expansion and delayed cloth sway of the breathing cycle. */
30
+ breathe?: boolean;
31
+ sway?: number;
32
+ /** The far arm crosses in front of the body (drawing a bow with both hands). */
33
+ armBFront?: boolean;
34
+ /** Arm the front arm just swept through, left as a translucent smear. */
35
+ smearArm?: Limb;
36
+ /** Tumbling: the torso is a curled ball centred here (grid pixels) instead of standing. */
37
+ curl?: [number, number];
38
+ }
39
+ /** The rig's proportions (`rig/humanoid.json`), in grid pixels of the 20x24 character frame. */
40
+ export interface RigDef {
41
+ /** Art pixels per grid pixel of the rendered body. */
42
+ scale: number;
43
+ width: number;
44
+ height: number;
45
+ /** Top centre of the torso at rest. */
46
+ chest: [number, number];
47
+ shoulderF: [number, number];
48
+ shoulderB: [number, number];
49
+ /** How much further out both shoulders sit on a bulky body. */
50
+ bulkyShoulder: number;
51
+ hipF: [number, number];
52
+ hipB: [number, number];
53
+ /** Thickness of the arms and legs. */
54
+ limbWidth: number;
55
+ /** Brightness of the far leg and the far arm, which stand in the torso's shadow. */
56
+ backShade: number;
57
+ backArmShade: number;
58
+ }
59
+ export interface Point {
60
+ x: number;
61
+ y: number;
62
+ }
63
+ /** Joint positions of one solved pose, in grid pixels (fractional). */
64
+ export interface Joints {
65
+ chest: Point;
66
+ head: Point;
67
+ shoulderF: Point;
68
+ elbowF: Point;
69
+ wristF: Point;
70
+ shoulderB: Point;
71
+ elbowB: Point;
72
+ wristB: Point;
73
+ hipF: Point;
74
+ kneeF: Point;
75
+ ankleF: Point;
76
+ hipB: Point;
77
+ kneeB: Point;
78
+ ankleB: Point;
79
+ /** Direction the front forearm points (radians, sprite space facing right): the line a held weapon follows. */
80
+ forearm: number;
81
+ }
82
+ //# sourceMappingURL=rigTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rigTypes.d.ts","sourceRoot":"","sources":["../../../src/rig/rigTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,4FAA4F;IAC5F,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gEAAgE;IAChE,K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AM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,KAAK,CAAC;IACd,+GAA+G;IAC/G,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The few player settings the engine itself reads. A game keeps its own settings store and mirrors these fields
3
+ * into this one (`engineSettings.set`) whenever they change; the engine never reads the game's store.
4
+ */
5
+ export interface EngineSettings {
6
+ /** Fewer particles and lighter effects. */
7
+ reducedFx: boolean;
8
+ /** Turns off everything that only costs battery: transient lights, heavy particles. */
9
+ batterySaver: boolean;
10
+ /** Short-lived lights a fight throws into the dark (`pixel/lights.ts`). */
11
+ combatLights: boolean;
12
+ /** 0–1, the combat sounds' volume (`audio/SoundEngine.ts`). */
13
+ sfxVolume: number;
14
+ /** 0–1, the music's volume. */
15
+ musicVolume: number;
16
+ }
17
+ export type SettingsListener = (s: EngineSettings) => void;
18
+ /** Same shape as the zustand stores the game used (`getState`, `subscribe`), so moved code reads it unchanged. */
19
+ export declare const engineSettings: {
20
+ getState(): EngineSettings;
21
+ set(patch: Partial<EngineSettings>): void;
22
+ subscribe(listener: SettingsListener): () => void;
23
+ reset(): void;
24
+ };
25
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,SAAS,EAAE,OAAO,CAAC;IACnB,uFAAuF;IACvF,YAAY,EAAE,OAAO,CAAC;IACtB,2EAA2E;IAC3E,YAAY,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;AAa3D,kHAAkH;AAClH,eAAO,MAAM,cAAc;gBACb,cAAc;eAGf,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;wBAIrB,gBAAgB,GAAG,MAAM,IAAI;aAIxC,IAAI;CAGd,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { Container } from 'pixi.js';
2
+ import type { Stage } from '../core/Stage.js';
3
+ import { type TileMap, type Tileset } from './tiled.js';
4
+ export interface TilemapViewOptions {
5
+ /** The texture key holding a tileset's image (loaded with `AssetLoader.image`, or painted). Default: `tileset.name`. */
6
+ textureFor?: (tileset: Tileset) => string;
7
+ /** Tiles per chunk side (default 32): each chunk is painted once into a texture of its own. */
8
+ chunkTiles?: number;
9
+ /** Only these tile layers, by name; default every visible tile layer. */
10
+ layers?: string[];
11
+ /**
12
+ * Depth of the first layer in the world layer; each layer after it one higher. Bodies are usually drawn at their y,
13
+ * so the default keeps the map under every one of them. A layer with a numeric `depth` property is drawn there
14
+ * instead (a roof layer over the bodies: `depth` = 1e6).
15
+ */
16
+ baseDepth?: number;
17
+ /** Where the layers go (default the stage's world layer); a scene passes its `root` so they leave with it. */
18
+ parent?: Container;
19
+ }
20
+ /**
21
+ * Draws a Tiled map's tile layers. Each layer is cut into chunks painted once into textures; a frame only toggles
22
+ * which chunks are in view (`update`), so a map of any size costs a handful of sprites a frame.
23
+ *
24
+ * Animated tiles are drawn on their first frame.
25
+ */
26
+ export declare class TilemapView {
27
+ private readonly stage;
28
+ readonly map: TileMap;
29
+ /** One container per drawn tile layer, by name, each at its own depth among the bodies. */
30
+ readonly layers: Map<string, Container<import("pixi.js").ContainerChild>>;
31
+ private readonly chunks;
32
+ private readonly id;
33
+ constructor(stage: Stage, map: TileMap, options?: TilemapViewOptions);
34
+ /** Shows only the chunks in the camera's view (plus a margin in world px). Call once a frame. */
35
+ update(margin?: number): void;
36
+ /** World size of the map in px. */
37
+ get widthPx(): number;
38
+ get heightPx(): number;
39
+ destroy(): void;
40
+ private paintChunk;
41
+ }
42
+ //# sourceMappingURL=TilemapView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TilemapView.d.ts","sourceRoot":"","sources":["../../../src/tilemap/TilemapView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAA4D,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAE/G,MAAM,WAAW,kBAAkB;IACjC,wHAAwH;IACxH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC;IAC1C,+FAA+F;IAC/F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8GAA8G;IAC9G,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAID;;;;;GAKG;AACH,qBAAa,WAAW;IAOpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,QAAQ,CAAC,GAAG,EAAE,OAAO;IAPvB,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,2DAAgC;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqF;IAC5G,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAc;gBAGd,KAAK,EAAE,KAAK,EACpB,GAAG,EAAE,OAAO,EACrB,OAAO,GAAE,kBAAuB;IA0BlC,iGAAiG;IACjG,MAAM,CAAC,MAAM,SAAK,GAAG,IAAI;IAOzB,mCAAmC;IACnC,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,OAAO,IAAI,IAAI;IAOf,OAAO,CAAC,UAAU;CA0CnB"}
@@ -0,0 +1,16 @@
1
+ import { type CollisionGrid, type CollisionGridOptions } from '../net/movement.js';
2
+ import { type TileMap } from './tiled.js';
3
+ export interface TiledCollisionOptions extends Omit<CollisionGridOptions, 'ground'> {
4
+ /**
5
+ * What makes a cell solid:
6
+ * - a layer name: every non-empty cell of that tile layer is solid (a hidden "collision" layer is the usual way);
7
+ * - `{ property }`: a cell is solid when its tile has that custom property set to true, on any tile layer.
8
+ * Default: the layer named "collision" if there is one, else tiles with a `solid` property.
9
+ */
10
+ solid?: string | {
11
+ property: string;
12
+ };
13
+ }
14
+ /** The `CollisionGrid` of a Tiled map, for `stepMover`; cells are the map's tiles. */
15
+ export declare function collisionFromTiled(map: TileMap, options?: TiledCollisionOptions): CollisionGrid;
16
+ //# sourceMappingURL=collision.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collision.d.ts","sourceRoot":"","sources":["../../../src/tilemap/collision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC;IACjF;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC;AAED,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,GAAE,qBAA0B,GAAG,aAAa,CAsBnG"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Maps made in Tiled (https://www.mapeditor.org), read from its JSON format (`.tmj`, or `.json`). Supported:
3
+ * orthogonal, finite maps; tile layers as CSV arrays or uncompressed base64; object layers; group layers (flattened);
4
+ * custom properties; flipped tiles. Not supported (refused with a message saying so): infinite maps, compressed layer
5
+ * data, isometric and hexagonal maps, external `.tsj` tilesets (embed them: Map → Embed Tilesets).
6
+ *
7
+ * Pure: no Pixi, no DOM, so a server can read the same map for collision.
8
+ */
9
+ /** The three flags Tiled keeps in a gid's high bits; the rest is the tile id. */
10
+ export declare const FLIP_H = 2147483648;
11
+ export declare const FLIP_V = 1073741824;
12
+ export declare const FLIP_D = 536870912;
13
+ export type TiledPropertyValue = string | number | boolean;
14
+ export type Properties = Record<string, TiledPropertyValue>;
15
+ export interface TileLayer {
16
+ kind: 'tiles';
17
+ name: string;
18
+ /** Row-major gids (0 = empty), flip flags kept. Read the tile id with `gidOf`. */
19
+ data: Uint32Array;
20
+ visible: boolean;
21
+ opacity: number;
22
+ offsetX: number;
23
+ offsetY: number;
24
+ properties: Properties;
25
+ }
26
+ export interface MapObject {
27
+ id: number;
28
+ name: string;
29
+ type: string;
30
+ x: number;
31
+ y: number;
32
+ width: number;
33
+ height: number;
34
+ rotation: number;
35
+ /** A tile object's gid, if it is one. */
36
+ gid?: number;
37
+ point: boolean;
38
+ ellipse: boolean;
39
+ polygon?: {
40
+ x: number;
41
+ y: number;
42
+ }[];
43
+ properties: Properties;
44
+ }
45
+ export interface ObjectLayer {
46
+ kind: 'objects';
47
+ name: string;
48
+ objects: MapObject[];
49
+ visible: boolean;
50
+ properties: Properties;
51
+ }
52
+ export type MapLayer = TileLayer | ObjectLayer;
53
+ export interface Tileset {
54
+ name: string;
55
+ firstGid: number;
56
+ /** The image's path as written in the map, relative to the map file. */
57
+ image: string;
58
+ imageWidth: number;
59
+ imageHeight: number;
60
+ tileWidth: number;
61
+ tileHeight: number;
62
+ columns: number;
63
+ tileCount: number;
64
+ margin: number;
65
+ spacing: number;
66
+ /** Per local tile id: its custom properties. */
67
+ tileProperties: Map<number, Properties>;
68
+ /** Per local tile id: an animation (local tile ids and how long each shows, ms). */
69
+ animations: Map<number, {
70
+ tileId: number;
71
+ duration: number;
72
+ }[]>;
73
+ properties: Properties;
74
+ }
75
+ export interface TileMap {
76
+ width: number;
77
+ height: number;
78
+ tileWidth: number;
79
+ tileHeight: number;
80
+ layers: MapLayer[];
81
+ tilesets: Tileset[];
82
+ properties: Properties;
83
+ backgroundColor?: string;
84
+ }
85
+ /** The tile id of a gid, without its flip flags. */
86
+ export declare const gidOf: (raw: number) => number;
87
+ /** Which tileset a gid belongs to, and the tile's id inside it; null for an empty cell or an unknown gid. */
88
+ export declare function tileAt(map: TileMap, raw: number): {
89
+ tileset: Tileset;
90
+ local: number;
91
+ } | null;
92
+ /** Where tile `local` sits in its tileset image. */
93
+ export declare function tileRect(ts: Tileset, local: number): {
94
+ x: number;
95
+ y: number;
96
+ w: number;
97
+ h: number;
98
+ };
99
+ export declare function layerByName(map: TileMap, name: string): MapLayer | undefined;
100
+ /** Every object of every object layer (optionally only those of one `type`/class). */
101
+ export declare function objectsOf(map: TileMap, type?: string): MapObject[];
102
+ /** Reads a Tiled JSON map (already parsed with `JSON.parse`). Throws a `Tiled map: …` error saying what is wrong. */
103
+ export declare function parseTiled(json: unknown): TileMap;
104
+ //# sourceMappingURL=tiled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tiled.d.ts","sourceRoot":"","sources":["../../../src/tilemap/tiled.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,iFAAiF;AACjF,eAAO,MAAM,MAAM,aAAa,CAAC;AACjC,eAAO,MAAM,MAAM,aAAa,CAAC;AACjC,eAAO,MAAM,MAAM,YAAa,CAAC;AAGjC,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAC3D,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAE5D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,O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qHAAqH;AACrH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAoBjD"}
package/package.json CHANGED
@@ -1,6 +1,84 @@
1
1
  {
2
2
  "name": "lantern-engine",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.0",
4
+ "description": "A 2D game engine on PixiJS 8 for any art style: scenes and a fast ECS, a fixed-step loop, asset loading, Tiled maps, sprite animation, input actions, camera follow, audio and deterministic, server-replayable movement, plus Dither, an optional pixel-art module (pixel-perfect effects, dithered lighting).",
5
+ "type": "module",
6
+ "types": "./dist/types/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/types/index.d.ts",
10
+ "import": "./dist/lantern-engine.js"
11
+ },
12
+ "./pixel": {
13
+ "types": "./dist/types/pixel/index.d.ts",
14
+ "import": "./dist/pixel.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
18
+ "scripts": {
19
+ "dev": "vite",
20
+ "build": "npm run clean && vite build && tsc -p tsconfig.build.json && node scripts/fix-dts-extensions.mjs",
21
+ "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
22
+ "typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
23
+ "test": "node scripts/test.mjs",
24
+ "check": "npm run typecheck && npm test && npm run build",
25
+ "prepublishOnly": "npm run check",
26
+ "bench": "node --expose-gc --import tsx bench/ecs.bench.ts",
27
+ "example:server": "tsx examples/multiplayer/server.ts",
28
+ "docs:examples": "node scripts/build-examples.mjs",
29
+ "docs:dev": "npm run docs:prepare && vitepress dev docs",
30
+ "docs:build": "npm run docs:prepare && npm run docs:examples && vitepress build docs",
31
+ "docs:preview": "vitepress preview docs",
32
+ "docs:prepare": "typedoc && node -e \"require('fs').copyFileSync('CHANGELOG.md','docs/changelog.md')\""
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^22.0.0",
36
+ "@types/ws": "^8.18.2",
37
+ "pixi.js": "^8.21.0",
38
+ "tsx": "^4.20.5",
39
+ "typedoc": "^0.28.20",
40
+ "typedoc-plugin-markdown": "^4.13.1",
41
+ "typedoc-vitepress-theme": "^1.1.4",
42
+ "typescript": "^5.9.2",
43
+ "vite": "^7.1.4",
44
+ "vitepress": "^1.6.4",
45
+ "ws": "^8.22.0"
46
+ },
47
+ "license": "MIT",
48
+ "keywords": [
49
+ "game-engine",
50
+ "2d",
51
+ "pixijs",
52
+ "ecs",
53
+ "tiled",
54
+ "pixel-art",
55
+ "gamedev",
56
+ "multiplayer",
57
+ "typescript"
58
+ ],
59
+ "sideEffects": [
60
+ "./dist/*.js"
61
+ ],
62
+ "module": "./dist/lantern-engine.js",
63
+ "files": [
64
+ "dist",
65
+ "README.md",
66
+ "LICENSE",
67
+ "CHANGELOG.md"
68
+ ],
69
+ "engines": {
70
+ "node": ">=22"
71
+ },
72
+ "peerDependencies": {
73
+ "pixi.js": "^8.6.0"
74
+ },
75
+ "repository": {
76
+ "type": "git",
77
+ "url": "git+https://github.com/Phadec/lantern-engine.git"
78
+ },
79
+ "homepage": "https://phadec.github.io/lantern-engine/",
80
+ "bugs": {
81
+ "url": "https://github.com/Phadec/lantern-engine/issues"
82
+ },
83
+ "author": "Phadec"
84
+ }