@gamedevland/engine 0.0.7 → 0.0.9

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/CHANGELOG.md ADDED
@@ -0,0 +1,40 @@
1
+ # Changelog
2
+
3
+ ## 0.0.9 — 2026-11-05
4
+
5
+ - Add opt-in `screen.dpr: 'native'` to target the viewport's physical pixels.
6
+ - Add `screen.render.maxCanvasPixels` to limit the backing canvas area.
7
+ - Apply size and resolution in one renderer resize. Existing numeric and `'auto'` DPR defaults stay the same.
8
+
9
+ ## 0.0.8 — 2026-11-04
10
+
11
+ - Publish the SDK source and package under MIT with public repository metadata.
12
+ - Preserve the consumer Vite platform define in the compiled runtime.
13
+ - Signal loading completion after initial scene entry; support explicit completion for loading scenes.
14
+ - Add `AssetManager.loadRequiredBundle()` for mandatory bundle validation.
15
+ - Route unpressed mouse hover through the public input events.
16
+ - Release audio listeners and owned displacement filters on terminal lifecycle paths.
17
+ - Make particle component cleanup tolerate earlier scene subtree disposal.
18
+ - Keep GameDistribution video pause/resume under engine ownership and stop the loading watchdog
19
+ after a video starts; ignore stale request continuations.
20
+
21
+ ## 0.0.7
22
+
23
+ - Expose runtime activity and native pointer metadata.
24
+ - Dispose spawned prefab logical children idempotently and release their registry entries.
25
+
26
+ ## 0.0.5
27
+
28
+ - Prepare automated npm publishing.
29
+
30
+ ## 0.0.4
31
+
32
+ - Update package homepage and issue-tracker metadata.
33
+
34
+ ## 0.0.3
35
+
36
+ - Update repository metadata.
37
+
38
+ ## 0.0.2
39
+
40
+ - Add drag-end reasons and renderer-independent local node bounds.
package/README.md CHANGED
@@ -10,6 +10,12 @@ The npm package intentionally ships a compact public distribution:
10
10
 
11
11
  Source files are available in [the SDK repository](https://github.com/gamedevland/sdk/tree/main/packages/engine/src); the npm archive contains the compiled distribution.
12
12
 
13
+ ## Changelog
14
+
15
+ **0.0.9** adds opt-in viewport-native rendering and a configurable canvas pixel
16
+ budget. Existing DPR defaults stay the same.
17
+ [Full engine changelog](https://github.com/gamedevland/sdk/blob/main/packages/engine/CHANGELOG.md).
18
+
13
19
  ## Install
14
20
 
15
21
  ```bash
@@ -44,8 +50,48 @@ For `dragend` input events, `InputEventBase.dragEndReason` distinguishes a norma
44
50
 
45
51
  Layout nodes expose `getLocalBounds()` for renderer-independent local geometry queries.
46
52
 
53
+ ## Screen resolution
54
+
55
+ Logical landscape and portrait profiles define the game's coordinate system.
56
+ Set `system.screen.dpr: 'native'` to scale the backing canvas to the physical
57
+ pixels of the viewport, including when the game is embedded in an iframe.
58
+ For this mode, `maxDpr` caps the display density relative to CSS pixels.
59
+ Existing numeric `dpr` values and `'auto'` still multiply the logical canvas size.
60
+
61
+ Set `system.screen.render.maxCanvasPixels` to a positive integer to limit the
62
+ backing canvas area. The engine scales both axes together and preserves the
63
+ logical layout and pointer coordinates. Extremely small budgets may be exceeded
64
+ when required to keep both axes at least one pixel. This option caps the main
65
+ canvas independently of the optional `render.scaleFactor` pass.
66
+
47
67
  ## TypeScript
48
68
 
69
+ ### Platform packaging and boot (0.0.8)
70
+
71
+ The packaged runtime preserves `import.meta.env.VITE_PLATFORM` for the consuming
72
+ game's Vite build. Loading completion is reported after the initial scene and its
73
+ assets are ready. Consumers remain responsible for gameplay start/stop signals.
74
+
75
+ For an initial loading scene, set `system.boot.autoLoadingFinished: false`.
76
+ Call `engine.platform.loadingFinished()` after the gameplay scene and all required
77
+ assets are ready. The default remains automatic completion after the initial scene.
78
+
79
+ `assets.loadRequiredBundle(name)` loads with the usual cache/retries and rejects
80
+ if any resource remains unavailable. Use it for mandatory loading-screen bundles;
81
+ the existing `loadBundle(name)` behavior is unchanged.
82
+
83
+ `particles.hasEmitter(handle)` reports whether scene cleanup has already released
84
+ a handle. `ParticleEmitterComponent` tolerates prior subtree cleanup on disable/detach
85
+ and recreates a removed emitter when enabled again; invalid direct manager calls still fail fast.
86
+
87
+ ### Resource cleanup (0.0.8)
88
+
89
+ Audio handles release their end/stop/playerror subscriptions on every terminal path,
90
+ including explicit stop, channel stop, source unload and disposal. Loop boundaries
91
+ and pause keep subscriptions until playback actually terminates.
92
+ Displacement components destroy their owned filters on disable/detach while keeping
93
+ asset-owned textures and shared shader programs alive. No consumer API changes are required.
94
+
49
95
  ### Runtime activity and pointer metadata (0.0.6)
50
96
 
51
97
  Version 0.0.7 makes spawned prefab disposal idempotent and removes the logical
package/dist/sdk.d.ts CHANGED
@@ -169,6 +169,8 @@ export declare class AssetManager {
169
169
  * @param name Bundle name.
170
170
  */
171
171
  loadBundle(name: string): Promise<void>;
172
+ /** Loads a bundle and rejects if any required resource failed, including after loader retries. */
173
+ loadRequiredBundle(name: string): Promise<void>;
172
174
  /**
173
175
  * Core loading routine that resolves descriptors and loads them with bounded concurrency.
174
176
  * Uses an internal queue and a dynamic pool of running promises.
@@ -1507,6 +1509,8 @@ export declare class ParticlesManager {
1507
1509
  destroyAll(): void;
1508
1510
  destroyInSubtree(rootView: PixiContainer): void;
1509
1511
  getActiveEmitterCount(): number;
1512
+ /** Whether a handle still belongs to this manager, including after scene subtree cleanup. */
1513
+ hasEmitter(handle: ParticleHandle): boolean;
1510
1514
  tick(dt: number): void;
1511
1515
  private createHandle;
1512
1516
  private getRequiredEmitter;
@@ -1995,6 +1999,7 @@ export declare class InputManager {
1995
1999
  private onPointerDown;
1996
2000
  /**
1997
2001
  * Native pointermove handler: updates pointer state and emits dragstart/drag/pointermove depending on thresholds.
2002
+ * Unpressed mouse movement emits hover pointermove without allocating tracked pointer state.
1998
2003
  * Drag recognition starts when movement exceeds `dragStartDistance`.
1999
2004
  */
2000
2005
  private onPointerMove;
@@ -2211,16 +2216,20 @@ export interface ScreenProfile {
2211
2216
  }
2212
2217
  export interface ScreenRenderConfig {
2213
2218
  scaleFactor?: number;
2219
+ /** Maximum backing canvas area in physical pixels. Independent of scaleFactor. */
2220
+ maxCanvasPixels?: number;
2214
2221
  }
2215
2222
  /**
2216
2223
  * Main configuration for screen behavior.
2217
2224
  * - `land`/`port`: virtual profiles for each orientation.
2218
- * - `dpr`: renderer resolution; 'auto' or a fixed number. Default is 1.
2225
+ * - `dpr`: fixed renderer resolution, 'auto' for browser DPR in virtual units,
2226
+ * or 'native' to target physical viewport pixels. Default is 1.
2227
+ * - `maxDpr`: caps the browser DPR in 'auto' and 'native' modes.
2219
2228
  */
2220
2229
  export interface ScreenConfig {
2221
2230
  land: ScreenProfile;
2222
2231
  port: ScreenProfile;
2223
- dpr?: "auto" | number;
2232
+ dpr?: "auto" | "native" | number;
2224
2233
  maxDpr?: number;
2225
2234
  render?: ScreenRenderConfig;
2226
2235
  }
@@ -2241,7 +2250,7 @@ export interface VirtualSize {
2241
2250
  export interface ScreenStateSnapshot {
2242
2251
  orientation: Orientation;
2243
2252
  viewport: ViewportSize;
2244
- /** Internal canvas size (the <canvas width/height> attributes), px. */
2253
+ /** Logical canvas size, before renderer resolution is applied. */
2245
2254
  canvas: {
2246
2255
  width: number;
2247
2256
  height: number;
@@ -2314,8 +2323,7 @@ export declare class ScreenManager {
2314
2323
  private applySnapshot;
2315
2324
  /**
2316
2325
  * Applies the current snapshot to the PIXI renderer and stage:
2317
- * - Sets device pixel ratio (renderer.resolution)
2318
- * - Resizes the internal canvas to the computed virtual size
2326
+ * - Resizes the renderer using the virtual size and backing canvas resolution
2319
2327
  * - Does NOT scale the stage: scaling is expected to be done via CSS size of the canvas
2320
2328
  */
2321
2329
  private applyToStage;
@@ -2326,12 +2334,7 @@ export declare class ScreenManager {
2326
2334
  onChange(handler: (snapshot: ScreenStateSnapshot) => void): () => void;
2327
2335
  /** Notifies subscribers with a cloned snapshot to prevent outside mutation. */
2328
2336
  private notifyChange;
2329
- /**
2330
- * Resolves the device pixel ratio to use for the renderer's resolution.
2331
- * - `dpr: 'auto'` uses the browser DPR (retina-aware).
2332
- * - numeric `dpr` uses the provided fixed value.
2333
- * - missing/invalid values fall back to 1.
2334
- */
2337
+ private resolveResolution;
2335
2338
  private resolveDpr;
2336
2339
  /**
2337
2340
  * Returns the center point of the virtual canvas in virtual coordinates.
@@ -3913,6 +3916,8 @@ export interface GameConfig {
3913
3916
  };
3914
3917
  /** Deterministic engine boot preload plan for JSON configs. */
3915
3918
  boot?: {
3919
+ /** Defaults to true. Set false for a loading scene; signal platform.loadingFinished() when gameplay is ready. */
3920
+ autoLoadingFinished?: boolean;
3916
3921
  configs?: {
3917
3922
  /** Bundle names preloaded into ConfigStore once at engine start. */
3918
3923
  engineStartBundles?: readonly string[];