@zakkster/lite-tools 2.0.9 → 2.0.10
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/LiteEngine.d.ts +3 -3
- package/LiteEngine.js +4 -4
- package/README.md +2 -2
- package/package.json +1 -1
package/LiteEngine.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ export { Seek, Flee, Wander, Arrive, Pursuit, Evade, PathFollow, Separation, Ali
|
|
|
113
113
|
export { BitmapFont } from '@zakkster/lite-bmfont';
|
|
114
114
|
export { InputPoller } from '@zakkster/lite-gamepad';
|
|
115
115
|
export { CinematicCamera } from '@zakkster/lite-camera';
|
|
116
|
-
export {
|
|
116
|
+
export { SpatialGrid } from '@zakkster/lite-spatial';
|
|
117
117
|
export { testPolygonPolygon, translatePoly, rotatePoly } from '@zakkster/lite-sat';
|
|
118
118
|
export { Pathfinder } from '@zakkster/lite-path';
|
|
119
119
|
export { ShadowCaster } from '@zakkster/lite-shadow';
|
|
@@ -147,7 +147,7 @@ import type {FPSMeter} from 'lite-fps-meter';
|
|
|
147
147
|
import type {PointerTracker} from 'lite-pointer-tracker';
|
|
148
148
|
import type {BitmapFont} from '@zakkster/lite-bmfont';
|
|
149
149
|
import type {CinematicCamera} from '@zakkster/lite-camera';
|
|
150
|
-
import type {
|
|
150
|
+
import type {SpatialGrid} from '@zakkster/lite-spatial';
|
|
151
151
|
import type {EmberEngine} from '@zakkster/lite-embers';
|
|
152
152
|
import type {SmokeEngine} from '@zakkster/lite-smoke';
|
|
153
153
|
import type {RainEngine} from '@zakkster/lite-rain';
|
|
@@ -338,7 +338,7 @@ export interface DungeonGeneratorResult extends Destroyable {
|
|
|
338
338
|
grid: Uint8Array;
|
|
339
339
|
width: number;
|
|
340
340
|
height: number;
|
|
341
|
-
spatial:
|
|
341
|
+
spatial: SpatialGrid;
|
|
342
342
|
isWalkable(x: number, y: number): boolean;
|
|
343
343
|
findPath(sx: number, sy: number, ex: number, ey: number): Array<{ x: number; y: number }> | null;
|
|
344
344
|
renderToCanvas(ctx: CanvasRenderingContext2D, tileSize?: number): void;
|
package/LiteEngine.js
CHANGED
|
@@ -114,7 +114,7 @@ export {
|
|
|
114
114
|
export {BitmapFont} from '@zakkster/lite-bmfont';
|
|
115
115
|
export {InputPoller} from '@zakkster/lite-gamepad';
|
|
116
116
|
export {CinematicCamera} from '@zakkster/lite-camera';
|
|
117
|
-
export {
|
|
117
|
+
export {SpatialGrid} from '@zakkster/lite-spatial';
|
|
118
118
|
export {testPolygonPolygon, translatePoly, rotatePoly} from '@zakkster/lite-sat';
|
|
119
119
|
export {Pathfinder} from '@zakkster/lite-path';
|
|
120
120
|
export {ShadowCaster} from '@zakkster/lite-shadow';
|
|
@@ -173,7 +173,7 @@ import {Flock, Wander, Separation, Alignment, Cohesion} from '@zakkster/lite-ste
|
|
|
173
173
|
import {BitmapFont} from '@zakkster/lite-bmfont';
|
|
174
174
|
import {InputPoller} from '@zakkster/lite-gamepad';
|
|
175
175
|
import {CinematicCamera} from '@zakkster/lite-camera';
|
|
176
|
-
import {
|
|
176
|
+
import {SpatialGrid} from '@zakkster/lite-spatial';
|
|
177
177
|
import {Pathfinder} from '@zakkster/lite-path';
|
|
178
178
|
import {WFC} from '@zakkster/lite-wfc';
|
|
179
179
|
import {AudioPool} from '@zakkster/lite-audio-pool';
|
|
@@ -1069,7 +1069,7 @@ export const Recipes = {
|
|
|
1069
1069
|
const {width = 32, height = 32, seed = Date.now()} = options;
|
|
1070
1070
|
const rng = new Random(seed);
|
|
1071
1071
|
const grid = new Uint8Array(width * height); // 0=wall, 1=floor
|
|
1072
|
-
const spatial = new
|
|
1072
|
+
const spatial = new SpatialGrid(width * 4, height * 4, 32);
|
|
1073
1073
|
|
|
1074
1074
|
// Simple noise-based dungeon
|
|
1075
1075
|
for (let y = 0; y < height; y++) {
|
|
@@ -1195,7 +1195,7 @@ export const Recipes = {
|
|
|
1195
1195
|
const ctx = canvas.getContext('2d');
|
|
1196
1196
|
const rng = new Random(seed);
|
|
1197
1197
|
const w = canvas.width, h = canvas.height;
|
|
1198
|
-
const spatial = new
|
|
1198
|
+
const spatial = new SpatialGrid(w, h, 64);
|
|
1199
1199
|
const agents = [];
|
|
1200
1200
|
|
|
1201
1201
|
for (let i = 0; i < count; i++) {
|
package/README.md
CHANGED
|
@@ -467,7 +467,7 @@ dungeon.spatial.insert(enemy, enemy.x, enemy.y, 8, 8);
|
|
|
467
467
|
const nearby = dungeon.spatial.query(player.x - 64, player.y - 64, 128, 128);
|
|
468
468
|
```
|
|
469
469
|
|
|
470
|
-
**Composes:** `Random` + `
|
|
470
|
+
**Composes:** `Random` + `SpatialGrid` + `Pathfinder`
|
|
471
471
|
|
|
472
472
|
</details>
|
|
473
473
|
|
|
@@ -538,7 +538,7 @@ boids.agents.forEach(a => {
|
|
|
538
538
|
});
|
|
539
539
|
```
|
|
540
540
|
|
|
541
|
-
**Composes:** `
|
|
541
|
+
**Composes:** `SpatialGrid` (O(1) neighbor lookup) + separation/alignment/cohesion forces + `Random`
|
|
542
542
|
|
|
543
543
|
</details>
|
|
544
544
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakkster/lite-tools",
|
|
3
3
|
"author": "Zahary Shinikchiev <shinikchiev@yahoo.com>",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.10",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "The standard library for high-performance web presentation — 45+ micro-libraries, 24 recipes, zero-GC, deterministic, tree-shakeable.",
|
|
7
7
|
"type": "module",
|