@v12-engine/engine 0.0.0-stage → 0.1.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 (341) hide show
  1. package/LICENSE +21 -0
  2. package/dist/abilities/buffs.d.ts +83 -0
  3. package/dist/abilities/castTold.d.ts +12 -0
  4. package/dist/abilities/charges.d.ts +28 -0
  5. package/dist/abilities/dispel.d.ts +9 -0
  6. package/dist/abilities/effectFields.d.ts +10 -0
  7. package/dist/abilities/effects/buff.d.ts +8 -0
  8. package/dist/abilities/effects/core.d.ts +1 -0
  9. package/dist/abilities/effects/damage.d.ts +1 -0
  10. package/dist/abilities/effects/heal.d.ts +2 -0
  11. package/dist/abilities/effects/missile.d.ts +1 -0
  12. package/dist/abilities/effects/moves.d.ts +11 -0
  13. package/dist/abilities/effects/passives.d.ts +15 -0
  14. package/dist/abilities/effects/sight.d.ts +4 -0
  15. package/dist/abilities/effects/spawn.d.ts +2 -0
  16. package/dist/abilities/effects/timed.d.ts +4 -0
  17. package/dist/abilities/effects/trade.d.ts +1 -0
  18. package/dist/abilities/effects.d.ts +122 -0
  19. package/dist/abilities/land.d.ts +21 -0
  20. package/dist/abilities/scaled.d.ts +21 -0
  21. package/dist/abilities/text.d.ts +113 -0
  22. package/dist/ai/area.d.ts +53 -0
  23. package/dist/ai/brain.d.ts +528 -0
  24. package/dist/ai/budget.d.ts +67 -0
  25. package/dist/ai/checks.d.ts +115 -0
  26. package/dist/ai/computer.d.ts +166 -0
  27. package/dist/ai/defence.d.ts +108 -0
  28. package/dist/ai/define.d.ts +21 -0
  29. package/dist/ai/economy.d.ts +129 -0
  30. package/dist/ai/geometry.d.ts +35 -0
  31. package/dist/ai/goals.d.ts +360 -0
  32. package/dist/ai/index.d.ts +38 -0
  33. package/dist/ai/knowledge.d.ts +418 -0
  34. package/dist/ai/lanes.d.ts +232 -0
  35. package/dist/ai/melee/build.d.ts +61 -0
  36. package/dist/ai/melee/goals.d.ts +299 -0
  37. package/dist/ai/melee/heroes.d.ts +27 -0
  38. package/dist/ai/melee/index.d.ts +14 -0
  39. package/dist/ai/melee/production.d.ts +8 -0
  40. package/dist/ai/melee/surrender.d.ts +24 -0
  41. package/dist/ai/micro.d.ts +278 -0
  42. package/dist/ai/mission.d.ts +195 -0
  43. package/dist/ai/missionRules.d.ts +18 -0
  44. package/dist/ai/module.d.ts +116 -0
  45. package/dist/ai/options.d.ts +61 -0
  46. package/dist/ai/plans/build.d.ts +280 -0
  47. package/dist/ai/plans/placement.d.ts +82 -0
  48. package/dist/ai/plans/plans.d.ts +105 -0
  49. package/dist/ai/plans/production.d.ts +210 -0
  50. package/dist/ai/plans/purse.d.ts +73 -0
  51. package/dist/ai/plans/tech.d.ts +37 -0
  52. package/dist/ai/profiles.d.ts +204 -0
  53. package/dist/ai/reach.d.ts +4 -0
  54. package/dist/ai/report.d.ts +203 -0
  55. package/dist/ai/roles.d.ts +133 -0
  56. package/dist/ai/rules.d.ts +288 -0
  57. package/dist/ai/scouting.d.ts +98 -0
  58. package/dist/ai/settings.d.ts +73 -0
  59. package/dist/ai/squads.d.ts +429 -0
  60. package/dist/ai/strength.d.ts +167 -0
  61. package/dist/ai/task.d.ts +118 -0
  62. package/dist/ai/tasks/attack.d.ts +7 -0
  63. package/dist/ai/tasks/capture.d.ts +21 -0
  64. package/dist/ai/tasks/creep.d.ts +16 -0
  65. package/dist/ai/tasks/defend.d.ts +29 -0
  66. package/dist/ai/tasks/drop.d.ts +34 -0
  67. package/dist/ai/tasks/escort.d.ts +16 -0
  68. package/dist/ai/tasks/gather.d.ts +23 -0
  69. package/dist/ai/tasks/harass.d.ts +7 -0
  70. package/dist/ai/tasks/hold.d.ts +20 -0
  71. package/dist/ai/tasks/index.d.ts +32 -0
  72. package/dist/ai/tasks/move.d.ts +19 -0
  73. package/dist/ai/tasks/patrol.d.ts +8 -0
  74. package/dist/ai/tasks/retreat.d.ts +20 -0
  75. package/dist/ai/tasks/scout.d.ts +29 -0
  76. package/dist/ai/tasks/shared.d.ts +74 -0
  77. package/dist/ai/team.d.ts +155 -0
  78. package/dist/ai/threat.d.ts +91 -0
  79. package/dist/ai/view.d.ts +366 -0
  80. package/dist/ai/waves.d.ts +126 -0
  81. package/dist/ai.js +6239 -0
  82. package/dist/ai.js.map +1 -0
  83. package/dist/aiTesting.d.ts +179 -0
  84. package/dist/areas.d.ts +149 -0
  85. package/dist/attacks.d.ts +66 -0
  86. package/dist/attributes.d.ts +66 -0
  87. package/dist/brain-BvVdUhX8.js +7659 -0
  88. package/dist/brain-BvVdUhX8.js.map +1 -0
  89. package/dist/builds-C6LfgvEU.js +460 -0
  90. package/dist/builds-C6LfgvEU.js.map +1 -0
  91. package/dist/bytes.d.ts +6 -0
  92. package/dist/camps.d.ts +95 -0
  93. package/dist/capture.d.ts +131 -0
  94. package/dist/cellLayers.d.ts +75 -0
  95. package/dist/cinematics.d.ts +194 -0
  96. package/dist/clock.d.ts +32 -0
  97. package/dist/commands.d.ts +235 -0
  98. package/dist/components.d.ts +184 -0
  99. package/dist/computers.d.ts +108 -0
  100. package/dist/concealment.d.ts +61 -0
  101. package/dist/coreComponents-syuh2fPG.js +5149 -0
  102. package/dist/coreComponents-syuh2fPG.js.map +1 -0
  103. package/dist/coreComponents.d.ts +1 -0
  104. package/dist/dashing.d.ts +8 -0
  105. package/dist/debug.d.ts +36 -0
  106. package/dist/debug.js +3 -0
  107. package/dist/debugCommands-CzjrSm66.js +14739 -0
  108. package/dist/debugCommands-CzjrSm66.js.map +1 -0
  109. package/dist/debugCommands.d.ts +213 -0
  110. package/dist/debugging.d.ts +10 -0
  111. package/dist/definitions.d.ts +43 -0
  112. package/dist/defs.d.ts +1162 -0
  113. package/dist/denying.d.ts +81 -0
  114. package/dist/destructibles.d.ts +27 -0
  115. package/dist/determinism-BCymQwiE.js +518 -0
  116. package/dist/determinism-BCymQwiE.js.map +1 -0
  117. package/dist/determinism.d.ts +121 -0
  118. package/dist/dialog.d.ts +94 -0
  119. package/dist/effectRefs.d.ts +16 -0
  120. package/dist/effects.d.ts +80 -0
  121. package/dist/endings.d.ts +22 -0
  122. package/dist/engagement.d.ts +108 -0
  123. package/dist/engineEvents.d.ts +710 -0
  124. package/dist/entity.d.ts +409 -0
  125. package/dist/entityIndex.d.ts +50 -0
  126. package/dist/errors.d.ts +85 -0
  127. package/dist/events.d.ts +97 -0
  128. package/dist/exactMath.d.ts +63 -0
  129. package/dist/features.d.ts +10 -0
  130. package/dist/fields.d.ts +114 -0
  131. package/dist/fixture.d.ts +17 -0
  132. package/dist/fog.d.ts +110 -0
  133. package/dist/formation.d.ts +111 -0
  134. package/dist/friendlyFire.d.ts +26 -0
  135. package/dist/game-DiJEN-Ks.js +5800 -0
  136. package/dist/game-DiJEN-Ks.js.map +1 -0
  137. package/dist/game.d.ts +501 -0
  138. package/dist/gameData.d.ts +325 -0
  139. package/dist/gameFiles.d.ts +26 -0
  140. package/dist/gates.d.ts +28 -0
  141. package/dist/generate.d.ts +403 -0
  142. package/dist/generateWorker.d.ts +39 -0
  143. package/dist/grid.d.ts +53 -0
  144. package/dist/ground.d.ts +127 -0
  145. package/dist/groundSpeed.d.ts +22 -0
  146. package/dist/hero.d.ts +177 -0
  147. package/dist/home.d.ts +14 -0
  148. package/dist/hooks.d.ts +780 -0
  149. package/dist/hotReload.d.ts +76 -0
  150. package/dist/ids.d.ts +26 -0
  151. package/dist/index.d.ts +227 -0
  152. package/dist/index.js +4701 -0
  153. package/dist/index.js.map +1 -0
  154. package/dist/inspect-D9dWHmZ0.js +491 -0
  155. package/dist/inspect-D9dWHmZ0.js.map +1 -0
  156. package/dist/inspect.d.ts +176 -0
  157. package/dist/inventory.d.ts +18 -0
  158. package/dist/items.d.ts +91 -0
  159. package/dist/lanes.d.ts +213 -0
  160. package/dist/life.d.ts +53 -0
  161. package/dist/local-Dkovq42k.js +1379 -0
  162. package/dist/local-Dkovq42k.js.map +1 -0
  163. package/dist/log.d.ts +140 -0
  164. package/dist/manaBurn.d.ts +39 -0
  165. package/dist/map/file.d.ts +114 -0
  166. package/dist/map/images.d.ts +18 -0
  167. package/dist/map/look.d.ts +47 -0
  168. package/dist/map/pathProfile.d.ts +13 -0
  169. package/dist/map/resize.d.ts +54 -0
  170. package/dist/map/schema.d.ts +10 -0
  171. package/dist/map/terrain.d.ts +32 -0
  172. package/dist/map/types.d.ts +613 -0
  173. package/dist/map.d.ts +7 -0
  174. package/dist/mapCheck/cells.d.ts +19 -0
  175. package/dist/mapCheck/rule.d.ts +30 -0
  176. package/dist/mapCheck/rules/names.d.ts +3 -0
  177. package/dist/mapCheck/rules/objects.d.ts +3 -0
  178. package/dist/mapCheck/rules/paths.d.ts +3 -0
  179. package/dist/mapCheck/rules/players.d.ts +3 -0
  180. package/dist/mapCheck/rules/races.d.ts +3 -0
  181. package/dist/mapCheck/rules/random.d.ts +3 -0
  182. package/dist/mapCheck/rules/regions.d.ts +3 -0
  183. package/dist/mapCheck/rules/targets.d.ts +3 -0
  184. package/dist/mapCheck/rules/walking.d.ts +3 -0
  185. package/dist/mapCheck.d.ts +23 -0
  186. package/dist/mapFields.d.ts +364 -0
  187. package/dist/mapFile.d.ts +23 -0
  188. package/dist/mapMeasure.d.ts +95 -0
  189. package/dist/mapMerge.d.ts +19 -0
  190. package/dist/mapObjectives.d.ts +82 -0
  191. package/dist/mapObjects.d.ts +1 -0
  192. package/dist/math.d.ts +44 -0
  193. package/dist/messages.d.ts +150 -0
  194. package/dist/missionRules-C-bGxm0Q.js +523 -0
  195. package/dist/missionRules-C-bGxm0Q.js.map +1 -0
  196. package/dist/missionRules.d.ts +179 -0
  197. package/dist/mods.d.ts +146 -0
  198. package/dist/names.d.ts +93 -0
  199. package/dist/navigation/agentParams.d.ts +4 -0
  200. package/dist/navigation/air.d.ts +89 -0
  201. package/dist/navigation/builds.d.ts +140 -0
  202. package/dist/navigation/groundAreas.d.ts +23 -0
  203. package/dist/navigation/navigation.d.ts +127 -0
  204. package/dist/navigation/recast.d.ts +214 -0
  205. package/dist/navigation/sidePaths.d.ts +69 -0
  206. package/dist/navigation/sized.d.ts +1 -0
  207. package/dist/navigation-worker.js +11 -0
  208. package/dist/navigation-worker.js.map +1 -0
  209. package/dist/nearest.d.ts +8 -0
  210. package/dist/noise.d.ts +12 -0
  211. package/dist/objectives.d.ts +93 -0
  212. package/dist/orders/basic.d.ts +96 -0
  213. package/dist/orders/build.d.ts +91 -0
  214. package/dist/orders/cast.d.ts +105 -0
  215. package/dist/orders/facts.d.ts +14 -0
  216. package/dist/orders/harvest.d.ts +94 -0
  217. package/dist/orders/idle.d.ts +7 -0
  218. package/dist/orders/items.d.ts +14 -0
  219. package/dist/orders/queue.d.ts +24 -0
  220. package/dist/pack.schema.json +6621 -0
  221. package/dist/packs/director/index.d.ts +81 -0
  222. package/dist/packs/heroes/campaign.d.ts +137 -0
  223. package/dist/packs/heroes/carry.d.ts +59 -0
  224. package/dist/packs/heroes/commands.d.ts +6 -0
  225. package/dist/packs/heroes/hire.d.ts +9 -0
  226. package/dist/packs/heroes/index.d.ts +12 -0
  227. package/dist/packs/heroes/making.d.ts +16 -0
  228. package/dist/packs/heroes/respawn.d.ts +42 -0
  229. package/dist/packs/moba/index.d.ts +34 -0
  230. package/dist/packs/pack.d.ts +84 -0
  231. package/dist/packs-g5thvmGn.js +3199 -0
  232. package/dist/packs-g5thvmGn.js.map +1 -0
  233. package/dist/packs.d.ts +84 -0
  234. package/dist/paths.d.ts +51 -0
  235. package/dist/plain.d.ts +17 -0
  236. package/dist/player.d.ts +117 -0
  237. package/dist/portals.d.ts +66 -0
  238. package/dist/prefabs.d.ts +139 -0
  239. package/dist/presetBuildings.d.ts +52 -0
  240. package/dist/presetGround.d.ts +22 -0
  241. package/dist/profiles-B3NS9jwk.js +335 -0
  242. package/dist/profiles-B3NS9jwk.js.map +1 -0
  243. package/dist/races.d.ts +136 -0
  244. package/dist/randomGroups.d.ts +2 -0
  245. package/dist/registry.d.ts +464 -0
  246. package/dist/remains.d.ts +119 -0
  247. package/dist/replication.d.ts +103 -0
  248. package/dist/rng.d.ts +17 -0
  249. package/dist/rules.d.ts +395 -0
  250. package/dist/rulesCheck.d.ts +37 -0
  251. package/dist/runes.d.ts +41 -0
  252. package/dist/save.d.ts +277 -0
  253. package/dist/scenario.d.ts +56 -0
  254. package/dist/scheduler.d.ts +67 -0
  255. package/dist/score.d.ts +306 -0
  256. package/dist/sequences.d.ts +132 -0
  257. package/dist/server/doorman.d.ts +21 -0
  258. package/dist/server/gameServer.d.ts +346 -0
  259. package/dist/server/index.d.ts +24 -0
  260. package/dist/server/lobby.d.ts +1 -0
  261. package/dist/server/log.d.ts +13 -0
  262. package/dist/server/match.d.ts +24 -0
  263. package/dist/server/mode.d.ts +168 -0
  264. package/dist/server/navigation-worker.d.ts +1 -0
  265. package/dist/server/navigation.d.ts +11 -0
  266. package/dist/server/ops.d.ts +78 -0
  267. package/dist/server/packs.d.ts +15 -0
  268. package/dist/server/ratings.d.ts +62 -0
  269. package/dist/server/relay.d.ts +34 -0
  270. package/dist/server/rooms.d.ts +162 -0
  271. package/dist/server/seat.d.ts +2 -0
  272. package/dist/server/seatSettings.d.ts +15 -0
  273. package/dist/server/secret.d.ts +5 -0
  274. package/dist/server/start.d.ts +54 -0
  275. package/dist/server/websocket.d.ts +74 -0
  276. package/dist/server.js +2861 -0
  277. package/dist/server.js.map +1 -0
  278. package/dist/session/can.d.ts +20 -0
  279. package/dist/session/commandReplay.d.ts +92 -0
  280. package/dist/session/debug.d.ts +65 -0
  281. package/dist/session/delay.d.ts +15 -0
  282. package/dist/session/delta.d.ts +98 -0
  283. package/dist/session/entityState.d.ts +1 -0
  284. package/dist/session/local.d.ts +214 -0
  285. package/dist/session/memory.d.ts +27 -0
  286. package/dist/session/protocol.d.ts +1155 -0
  287. package/dist/session/remote.d.ts +530 -0
  288. package/dist/session/replay.d.ts +114 -0
  289. package/dist/session/seed.d.ts +7 -0
  290. package/dist/session/share.d.ts +78 -0
  291. package/dist/session/socket.d.ts +8 -0
  292. package/dist/session/wire.d.ts +153 -0
  293. package/dist/session/worker.d.ts +227 -0
  294. package/dist/shared.d.ts +171 -0
  295. package/dist/sides.d.ts +75 -0
  296. package/dist/sight.d.ts +27 -0
  297. package/dist/simulate-oXBiw1Ff.js +167 -0
  298. package/dist/simulate-oXBiw1Ff.js.map +1 -0
  299. package/dist/simulate-worker.d.ts +1 -0
  300. package/dist/simulate-worker.js +28 -0
  301. package/dist/simulate-worker.js.map +1 -0
  302. package/dist/simulate.d.ts +154 -0
  303. package/dist/smart.d.ts +9 -0
  304. package/dist/spatial.d.ts +62 -0
  305. package/dist/spawning.d.ts +33 -0
  306. package/dist/stances.d.ts +76 -0
  307. package/dist/start.d.ts +71 -0
  308. package/dist/stats.d.ts +122 -0
  309. package/dist/summons.d.ts +63 -0
  310. package/dist/systems/abilities.d.ts +3 -0
  311. package/dist/systems/combat.d.ts +71 -0
  312. package/dist/systems/combatTold.d.ts +14 -0
  313. package/dist/systems/construction.d.ts +34 -0
  314. package/dist/systems/economy.d.ts +21 -0
  315. package/dist/systems/fog.d.ts +19 -0
  316. package/dist/systems/life.d.ts +3 -0
  317. package/dist/systems/movement.d.ts +105 -0
  318. package/dist/systems/orders.d.ts +7 -0
  319. package/dist/systems/production.d.ts +49 -0
  320. package/dist/systems/productionQueue.d.ts +40 -0
  321. package/dist/systems/victory.d.ts +14 -0
  322. package/dist/talk.d.ts +65 -0
  323. package/dist/tech.d.ts +62 -0
  324. package/dist/techTree.d.ts +38 -0
  325. package/dist/terrain.d.ts +173 -0
  326. package/dist/terrainSave.d.ts +29 -0
  327. package/dist/testing.d.ts +58 -0
  328. package/dist/testing.js +822 -0
  329. package/dist/testing.js.map +1 -0
  330. package/dist/tiles.d.ts +34 -0
  331. package/dist/timers.d.ts +146 -0
  332. package/dist/tomes.d.ts +48 -0
  333. package/dist/trade.d.ts +28 -0
  334. package/dist/transport.d.ts +76 -0
  335. package/dist/tunables.d.ts +45 -0
  336. package/dist/upkeep.d.ts +16 -0
  337. package/dist/veterancy.d.ts +80 -0
  338. package/dist/walls.d.ts +86 -0
  339. package/dist/world.d.ts +1118 -0
  340. package/package.json +80 -5
  341. package/README.md +0 -3
@@ -0,0 +1,140 @@
1
+ /**
2
+ * How Recast is told to cut the ground: what the tile cache is generated with
3
+ *
4
+ * @beta
5
+ */
6
+ export interface NavigationBuildConfig {
7
+ cs: number;
8
+ ch: number;
9
+ tileSize: number;
10
+ walkableSlopeAngle: number;
11
+ walkableHeight: number;
12
+ walkableClimb: number;
13
+ walkableRadius: number;
14
+ maxSimplificationError: number;
15
+ mergeRegionArea: number;
16
+ maxVertsPerPoly: number;
17
+ detailSampleDist: number;
18
+ detailSampleMaxError: number;
19
+ expectedLayersPerTile: number;
20
+ maxObstacles: number;
21
+ }
22
+ /**
23
+ * What a navigation is built from: the ground's (or the water's) triangles, and how to cut them. Plain data, sent to a worker as it is
24
+ *
25
+ * @beta
26
+ */
27
+ export interface NavigationBuild {
28
+ positions: Float32Array;
29
+ indices: Uint32Array;
30
+ config: NavigationBuildConfig;
31
+ /**
32
+ * How fast one on foot goes over each cell of the ground (`groundSpeedOfCell`), for a path to weigh: none where every
33
+ * cell is 1, which cuts the ground as it always was
34
+ */
35
+ speeds?: NavigationSpeeds;
36
+ }
37
+ /**
38
+ * Each cell's speed on the ground, row by row (`NavigationBuild.speeds`)
39
+ *
40
+ * @beta
41
+ */
42
+ export interface NavigationSpeeds {
43
+ width: number;
44
+ depth: number;
45
+ values: Float32Array;
46
+ }
47
+ /**
48
+ * What builds a navigation: given what to build, gives back what was built (Recast's tile cache, exported). On this
49
+ * thread (`buildNavigationData`), or in a worker (`navigationWorker`)
50
+ *
51
+ * @beta
52
+ */
53
+ export type NavigationBuilder = (build: NavigationBuild) => Promise<Uint8Array>;
54
+ /**
55
+ * Where what was built is kept, by a hash of what it was built from: in memory when nothing else is said
56
+ * (`memoryNavigationCache`). A game keeps it elsewhere with one of its own (the browser's storage, a file)
57
+ *
58
+ * @beta
59
+ */
60
+ export interface NavigationCache {
61
+ get(key: string): Uint8Array | undefined | Promise<Uint8Array | undefined>;
62
+ set(key: string, data: Uint8Array): void | Promise<void>;
63
+ }
64
+ /** Recast's WebAssembly, once for each thread */
65
+ export declare const initRecast: () => Promise<void>;
66
+ /**
67
+ * Builds a navigation on this thread, and gives back what was built: what a worker does too
68
+ *
69
+ * @beta
70
+ */
71
+ export declare function buildNavigationData(build: NavigationBuild): Promise<Uint8Array>;
72
+ /**
73
+ * Kept in memory, the last built first, up to `maxBytes` of them (64 MB when left out): a map of 512 cells a side is
74
+ * under a megabyte
75
+ *
76
+ * @beta
77
+ */
78
+ export declare function memoryNavigationCache(maxBytes?: number): NavigationCache;
79
+ /**
80
+ * What a worker is, as far as building goes: a page's `Worker`, or Node's `worker_threads` one
81
+ *
82
+ * @beta
83
+ */
84
+ export interface NavigationWorkerLike {
85
+ postMessage(message: unknown, transfer?: unknown[]): void;
86
+ addEventListener?(type: 'message' | 'error', listener: (event: {
87
+ data?: unknown;
88
+ message?: string;
89
+ }) => void): void;
90
+ on?(type: 'message' | 'error', listener: (value: unknown) => void): void;
91
+ }
92
+ /**
93
+ * A builder that builds in a worker: one whose file serves builds (`serveNavigationBuilds`). In a page, the page makes
94
+ * the worker, as its bundler wants it: the library makes no worker of its own there.
95
+ *
96
+ * A worker's file of two lines (`serveNavigationBuilds` imported from the engine, and called), and the page:
97
+ * `navigationWorker(() => new Worker(new URL('./navigation.worker.ts', import.meta.url), { type: 'module' }))`, the
98
+ * builder of every world it makes (`NavigationBuilds`).
99
+ * Given as a function, the worker is made at the first build: a page whose menu builds nothing fetches none of it
100
+ * until a world is made (OF2); given made, it is used as it is
101
+ *
102
+ * @beta
103
+ */
104
+ export declare function navigationWorker(given: NavigationWorkerLike | (() => NavigationWorkerLike)): NavigationBuilder;
105
+ /**
106
+ * Where a worker hears and answers: a page's worker scope, or Node's `parentPort`
107
+ *
108
+ * @beta
109
+ */
110
+ export interface NavigationPort {
111
+ postMessage(message: unknown, transfer?: unknown[]): void;
112
+ addEventListener?(type: 'message', listener: (event: {
113
+ data: unknown;
114
+ }) => void): void;
115
+ on?(type: 'message', listener: (value: unknown) => void): void;
116
+ }
117
+ /**
118
+ * What a navigation worker's file does: it builds what it is sent and sends back what it built. `port` is where it
119
+ * hears: the worker's own scope when left out (a page's worker)
120
+ *
121
+ * @beta
122
+ */
123
+ export declare function serveNavigationBuilds(port?: NavigationPort): void;
124
+ /**
125
+ * Who builds a world's navigations and where what was built is kept (`CreateWorldOptions.navigation.builds`): this
126
+ * thread when the builder is left out (a worker of the page's own: `navigationWorker`), the process's memory when the
127
+ * cache is, `cache: null` for nowhere (every world built anew). What an app hands every world it makes (`launch`,
128
+ * `startApp`, `GameServer.start`)
129
+ *
130
+ * @beta
131
+ */
132
+ export interface NavigationBuilds {
133
+ builder?: NavigationBuilder;
134
+ cache?: NavigationCache | null;
135
+ }
136
+ /**
137
+ * What was built from this: kept, or built now (by the builder set) and kept. A builder that fails falls back to this
138
+ * thread once, and says why in what it throws only when that fails too
139
+ */
140
+ export declare function navigationData(build: NavigationBuild, using?: NavigationBuilds): Promise<Uint8Array>;
@@ -0,0 +1,23 @@
1
+ import { NavMesh, type QueryFilter, TileCache, TileCacheMeshProcess } from '@recast-navigation/core';
2
+ import type { NavigationBuild, NavigationSpeeds } from './builds';
3
+ /** The area of ground of this speed: 0 for ordinary ground, else its speed in sixteenths, 1 at the least and 62 at the most */
4
+ export declare function areaOfSpeed(speed: number): number;
5
+ /** What a path pays for each area of slow ground, on a filter: `1 / speed`, ordinary ground 1 */
6
+ export declare function setAreaCosts(filter: QueryFilter): void;
7
+ /** The speed of a cell of a build's grid: 1 off it, or with no grid */
8
+ export declare function speedOfBuild(speeds: NavigationSpeeds | undefined, x: number, z: number): number;
9
+ /**
10
+ * What makes a tile's polygons, as Recast's tile cache asks: each walkable (flags 1), its area the speed of the ground
11
+ * under its middle (`speedAt`). Without one, every polygon is ordinary ground, as Recast's default makes them
12
+ */
13
+ export declare function groundMeshProcess(speedAt?: (x: number, z: number) => number): TileCacheMeshProcess;
14
+ /**
15
+ * Builds a tile cache and its navmesh from a build, as Recast's `generateTileCache` does, but with each triangle of the
16
+ * ground marked with its cell's speed (`NavigationBuild.speeds`) before it is rasterised. What it gives is Recast's own;
17
+ * the caller exports and lets go of it
18
+ */
19
+ export declare function generateGroundTileCache(build: NavigationBuild): {
20
+ navMesh: NavMesh;
21
+ tileCache: TileCache;
22
+ process: TileCacheMeshProcess;
23
+ };
@@ -0,0 +1,127 @@
1
+ import type { Rect, Vec2 } from '#engine/math';
2
+ export interface AgentParams {
3
+ radius: number;
4
+ speed: number;
5
+ /** Moves through the air, where only other flyers are in the way */
6
+ flying?: boolean;
7
+ /** Goes on deep water only, where only other boats are in the way */
8
+ naval?: boolean;
9
+ }
10
+ export interface AgentState {
11
+ x: number;
12
+ z: number;
13
+ vx: number;
14
+ vz: number;
15
+ /** Next corner of the path, where the agent is heading right now. The destination itself when nothing is in the way */
16
+ cx: number;
17
+ cz: number;
18
+ /** The corner after that, where it heads next: the destination itself when the next corner is the last, or there is none */
19
+ nx: number;
20
+ nz: number;
21
+ }
22
+ /**
23
+ * An agent as it is right now, for a save: where it is, how fast it goes, where to, and how it behaves
24
+ *
25
+ * @beta
26
+ */
27
+ export interface AgentSave {
28
+ x: number;
29
+ z: number;
30
+ vx: number;
31
+ vz: number;
32
+ radius: number;
33
+ speed: number;
34
+ /** How fast it gets up to speed, where that is not what follows from the speed */
35
+ acceleration?: number;
36
+ flying?: boolean;
37
+ naval?: boolean;
38
+ /** Where it was sent, snapped to where it can go. Null when it was not */
39
+ target: Vec2 | null;
40
+ anchored: boolean;
41
+ /** Where an anchored agent holds its ground */
42
+ anchor?: Vec2;
43
+ ghost: boolean;
44
+ }
45
+ /** @beta */
46
+ export interface NavDebugGeometry {
47
+ /** xyz triples, 3 vertices per triangle */
48
+ triangles: Float32Array;
49
+ /** xyz triples, 2 vertices per line */
50
+ lines: Float32Array;
51
+ }
52
+ /**
53
+ * Pathfinding and local avoidance. The simulation only talks to this interface,
54
+ * so the backing implementation can be replaced without touching game logic.
55
+ *
56
+ * @beta
57
+ */
58
+ export interface Navigation {
59
+ /** Bumped whenever walkable space changes (obstacles added or removed) */
60
+ readonly version: number;
61
+ addAgent(id: number, position: Vec2, params: AgentParams): void;
62
+ removeAgent(id: number): void;
63
+ hasAgent(id: number): boolean;
64
+ /** Path towards `target`. The target is snapped to walkable space; returns false when nothing walkable is near it. */
65
+ setDestination(id: number, target: Vec2): boolean;
66
+ clearDestination(id: number): void;
67
+ teleport(id: number, position: Vec2): void;
68
+ /** Anchored agents hold their ground: others have to walk around them instead of shoving them away. */
69
+ setAnchored(id: number, anchored: boolean): void;
70
+ /** Ghost agents ignore other agents (used by workers hauling resources). */
71
+ setGhost(id: number, ghost: boolean): void;
72
+ setSpeed(id: number, speed: number): void;
73
+ readAgent(id: number, out: AgentState): boolean;
74
+ /** What a save needs of an agent, or undefined when there is none of that id */
75
+ saveAgent(id: number): AgentSave | undefined;
76
+ /**
77
+ * Puts an agent back as it was saved. As close as it gets: the path it follows is looked for again,
78
+ * so what it does next can differ a little from what the agent that was saved would have done
79
+ */
80
+ restoreAgent(id: number, save: AgentSave): void;
81
+ /**
82
+ * Puts the agents back as loading a save puts them (determinism D2): those given and no others, in that order, each
83
+ * as `restoreAgent` puts it, on a crowd made anew. A save does this to the world it is taken of, so the game that
84
+ * was saved and the game loaded from it go on from the same crowd, to the last bit
85
+ */
86
+ reseat(agents: readonly (readonly [id: number, save: AgentSave])[]): void;
87
+ /** After a load: brings walkable space up to date with the obstacles put back, and takes on the version it had */
88
+ settle(version: number): void;
89
+ update(dt: number): void;
90
+ /**
91
+ * Something that blocks the way, a building or a shut gate. False when there is no room for another (see
92
+ * `obstacleRoom`): it is then not in the way, and never thrown over in the middle of a tick
93
+ */
94
+ addObstacle(key: number, rect: Rect): boolean;
95
+ removeObstacle(key: number): void;
96
+ /** How many more obstacles there is room for: what placing a building is refused over, before it is placed */
97
+ obstacleRoom(): number;
98
+ /**
99
+ * Many obstacles are put down at once, as a load puts back every structure: while held (true), what they change of
100
+ * walkable space waits, and is made once (each piece of ground once, however many obstacles are on it) when let go
101
+ * (false) or at the first thing asked of the navigation before that. What comes out is the same as putting them
102
+ * down one by one; only the work is less. Nothing where a navigation has nothing to hold
103
+ */
104
+ holdObstacles?(hold: boolean): void;
105
+ /**
106
+ * Whether two agents are in each other's way: on the same crowd, so that each steers around the other and neither
107
+ * walks through. Agents of different layers (ground, air, water), or of different sizes where the ground is cut for
108
+ * several (`SizedNavigation`), are not. Taken as yes where a navigation does not say
109
+ */
110
+ sameCrowd?(a: number, b: number): boolean;
111
+ /** Closest walkable point, or null when there is none within `searchRadius`. */
112
+ closestPoint(point: Vec2, searchRadius?: number): Vec2 | null;
113
+ findPath(from: Vec2, to: Vec2): Vec2[] | null;
114
+ /**
115
+ * A layer of cells that slows one on foot changed on these cells (`World.setCells`): what a path weighs there is
116
+ * made again (EN2). Nothing where a navigation weighs no ground
117
+ */
118
+ groundChanged?(cells: readonly number[]): void;
119
+ /**
120
+ * The ground it is a navigation of was reshaped (`World.reshapeGround`): cut again from it as it is now, at once, what
121
+ * is in the way and every agent kept as they were. False where it was not (a navigation of no ground, or one that
122
+ * cannot be cut of the ground as it is now): it is left as it was
123
+ */
124
+ reshape?(): boolean;
125
+ debugGeometry(): NavDebugGeometry;
126
+ dispose(): void;
127
+ }
@@ -0,0 +1,214 @@
1
+ import { type NavigationBuilds } from './builds';
2
+ import type { Rect, Vec2 } from '#engine/math';
3
+ import type { Terrain } from '#engine/terrain';
4
+ import type { AgentParams, AgentSave, AgentState, NavDebugGeometry, Navigation } from './navigation';
5
+ /** @beta */
6
+ export interface RecastNavigationOptions {
7
+ /** Who builds it and where what was built is kept: this thread and the process's memory when left out */
8
+ builds?: NavigationBuilds;
9
+ /** Navmesh is eroded by this radius, so it has to cover the largest unit */
10
+ agentRadius?: number;
11
+ /** Steepest slope units can walk, in degrees */
12
+ maxSlope?: number;
13
+ /**
14
+ * How many agents the crowd makes room for at first: 512 when left out. It is not a limit: a crowd that is full makes
15
+ * room for twice as many, and the agents go on as they were. A game that knows it brings thousands says so, to save
16
+ * those moves
17
+ */
18
+ maxAgents?: number;
19
+ /**
20
+ * How many obstacles (buildings, shut gates) there is room for: past it, placing one is refused. From the map's
21
+ * size when left out: half its cells, at least 8192, at most 65535
22
+ */
23
+ maxObstacles?: number;
24
+ /**
25
+ * How many steps a path search takes before it gives up with the best it found: a long path on a large map needs
26
+ * more. From the map's size when left out: a quarter of its cells, at least 4096, at most 65535
27
+ */
28
+ maxNodes?: number;
29
+ /**
30
+ * Navigations cut for units of these sizes, each unit on the one for the biggest size it is not smaller than: a
31
+ * big unit keeps from walls as far as it needs, where all keep 0.5 when left out. Each size is a navigation of its
32
+ * own, with its own crowd: units of different sizes walk through each other rather than around (see
33
+ * `SizedNavigation`)
34
+ */
35
+ radii?: number[];
36
+ cellSize?: number;
37
+ /**
38
+ * What it is a navigation of: the ground, walked on, or the deep water, sailed on (`Terrain.buildWaterMesh`), at
39
+ * the height of its surface. The ground when left out
40
+ */
41
+ surface?: 'ground' | 'water';
42
+ /**
43
+ * How agents steer around each other (Detour's obstacle avoidance): a level (`AVOIDANCE_LEVELS`: how carefully a
44
+ * crowd samples the velocities it might go at, `'medium'` being Detour's own), or the parts of `AvoidanceParams`
45
+ * to change, Detour's own for the rest. `'medium'` when left out. `'low'` crosses and gathers crowds as well
46
+ * in the measured cases for about a quarter less of a tick with a thousand walking, but it plays out other games
47
+ * differently (six of the example's tuned AI tests), so it is a game's choice
48
+ *
49
+ * @beta
50
+ */
51
+ avoidance?: AvoidanceLevel | Partial<AvoidanceParams>;
52
+ /**
53
+ * How hard agents push each other apart as they walk near each other (within eight radii), 0 for not at all:
54
+ * Detour's separation weight. 0.5 when left out: at Detour's 1.5, a unit walking past standing ones is pushed off
55
+ * its line and loses a tenth of its speed to it
56
+ */
57
+ separation?: number;
58
+ /**
59
+ * How fast one on foot goes over the ground at a point, as a multiplier (`groundSpeedOfCell`): what a path weighs,
60
+ * so that a way around slow ground wins where it is quicker (EN2). Asked as the ground is cut, and again for the tiles
61
+ * a slowing layer changed on (`groundChanged`). Every cell 1 when left out; never asked of the water
62
+ */
63
+ speedAt?: (x: number, z: number) => number;
64
+ }
65
+ /**
66
+ * How agents steer around each other: Detour's obstacle avoidance parameters, which weigh the velocities an agent
67
+ * samples each tick. The one that costs least wins: going the speed it wants (`weightDesVel`), going as it went
68
+ * (`weightCurVel`), passing on its preferred side (`weightSide`), and how soon it would hit something
69
+ * (`weightToi`, within `horizTime` seconds). `velBias` is how far the samples stray from the velocity it wants, 0..1
70
+ *
71
+ * @beta
72
+ */
73
+ export interface AvoidanceParams {
74
+ velBias: number;
75
+ weightDesVel: number;
76
+ weightCurVel: number;
77
+ weightSide: number;
78
+ weightToi: number;
79
+ horizTime: number;
80
+ /** Samples a side in the grid sampling, odd. Only the adaptive sampling is used by the engine, which goes by the three below */
81
+ gridSize: number;
82
+ adaptiveDivs: number;
83
+ adaptiveRings: number;
84
+ adaptiveDepth: number;
85
+ }
86
+ /**
87
+ * How carefully a crowd steers: `'low'` samples fewer velocities, a cost a tick that grows with the crowd, `'high'` more
88
+ *
89
+ * @beta
90
+ */
91
+ export type AvoidanceLevel = 'low' | 'medium' | 'high';
92
+ /**
93
+ * What each `AvoidanceLevel` changes of `DEFAULT_AVOIDANCE`: the sampling (`adaptiveDivs`, `adaptiveRings` and
94
+ * `adaptiveDepth`, which what an agent costs a tick goes by)
95
+ *
96
+ * @beta
97
+ */
98
+ export declare const AVOIDANCE_LEVELS: Readonly<Record<AvoidanceLevel, Readonly<Partial<AvoidanceParams>>>>;
99
+ export declare class RecastNavigation implements Navigation {
100
+ private readonly terrain;
101
+ private navMesh;
102
+ private tileCache;
103
+ private crowd;
104
+ private query;
105
+ private readonly agentRadius;
106
+ /** How many agents the crowd has room for now: twice as many each time it is full */
107
+ private maxAgents;
108
+ /** How many obstacles the tile cache was made with room for */
109
+ private readonly maxObstacles;
110
+ /** How many steps a path search takes at most */
111
+ private readonly maxNodes;
112
+ /** What Recast's import made besides the navmesh and the tile cache, which the tile cache uses as long as it lives */
113
+ private owned;
114
+ /** How its agents steer around each other, and how hard they push apart (`RecastNavigationOptions`) */
115
+ readonly avoidance: Readonly<AvoidanceParams>;
116
+ readonly separation: number;
117
+ /** Where its tiles are: to make again those a slowing layer changed on, and to know which an obstacle touches */
118
+ private tiles;
119
+ /** The height of what it is a navigation of, at a point: the ground, or the water's surface */
120
+ private readonly heightAt;
121
+ /** What a path weighs (`speedAt`) */
122
+ private readonly ground?;
123
+ /** What it is cut from, the ground as it is now, the way it was first cut: to cut it again (`reshape`) */
124
+ private readonly cut?;
125
+ version: number;
126
+ private agents;
127
+ private obstacles;
128
+ /** The room the crowd was first made with: a crowd made anew (`reseat`) starts there, as a loaded world's does */
129
+ private firstMaxAgents;
130
+ private obstaclesDirty;
131
+ /** Obstacles are put down many at once (`holdObstacles`): their requests wait in the tile cache to be made into tiles together */
132
+ private holding;
133
+ /** Requests waiting while held, and the columns of the tile grid they touch (x * 65536 + z) */
134
+ private held;
135
+ private readonly heldColumns;
136
+ private readonly scratch;
137
+ private constructor();
138
+ static create(terrain: Terrain, options?: RecastNavigationOptions): Promise<RecastNavigation>;
139
+ /**
140
+ * The ground it is a navigation of was reshaped (`World.reshapeGround`): cut again from the ground as it is now, at
141
+ * once and on this thread, as it was cut first (its options, its slow ground); what is in the way put down again where
142
+ * it was, in the order it was, and every agent moved over as it stood, as a crowd that grows is. Every machine cuts it
143
+ * the same. False, and the navigation left as it was, where the ground as it is now cannot be cut (no water left)
144
+ */
145
+ reshape(): boolean;
146
+ /**
147
+ * A slowing layer of cells changed on these cells (`World.setCells`): the tiles they are on are made again, each
148
+ * polygon's area the speed under it now. As fine as the polygons the ground was cut into: a patch painted in play in
149
+ * the middle of one counts where the polygon's middle is
150
+ */
151
+ groundChanged(cells: readonly number[]): void;
152
+ /** The limits it was made with, from the map's size or the options: obstacles, and the steps of a path search */
153
+ get limits(): {
154
+ maxObstacles: number;
155
+ maxNodes: number;
156
+ };
157
+ /** How many agents the crowd has room for before it has to make more */
158
+ get capacity(): number;
159
+ /**
160
+ * Makes room for twice as many agents. A crowd (Detour's) is made for a number of agents and cannot grow, so a new
161
+ * one is made and every agent moved over as it is: where it is, how fast it goes, where to
162
+ */
163
+ private grow;
164
+ private toVec3;
165
+ addAgent(id: number, position: Vec2, params: AgentParams): void;
166
+ removeAgent(id: number): void;
167
+ hasAgent(id: number): boolean;
168
+ setDestination(id: number, target: Vec2): boolean;
169
+ clearDestination(id: number): void;
170
+ teleport(id: number, position: Vec2): void;
171
+ setAnchored(id: number, anchored: boolean): void;
172
+ /** Lets an anchored agent go: walking again, from where it stood. Detour checks the ground under it on its next step */
173
+ private wake;
174
+ setGhost(id: number, ghost: boolean): void;
175
+ setSpeed(id: number, speed: number): void;
176
+ saveAgent(id: number): AgentSave | undefined;
177
+ reseat(agents: readonly (readonly [id: number, save: AgentSave])[]): void;
178
+ restoreAgent(id: number, save: AgentSave): void;
179
+ settle(version: number): void;
180
+ readAgent(id: number, out: AgentState): boolean;
181
+ update(dt: number): void;
182
+ addObstacle(key: number, rect: Rect): boolean;
183
+ /**
184
+ * Holds obstacles back (true) or lets them go (false): while held, a request to put one down or take one up waits in
185
+ * the tile cache, and they are made into tiles together when let go or at the first thing asked of the navigation
186
+ * before that, each tile once however many obstacles are on it. The same tiles come of it as of making them one by
187
+ * one: a wooded tile is made once, not once a tree (RV42). The version goes up for each obstacle all the same
188
+ */
189
+ holdObstacles(hold: boolean): void;
190
+ /**
191
+ * Makes room for one more held request, of an obstacle at (x, z) of these half sizes: the ones held are made into
192
+ * tiles first when the tile cache would take no more of them (Detour queues 64), or when their tiles together would
193
+ * be more than it makes again from one batch (64, past which it leaves the rest as they were)
194
+ */
195
+ private makeRoom;
196
+ /**
197
+ * The columns of the tile grid an obstacle touches, or more: Detour takes a box obstacle's bounds as a square 1.41 times
198
+ * its longer half side about its middle, here 1.5 times, so that rounding never leaves one out
199
+ */
200
+ private columnsOf;
201
+ /** Every held request made into tiles: the tile cache up to date */
202
+ private drain;
203
+ obstacleRoom(): number;
204
+ removeObstacle(key: number): void;
205
+ /**
206
+ * The tile cache only queues a limited number of requests, so process them as they come: but while they are held
207
+ * (`holdObstacles`), when they wait to be made into tiles together
208
+ */
209
+ private flushObstacles;
210
+ closestPoint(point: Vec2, searchRadius?: number): Vec2 | null;
211
+ findPath(from: Vec2, to: Vec2): Vec2[] | null;
212
+ debugGeometry(): NavDebugGeometry;
213
+ dispose(): void;
214
+ }
@@ -0,0 +1,69 @@
1
+ import type { Entity } from '#engine/entity';
2
+ import type { Rect, Vec2 } from '#engine/math';
3
+ import type { System } from '#engine/registry';
4
+ import type { Terrain } from '#engine/terrain';
5
+ import type { World } from '#engine/world';
6
+ import { type RecastNavigationOptions } from './recast';
7
+ /**
8
+ * A building a side learned of by sight, where it saw it: its id and its rectangle
9
+ *
10
+ * @beta
11
+ */
12
+ export type KnownBuilding = [id: number, x: number, z: number, hw: number, hd: number];
13
+ /**
14
+ * The navigations of the sides, to plan routes on
15
+ *
16
+ * @beta
17
+ */
18
+ export declare class SidePaths {
19
+ private readonly sides;
20
+ private stop?;
21
+ private constructor();
22
+ /** A navigation for each team, of the terrain alone, cut for `options` (the world's smallest unit) */
23
+ static create(terrain: Terrain, teams: readonly number[], options?: RecastNavigationOptions): Promise<SidePaths>;
24
+ /**
25
+ * Listens to the world for what every side knows as it happens: the map's, and each side's own and its allies'
26
+ * buildings, put down and gone. Given what the world has now, in its order, first: what a load starts from
27
+ */
28
+ attach(world: World): void;
29
+ /** Whether a team knows a building of `owner`'s without seeing it: the map's, its own, its allies' */
30
+ private always;
31
+ /** A building put down: what every side knows of it at once */
32
+ private put;
33
+ /** A building gone: forgotten at once where it was known without being seen */
34
+ private gone;
35
+ /** Whether a team plans with what it knows */
36
+ has(team: number): boolean;
37
+ /** One more each time what a team knows changes */
38
+ version(team: number): number;
39
+ knows(team: number, id: number): boolean;
40
+ /** The buildings a team knows, by id */
41
+ known(team: number): ReadonlyMap<number, Rect>;
42
+ /** A team knows a building from now: it is in the way of its routes. `seen` for one it learned of by sight */
43
+ learn(team: number, id: number, rect: Rect, seen?: boolean): void;
44
+ /** A team knows a building is gone */
45
+ forget(team: number, id: number): void;
46
+ /** Brings each navigation up to date with what was learned and forgotten: before a route is planned on it */
47
+ settle(): void;
48
+ /** The corners of a route from one point to another, as the team knows the ground. Null where it knows no way */
49
+ route(team: number, from: Vec2, to: Vec2): Vec2[] | null;
50
+ /** What the world keeps of it (`sideKnowledge`): what each side learned by sight */
51
+ save(): Record<number, KnownBuilding[]>;
52
+ /** After a load: what every side knows of the world as it is (`attach`), then what each learned by sight */
53
+ restore(world: World, saved: Record<number, KnownBuilding[]>): void;
54
+ /** Every enemy building of `team`'s, in the order they were put there: the ones it can come to know by sight */
55
+ strangers(world: World, team: number): Generator<Entity>;
56
+ /** The buildings a team learned of by sight */
57
+ seen(team: number): ReadonlyMap<number, Rect>;
58
+ /** A slowing layer of cells changed on these cells: each side's navigation weighs them again, as the world's does (EN2) */
59
+ groundChanged(cells: readonly number[]): void;
60
+ /** The ground was reshaped: each side's navigation cut again of it, as the world's is */
61
+ reshape(): void;
62
+ dispose(): void;
63
+ }
64
+ /**
65
+ * What each side learns by sight, after the fog is lit (`GameModule.paths: 'seen'`): another side's buildings once a
66
+ * cell of one is in sight, and that one gone once its place is. What it knows without seeing is the world's to tell
67
+ * as it happens (`SidePaths.attach`). Kept in the world (`sideKnowledge`) as it changes
68
+ */
69
+ export declare const sideKnowledgeSystem: System;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { c as serveNavigationBuilds } from "./builds-C6LfgvEU.js";
2
+ import { parentPort } from "node:worker_threads";
3
+ //#region src/server/navigation-worker.ts
4
+ /**
5
+ * A worker thread of a server's that builds navigations (S37): told what to build, it sends back what it built. Built
6
+ * next to `server.js`, and not one of the engine's names: `nodeNavigationBuilder` starts it
7
+ */
8
+ if (parentPort) serveNavigationBuilds(parentPort);
9
+ //#endregion
10
+
11
+ //# sourceMappingURL=navigation-worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-worker.js","names":[],"sources":["../src/server/navigation-worker.ts"],"sourcesContent":["/**\n * A worker thread of a server's that builds navigations (S37): told what to build, it sends back what it built. Built\n * next to `server.js`, and not one of the engine's names: `nodeNavigationBuilder` starts it\n */\nimport { parentPort } from 'node:worker_threads'\nimport { serveNavigationBuilds } from '#engine/navigation/builds'\n\nif (parentPort) serveNavigationBuilds(parentPort as never)\n"],"mappings":";;;;;;;AAOA,IAAI,YAAY,sBAAsB,UAAmB"}
@@ -0,0 +1,8 @@
1
+ /** The id of a set closest to one that is not in it, when one is close enough to have been meant: what a check says was meant */
2
+ export declare function nearestId(id: string, known: Iterable<string>): string | undefined;
3
+ /**
4
+ * How many letters have to be changed, added or taken away to make one word of another: what says which id was meant
5
+ *
6
+ * @beta
7
+ */
8
+ export declare function editDistance(a: string, b: string): number;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Noise between 0 and 1 at a point, `u` and `v` 0..1 across the picture it repeats over
3
+ *
4
+ * @beta
5
+ */
6
+ export type Noise2 = (u: number, v: number) => number;
7
+ /**
8
+ * Several noises, each finer and fainter than the one before: what looks like ground and not like a pattern. 0..1
9
+ *
10
+ * @beta
11
+ */
12
+ export declare function layeredNoise(seed: number, periods: readonly number[]): Noise2;