@v12-engine/engine 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/abilities/buffs.d.ts +83 -0
- package/dist/abilities/castTold.d.ts +12 -0
- package/dist/abilities/charges.d.ts +28 -0
- package/dist/abilities/dispel.d.ts +9 -0
- package/dist/abilities/effectFields.d.ts +10 -0
- package/dist/abilities/effects/buff.d.ts +8 -0
- package/dist/abilities/effects/core.d.ts +1 -0
- package/dist/abilities/effects/damage.d.ts +1 -0
- package/dist/abilities/effects/heal.d.ts +2 -0
- package/dist/abilities/effects/missile.d.ts +1 -0
- package/dist/abilities/effects/moves.d.ts +11 -0
- package/dist/abilities/effects/passives.d.ts +15 -0
- package/dist/abilities/effects/sight.d.ts +4 -0
- package/dist/abilities/effects/spawn.d.ts +2 -0
- package/dist/abilities/effects/timed.d.ts +4 -0
- package/dist/abilities/effects/trade.d.ts +1 -0
- package/dist/abilities/effects.d.ts +122 -0
- package/dist/abilities/land.d.ts +21 -0
- package/dist/abilities/scaled.d.ts +21 -0
- package/dist/abilities/text.d.ts +113 -0
- package/dist/ai/area.d.ts +53 -0
- package/dist/ai/brain.d.ts +528 -0
- package/dist/ai/budget.d.ts +67 -0
- package/dist/ai/checks.d.ts +115 -0
- package/dist/ai/computer.d.ts +166 -0
- package/dist/ai/defence.d.ts +108 -0
- package/dist/ai/define.d.ts +21 -0
- package/dist/ai/economy.d.ts +129 -0
- package/dist/ai/geometry.d.ts +35 -0
- package/dist/ai/goals.d.ts +360 -0
- package/dist/ai/index.d.ts +38 -0
- package/dist/ai/knowledge.d.ts +418 -0
- package/dist/ai/lanes.d.ts +232 -0
- package/dist/ai/melee/build.d.ts +61 -0
- package/dist/ai/melee/goals.d.ts +299 -0
- package/dist/ai/melee/heroes.d.ts +27 -0
- package/dist/ai/melee/index.d.ts +14 -0
- package/dist/ai/melee/production.d.ts +8 -0
- package/dist/ai/melee/surrender.d.ts +24 -0
- package/dist/ai/micro.d.ts +278 -0
- package/dist/ai/mission.d.ts +195 -0
- package/dist/ai/missionRules.d.ts +18 -0
- package/dist/ai/module.d.ts +116 -0
- package/dist/ai/options.d.ts +61 -0
- package/dist/ai/plans/build.d.ts +280 -0
- package/dist/ai/plans/placement.d.ts +82 -0
- package/dist/ai/plans/plans.d.ts +105 -0
- package/dist/ai/plans/production.d.ts +210 -0
- package/dist/ai/plans/purse.d.ts +73 -0
- package/dist/ai/plans/tech.d.ts +37 -0
- package/dist/ai/profiles.d.ts +204 -0
- package/dist/ai/reach.d.ts +4 -0
- package/dist/ai/report.d.ts +203 -0
- package/dist/ai/roles.d.ts +133 -0
- package/dist/ai/rules.d.ts +288 -0
- package/dist/ai/scouting.d.ts +98 -0
- package/dist/ai/settings.d.ts +73 -0
- package/dist/ai/squads.d.ts +429 -0
- package/dist/ai/strength.d.ts +167 -0
- package/dist/ai/task.d.ts +118 -0
- package/dist/ai/tasks/attack.d.ts +7 -0
- package/dist/ai/tasks/capture.d.ts +21 -0
- package/dist/ai/tasks/creep.d.ts +16 -0
- package/dist/ai/tasks/defend.d.ts +29 -0
- package/dist/ai/tasks/drop.d.ts +34 -0
- package/dist/ai/tasks/escort.d.ts +16 -0
- package/dist/ai/tasks/gather.d.ts +23 -0
- package/dist/ai/tasks/harass.d.ts +7 -0
- package/dist/ai/tasks/hold.d.ts +20 -0
- package/dist/ai/tasks/index.d.ts +32 -0
- package/dist/ai/tasks/move.d.ts +19 -0
- package/dist/ai/tasks/patrol.d.ts +8 -0
- package/dist/ai/tasks/retreat.d.ts +20 -0
- package/dist/ai/tasks/scout.d.ts +29 -0
- package/dist/ai/tasks/shared.d.ts +74 -0
- package/dist/ai/team.d.ts +155 -0
- package/dist/ai/threat.d.ts +91 -0
- package/dist/ai/view.d.ts +366 -0
- package/dist/ai/waves.d.ts +126 -0
- package/dist/ai.js +6239 -0
- package/dist/ai.js.map +1 -0
- package/dist/aiTesting.d.ts +179 -0
- package/dist/areas.d.ts +149 -0
- package/dist/attacks.d.ts +66 -0
- package/dist/attributes.d.ts +66 -0
- package/dist/brain-BvVdUhX8.js +7659 -0
- package/dist/brain-BvVdUhX8.js.map +1 -0
- package/dist/builds-C6LfgvEU.js +460 -0
- package/dist/builds-C6LfgvEU.js.map +1 -0
- package/dist/bytes.d.ts +6 -0
- package/dist/camps.d.ts +95 -0
- package/dist/capture.d.ts +131 -0
- package/dist/cellLayers.d.ts +75 -0
- package/dist/cinematics.d.ts +194 -0
- package/dist/clock.d.ts +32 -0
- package/dist/commands.d.ts +235 -0
- package/dist/components.d.ts +184 -0
- package/dist/computers.d.ts +108 -0
- package/dist/concealment.d.ts +61 -0
- package/dist/coreComponents-syuh2fPG.js +5149 -0
- package/dist/coreComponents-syuh2fPG.js.map +1 -0
- package/dist/coreComponents.d.ts +1 -0
- package/dist/dashing.d.ts +8 -0
- package/dist/debug.d.ts +36 -0
- package/dist/debug.js +3 -0
- package/dist/debugCommands-CzjrSm66.js +14739 -0
- package/dist/debugCommands-CzjrSm66.js.map +1 -0
- package/dist/debugCommands.d.ts +213 -0
- package/dist/debugging.d.ts +10 -0
- package/dist/definitions.d.ts +43 -0
- package/dist/defs.d.ts +1162 -0
- package/dist/denying.d.ts +81 -0
- package/dist/destructibles.d.ts +27 -0
- package/dist/determinism-BCymQwiE.js +518 -0
- package/dist/determinism-BCymQwiE.js.map +1 -0
- package/dist/determinism.d.ts +121 -0
- package/dist/dialog.d.ts +94 -0
- package/dist/effectRefs.d.ts +16 -0
- package/dist/effects.d.ts +80 -0
- package/dist/endings.d.ts +22 -0
- package/dist/engagement.d.ts +108 -0
- package/dist/engineEvents.d.ts +710 -0
- package/dist/entity.d.ts +409 -0
- package/dist/entityIndex.d.ts +50 -0
- package/dist/errors.d.ts +85 -0
- package/dist/events.d.ts +97 -0
- package/dist/exactMath.d.ts +63 -0
- package/dist/features.d.ts +10 -0
- package/dist/fields.d.ts +114 -0
- package/dist/fixture.d.ts +17 -0
- package/dist/fog.d.ts +110 -0
- package/dist/formation.d.ts +111 -0
- package/dist/friendlyFire.d.ts +26 -0
- package/dist/game-DiJEN-Ks.js +5800 -0
- package/dist/game-DiJEN-Ks.js.map +1 -0
- package/dist/game.d.ts +501 -0
- package/dist/gameData.d.ts +325 -0
- package/dist/gameFiles.d.ts +26 -0
- package/dist/gates.d.ts +28 -0
- package/dist/generate.d.ts +403 -0
- package/dist/generateWorker.d.ts +39 -0
- package/dist/grid.d.ts +53 -0
- package/dist/ground.d.ts +127 -0
- package/dist/groundSpeed.d.ts +22 -0
- package/dist/hero.d.ts +177 -0
- package/dist/home.d.ts +14 -0
- package/dist/hooks.d.ts +780 -0
- package/dist/hotReload.d.ts +76 -0
- package/dist/ids.d.ts +26 -0
- package/dist/index.d.ts +227 -0
- package/dist/index.js +4701 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect-D9dWHmZ0.js +491 -0
- package/dist/inspect-D9dWHmZ0.js.map +1 -0
- package/dist/inspect.d.ts +176 -0
- package/dist/inventory.d.ts +18 -0
- package/dist/items.d.ts +91 -0
- package/dist/lanes.d.ts +213 -0
- package/dist/life.d.ts +53 -0
- package/dist/local-Dkovq42k.js +1379 -0
- package/dist/local-Dkovq42k.js.map +1 -0
- package/dist/log.d.ts +140 -0
- package/dist/manaBurn.d.ts +39 -0
- package/dist/map/file.d.ts +114 -0
- package/dist/map/images.d.ts +18 -0
- package/dist/map/look.d.ts +47 -0
- package/dist/map/pathProfile.d.ts +13 -0
- package/dist/map/resize.d.ts +54 -0
- package/dist/map/schema.d.ts +10 -0
- package/dist/map/terrain.d.ts +32 -0
- package/dist/map/types.d.ts +613 -0
- package/dist/map.d.ts +7 -0
- package/dist/mapCheck/cells.d.ts +19 -0
- package/dist/mapCheck/rule.d.ts +30 -0
- package/dist/mapCheck/rules/names.d.ts +3 -0
- package/dist/mapCheck/rules/objects.d.ts +3 -0
- package/dist/mapCheck/rules/paths.d.ts +3 -0
- package/dist/mapCheck/rules/players.d.ts +3 -0
- package/dist/mapCheck/rules/races.d.ts +3 -0
- package/dist/mapCheck/rules/random.d.ts +3 -0
- package/dist/mapCheck/rules/regions.d.ts +3 -0
- package/dist/mapCheck/rules/targets.d.ts +3 -0
- package/dist/mapCheck/rules/walking.d.ts +3 -0
- package/dist/mapCheck.d.ts +23 -0
- package/dist/mapFields.d.ts +364 -0
- package/dist/mapFile.d.ts +23 -0
- package/dist/mapMeasure.d.ts +95 -0
- package/dist/mapMerge.d.ts +19 -0
- package/dist/mapObjectives.d.ts +82 -0
- package/dist/mapObjects.d.ts +1 -0
- package/dist/math.d.ts +44 -0
- package/dist/messages.d.ts +150 -0
- package/dist/missionRules-C-bGxm0Q.js +523 -0
- package/dist/missionRules-C-bGxm0Q.js.map +1 -0
- package/dist/missionRules.d.ts +179 -0
- package/dist/mods.d.ts +146 -0
- package/dist/names.d.ts +93 -0
- package/dist/navigation/agentParams.d.ts +4 -0
- package/dist/navigation/air.d.ts +89 -0
- package/dist/navigation/builds.d.ts +140 -0
- package/dist/navigation/groundAreas.d.ts +23 -0
- package/dist/navigation/navigation.d.ts +127 -0
- package/dist/navigation/recast.d.ts +214 -0
- package/dist/navigation/sidePaths.d.ts +69 -0
- package/dist/navigation/sized.d.ts +1 -0
- package/dist/navigation-worker.js +11 -0
- package/dist/navigation-worker.js.map +1 -0
- package/dist/nearest.d.ts +8 -0
- package/dist/noise.d.ts +12 -0
- package/dist/objectives.d.ts +93 -0
- package/dist/orders/basic.d.ts +96 -0
- package/dist/orders/build.d.ts +91 -0
- package/dist/orders/cast.d.ts +105 -0
- package/dist/orders/facts.d.ts +14 -0
- package/dist/orders/harvest.d.ts +94 -0
- package/dist/orders/idle.d.ts +7 -0
- package/dist/orders/items.d.ts +14 -0
- package/dist/orders/queue.d.ts +24 -0
- package/dist/pack.schema.json +6621 -0
- package/dist/packs/director/index.d.ts +81 -0
- package/dist/packs/heroes/campaign.d.ts +137 -0
- package/dist/packs/heroes/carry.d.ts +59 -0
- package/dist/packs/heroes/commands.d.ts +6 -0
- package/dist/packs/heroes/hire.d.ts +9 -0
- package/dist/packs/heroes/index.d.ts +12 -0
- package/dist/packs/heroes/making.d.ts +16 -0
- package/dist/packs/heroes/respawn.d.ts +42 -0
- package/dist/packs/moba/index.d.ts +34 -0
- package/dist/packs/pack.d.ts +84 -0
- package/dist/packs-g5thvmGn.js +3199 -0
- package/dist/packs-g5thvmGn.js.map +1 -0
- package/dist/packs.d.ts +84 -0
- package/dist/paths.d.ts +51 -0
- package/dist/plain.d.ts +17 -0
- package/dist/player.d.ts +117 -0
- package/dist/portals.d.ts +66 -0
- package/dist/prefabs.d.ts +139 -0
- package/dist/presetBuildings.d.ts +52 -0
- package/dist/presetGround.d.ts +22 -0
- package/dist/profiles-B3NS9jwk.js +335 -0
- package/dist/profiles-B3NS9jwk.js.map +1 -0
- package/dist/races.d.ts +136 -0
- package/dist/randomGroups.d.ts +2 -0
- package/dist/registry.d.ts +464 -0
- package/dist/remains.d.ts +119 -0
- package/dist/replication.d.ts +103 -0
- package/dist/rng.d.ts +17 -0
- package/dist/rules.d.ts +395 -0
- package/dist/rulesCheck.d.ts +37 -0
- package/dist/runes.d.ts +41 -0
- package/dist/save.d.ts +277 -0
- package/dist/scenario.d.ts +56 -0
- package/dist/scheduler.d.ts +67 -0
- package/dist/score.d.ts +306 -0
- package/dist/sequences.d.ts +132 -0
- package/dist/server/doorman.d.ts +21 -0
- package/dist/server/gameServer.d.ts +346 -0
- package/dist/server/index.d.ts +24 -0
- package/dist/server/lobby.d.ts +1 -0
- package/dist/server/log.d.ts +13 -0
- package/dist/server/match.d.ts +24 -0
- package/dist/server/mode.d.ts +168 -0
- package/dist/server/navigation-worker.d.ts +1 -0
- package/dist/server/navigation.d.ts +11 -0
- package/dist/server/ops.d.ts +78 -0
- package/dist/server/packs.d.ts +15 -0
- package/dist/server/ratings.d.ts +62 -0
- package/dist/server/relay.d.ts +34 -0
- package/dist/server/rooms.d.ts +162 -0
- package/dist/server/seat.d.ts +2 -0
- package/dist/server/seatSettings.d.ts +15 -0
- package/dist/server/secret.d.ts +5 -0
- package/dist/server/start.d.ts +54 -0
- package/dist/server/websocket.d.ts +74 -0
- package/dist/server.js +2861 -0
- package/dist/server.js.map +1 -0
- package/dist/session/can.d.ts +20 -0
- package/dist/session/commandReplay.d.ts +92 -0
- package/dist/session/debug.d.ts +65 -0
- package/dist/session/delay.d.ts +15 -0
- package/dist/session/delta.d.ts +98 -0
- package/dist/session/entityState.d.ts +1 -0
- package/dist/session/local.d.ts +214 -0
- package/dist/session/memory.d.ts +27 -0
- package/dist/session/protocol.d.ts +1155 -0
- package/dist/session/remote.d.ts +530 -0
- package/dist/session/replay.d.ts +114 -0
- package/dist/session/seed.d.ts +7 -0
- package/dist/session/share.d.ts +78 -0
- package/dist/session/socket.d.ts +8 -0
- package/dist/session/wire.d.ts +153 -0
- package/dist/session/worker.d.ts +227 -0
- package/dist/shared.d.ts +171 -0
- package/dist/sides.d.ts +75 -0
- package/dist/sight.d.ts +27 -0
- package/dist/simulate-oXBiw1Ff.js +167 -0
- package/dist/simulate-oXBiw1Ff.js.map +1 -0
- package/dist/simulate-worker.d.ts +1 -0
- package/dist/simulate-worker.js +28 -0
- package/dist/simulate-worker.js.map +1 -0
- package/dist/simulate.d.ts +154 -0
- package/dist/smart.d.ts +9 -0
- package/dist/spatial.d.ts +62 -0
- package/dist/spawning.d.ts +33 -0
- package/dist/stances.d.ts +76 -0
- package/dist/start.d.ts +71 -0
- package/dist/stats.d.ts +122 -0
- package/dist/summons.d.ts +63 -0
- package/dist/systems/abilities.d.ts +3 -0
- package/dist/systems/combat.d.ts +71 -0
- package/dist/systems/combatTold.d.ts +14 -0
- package/dist/systems/construction.d.ts +34 -0
- package/dist/systems/economy.d.ts +21 -0
- package/dist/systems/fog.d.ts +19 -0
- package/dist/systems/life.d.ts +3 -0
- package/dist/systems/movement.d.ts +105 -0
- package/dist/systems/orders.d.ts +7 -0
- package/dist/systems/production.d.ts +49 -0
- package/dist/systems/productionQueue.d.ts +40 -0
- package/dist/systems/victory.d.ts +14 -0
- package/dist/talk.d.ts +65 -0
- package/dist/tech.d.ts +62 -0
- package/dist/techTree.d.ts +38 -0
- package/dist/terrain.d.ts +173 -0
- package/dist/terrainSave.d.ts +29 -0
- package/dist/testing.d.ts +58 -0
- package/dist/testing.js +822 -0
- package/dist/testing.js.map +1 -0
- package/dist/tiles.d.ts +34 -0
- package/dist/timers.d.ts +146 -0
- package/dist/tomes.d.ts +48 -0
- package/dist/trade.d.ts +28 -0
- package/dist/transport.d.ts +76 -0
- package/dist/tunables.d.ts +45 -0
- package/dist/upkeep.d.ts +16 -0
- package/dist/veterancy.d.ts +80 -0
- package/dist/walls.d.ts +86 -0
- package/dist/world.d.ts +1118 -0
- package/package.json +80 -5
- package/README.md +0 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a session can do besides being a seat (`SessionCan`), made of its own members: what a game played in this page
|
|
3
|
+
* gives, in its thread (`LocalSession`) or in a worker (`WorkerSession`)
|
|
4
|
+
*/
|
|
5
|
+
import type { WorldSave } from '#engine/save';
|
|
6
|
+
import type { Message } from '#engine/messages';
|
|
7
|
+
import type { SessionPace, SessionSaves } from './protocol';
|
|
8
|
+
/** A session's pace, as `SessionCan.pace`: its own `speed` and `advance` */
|
|
9
|
+
export declare function paceOf(session: {
|
|
10
|
+
speed: number;
|
|
11
|
+
advance(ticks?: number): void;
|
|
12
|
+
}): SessionPace;
|
|
13
|
+
/** A session's saves, as `SessionCan.saves`: its own `save` and `checkpoint` */
|
|
14
|
+
export declare function savesOf(session: {
|
|
15
|
+
save(): Promise<WorldSave>;
|
|
16
|
+
readonly checkpoint?: {
|
|
17
|
+
label: Message;
|
|
18
|
+
save: WorldSave;
|
|
19
|
+
};
|
|
20
|
+
}): SessionSaves;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type Apart } from '#engine/determinism';
|
|
2
|
+
import { type GameModule } from '#engine/game';
|
|
3
|
+
import type { Component } from '#engine/components';
|
|
4
|
+
import type { IssuedCommand } from '#engine/commands';
|
|
5
|
+
import type { PlayerId } from '#engine/entity';
|
|
6
|
+
import type { World } from '#engine/world';
|
|
7
|
+
/**
|
|
8
|
+
* A game recorded as its start and its commands (`recordGame`'s `kind: 'commands'`), to run again (`playReplay`)
|
|
9
|
+
*
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export interface CommandReplay {
|
|
13
|
+
format: 2;
|
|
14
|
+
kind: 'commands';
|
|
15
|
+
/** The game it is of, by id: a page plays back what it has */
|
|
16
|
+
game: string;
|
|
17
|
+
/** The rules it was played with exactly (`registry.hash`): other rules may play it otherwise */
|
|
18
|
+
rules: string;
|
|
19
|
+
/** Whose side it is seen from when played back; any side can be, as all of the game is in it */
|
|
20
|
+
player: PlayerId;
|
|
21
|
+
tickRate: number;
|
|
22
|
+
/** The tick it started and ended at */
|
|
23
|
+
from: number;
|
|
24
|
+
to: number;
|
|
25
|
+
/** The world as it was at `from`, as a save (`encodeSave`) */
|
|
26
|
+
start: string;
|
|
27
|
+
/** What its players told it, each at the tick it was given at, before that tick ran */
|
|
28
|
+
commands: [tick: number, command: IssuedCommand][];
|
|
29
|
+
/** The ticks it was saved at: a save puts the crowd back as a load does (D2), so playing back does it there too */
|
|
30
|
+
saves: number[];
|
|
31
|
+
/** The world's fingerprint (`worldFingerprint`) every `every` ticks, to tell where a game played back came apart */
|
|
32
|
+
hashes: [tick: number, hash: string][];
|
|
33
|
+
/**
|
|
34
|
+
* The world as it was every so many ticks (`recordCommands`' `checkpoints`), as saves: a replay played from a moment
|
|
35
|
+
* starts from the last one before it, not from its start. None in a replay made before there were any @beta
|
|
36
|
+
*/
|
|
37
|
+
checkpoints?: [tick: number, save: string][];
|
|
38
|
+
/**
|
|
39
|
+
* The players who could use the debug commands as it was recorded (`World.debugPlayers`, which no save keeps): played
|
|
40
|
+
* back, they may again, so a game whose cheats were used (the editor's Play here, its map edits pushed) comes to the
|
|
41
|
+
* same. None when left out
|
|
42
|
+
*/
|
|
43
|
+
debug?: PlayerId[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A game being recorded as its commands
|
|
47
|
+
*
|
|
48
|
+
* @beta
|
|
49
|
+
*/
|
|
50
|
+
export interface CommandRecorder {
|
|
51
|
+
readonly ticks: number;
|
|
52
|
+
stop(): CommandReplay;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Records a world from now as its start and the commands given to it from outside a tick (the players', by a
|
|
56
|
+
* session or a server; a computer player's are its system's, which runs again), with its hash every `every` ticks
|
|
57
|
+
* (300, ten seconds at 30 a second, when left out). Starting takes a save of the world, as saving does (it puts the
|
|
58
|
+
* crowd back as a load does)
|
|
59
|
+
*
|
|
60
|
+
* @beta
|
|
61
|
+
*/
|
|
62
|
+
export declare function recordCommands(world: World, options: {
|
|
63
|
+
player: PlayerId;
|
|
64
|
+
every?: number;
|
|
65
|
+
checkpoints?: number;
|
|
66
|
+
}): CommandRecorder;
|
|
67
|
+
/**
|
|
68
|
+
* A replay of commands run again, to its end or a tick, with no screen: the world as it is then, the first tick whose
|
|
69
|
+
* hash differs from the one kept (none when all were the same), and what differed first at the first checkpoint
|
|
70
|
+
* (`recordCommands`' `checkpoints`) where the world was not the one recorded: the entity and its field
|
|
71
|
+
* (`entities[id 11].pos.x`), and what each held. A replay with no checkpoints says the tick alone. What a test of a
|
|
72
|
+
* replay, and a server checking one, use
|
|
73
|
+
*
|
|
74
|
+
* @beta
|
|
75
|
+
*/
|
|
76
|
+
export declare function runReplay(replay: CommandReplay, options: {
|
|
77
|
+
game: GameModule;
|
|
78
|
+
to?: number;
|
|
79
|
+
from?: number;
|
|
80
|
+
components?: readonly Component<unknown, unknown>[];
|
|
81
|
+
}): Promise<{
|
|
82
|
+
world: World;
|
|
83
|
+
apart: number | null;
|
|
84
|
+
difference: Apart | null;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Milliseconds of a look a replay being played spends running its game on, at most: what a seek has to catch up on
|
|
88
|
+
* (minute 15 is 27,000 ticks from the start) is run a slice a look, the page drawn between them
|
|
89
|
+
*
|
|
90
|
+
* @beta
|
|
91
|
+
*/
|
|
92
|
+
export declare const REPLAY_SLICE = 12;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type Inspection, type InspectTarget, type LoggedEvent, type WorldListing } from '#engine/inspect';
|
|
2
|
+
import type { World } from '#engine/world';
|
|
3
|
+
import { type SessionDebug } from './protocol';
|
|
4
|
+
import type { DebugAsk } from './wire';
|
|
5
|
+
/** Milliseconds between two words of the debug tools' view of a world elsewhere: a server's, a worker's */
|
|
6
|
+
export declare const DEBUG_EVERY = 100;
|
|
7
|
+
/**
|
|
8
|
+
* The debug tools' view of a world running in the same page. What it hands out is worked out again whenever a
|
|
9
|
+
* snapshot is, and at once when the client asks for something else: a remote one would wait for the answer instead
|
|
10
|
+
*/
|
|
11
|
+
export declare class LocalDebug implements SessionDebug {
|
|
12
|
+
private readonly simulation;
|
|
13
|
+
inspection: Inspection | null;
|
|
14
|
+
world: WorldListing | null;
|
|
15
|
+
private target;
|
|
16
|
+
private listedAt;
|
|
17
|
+
private readonly events;
|
|
18
|
+
constructor(simulation: World);
|
|
19
|
+
inspect(target: InspectTarget | null): void;
|
|
20
|
+
set(path: (string | number)[], value: number | boolean): void;
|
|
21
|
+
get listing(): boolean;
|
|
22
|
+
set listing(on: boolean);
|
|
23
|
+
get logging(): boolean;
|
|
24
|
+
set logging(on: boolean);
|
|
25
|
+
log(): readonly LoggedEvent[];
|
|
26
|
+
clearLog(): void;
|
|
27
|
+
/** Works what is handed out again. The session does when a tick went by */
|
|
28
|
+
refresh(): void;
|
|
29
|
+
dispose(): void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Does what the debug tools of a screen asked of a world here (`DebugAsk`), each field checked first: it comes from
|
|
33
|
+
* anyone who can send anything
|
|
34
|
+
*/
|
|
35
|
+
export declare function askDebug(view: SessionDebug, ask: Record<string, unknown>): void;
|
|
36
|
+
/**
|
|
37
|
+
* The debug tools' view of a world elsewhere, a server's or a worker's: what it asked to follow, said over the wire
|
|
38
|
+
* (`DebugAsk`), and what came back last (`take`)
|
|
39
|
+
*/
|
|
40
|
+
export declare class RemoteDebug implements SessionDebug {
|
|
41
|
+
private readonly ask;
|
|
42
|
+
inspection: Inspection | null;
|
|
43
|
+
world: WorldListing | null;
|
|
44
|
+
private listed;
|
|
45
|
+
private logged;
|
|
46
|
+
private target;
|
|
47
|
+
private events;
|
|
48
|
+
constructor(ask: (ask: DebugAsk) => void);
|
|
49
|
+
inspect(target: InspectTarget | null): void;
|
|
50
|
+
/** Asks again for all it follows: of a world it is served from anew (a session resumed, a replay gone back) */
|
|
51
|
+
askAgain(): void;
|
|
52
|
+
set(path: (string | number)[], value: number | boolean): void;
|
|
53
|
+
get listing(): boolean;
|
|
54
|
+
set listing(on: boolean);
|
|
55
|
+
get logging(): boolean;
|
|
56
|
+
set logging(on: boolean);
|
|
57
|
+
log(): readonly LoggedEvent[];
|
|
58
|
+
clearLog(): void;
|
|
59
|
+
/** What the world's side said of what is followed */
|
|
60
|
+
take(said: {
|
|
61
|
+
inspection: Inspection | null;
|
|
62
|
+
world: WorldListing | null;
|
|
63
|
+
log: readonly LoggedEvent[];
|
|
64
|
+
}): void;
|
|
65
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A watcher shown the game some seconds behind it (RV86): what the host sends goes on after the delay, so that who
|
|
3
|
+
* watches a game being played cannot tell a side where the other is now. The host is answered at once on the
|
|
4
|
+
* watcher's behalf (`ack`), as one who missed nothing: it goes on making each frame against the one before, and keeps
|
|
5
|
+
* nothing more for the delay; the watcher's own answers are not passed on, as they come late. The rest of what the
|
|
6
|
+
* watcher says (a line, a ping) goes as it is said
|
|
7
|
+
*/
|
|
8
|
+
import type { Transport } from './remote';
|
|
9
|
+
/**
|
|
10
|
+
* The host's end of a watcher's transport, with what goes to the watcher held for `seconds` (see the top of this
|
|
11
|
+
* file). Closing it closes the watcher's, and what is held goes with it
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export declare function delayed(transport: Transport, seconds: number): Transport;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { CampInfo, EntityState, OwnEntityState, SessionEvent, Snapshot } from './protocol';
|
|
2
|
+
/**
|
|
3
|
+
* The fog of a team, as runs of the same value: 0s first, then 1s, then 0s... Few runs for a map of open fields
|
|
4
|
+
*
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
export interface FogMessage {
|
|
8
|
+
revealed: boolean;
|
|
9
|
+
visible: number[];
|
|
10
|
+
explored: number[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* What a player knows at a tick: the snapshot (without its events, which go their own way), the fog, the camps, the team
|
|
14
|
+
*
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
export interface Frame {
|
|
18
|
+
snapshot: Snapshot;
|
|
19
|
+
fog: FogMessage;
|
|
20
|
+
camps: CampInfo[];
|
|
21
|
+
team: number;
|
|
22
|
+
}
|
|
23
|
+
/** The parts of a frame besides its entities, sent when they differ from the base's */
|
|
24
|
+
type Rest = Omit<Snapshot, 'tick' | 'entities' | 'events'> & {
|
|
25
|
+
fog: FogMessage;
|
|
26
|
+
camps: CampInfo[];
|
|
27
|
+
team: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A list or an object sent as the parts of it that changed (`$patch`): by index for a list as long as the one before,
|
|
31
|
+
* by key for an object, each part whole or a patch of its own, and the keys of an object that are gone (`$unset`).
|
|
32
|
+
* What a cooldown of one ability of four, or the gold of one player, sends in place of all of them
|
|
33
|
+
*
|
|
34
|
+
* @beta
|
|
35
|
+
*/
|
|
36
|
+
export interface WirePatch {
|
|
37
|
+
/** The parts that changed, by index or key: each the part whole, or a patch of its own */
|
|
38
|
+
$patch: Record<string, unknown>;
|
|
39
|
+
/** The keys of an object that are gone */
|
|
40
|
+
$unset?: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* An entity that changed, as a list rather than an object (what goes over the wire for each one adds up): its id, the
|
|
44
|
+
* fields that are new, those that are gone, and of what only its owner is told (`own`), the same, and its fields that
|
|
45
|
+
* changed in part, as what changed in them (`WirePatch`: one ability's cooldown). Trailing parts that say nothing are
|
|
46
|
+
* left off, the others `0`
|
|
47
|
+
*
|
|
48
|
+
* @beta
|
|
49
|
+
*/
|
|
50
|
+
export type EntityChange = [
|
|
51
|
+
id: number,
|
|
52
|
+
set: Partial<EntityState>,
|
|
53
|
+
unset?: (keyof EntityState)[] | 0,
|
|
54
|
+
ownSet?: Partial<OwnEntityState> | 0,
|
|
55
|
+
ownUnset?: (keyof OwnEntityState)[] | 0,
|
|
56
|
+
ownPatch?: Partial<Record<keyof OwnEntityState, WirePatch>>
|
|
57
|
+
];
|
|
58
|
+
/**
|
|
59
|
+
* A frame as what changed since another (`base`, a tick the player has), or all of it (`base: null`)
|
|
60
|
+
*
|
|
61
|
+
* @beta
|
|
62
|
+
*/
|
|
63
|
+
export interface Delta {
|
|
64
|
+
tick: number;
|
|
65
|
+
base: number | null;
|
|
66
|
+
added: EntityState[];
|
|
67
|
+
changed: EntityChange[];
|
|
68
|
+
removed: number[];
|
|
69
|
+
rest: Partial<Rest>;
|
|
70
|
+
/** The other parts that changed in part, as what changed in them (`WirePatch`: the gold of one player of four) */
|
|
71
|
+
restPatch?: Partial<Record<keyof Rest, WirePatch>>;
|
|
72
|
+
/**
|
|
73
|
+
* The batches of events the player has not said it got, each by its own number (`n`) and the tick it went out with:
|
|
74
|
+
* sent again until it does, applied once. Talk between two ticks is a batch of its own (RV14)
|
|
75
|
+
*/
|
|
76
|
+
events: {
|
|
77
|
+
tick: number;
|
|
78
|
+
n: number;
|
|
79
|
+
events: SessionEvent[];
|
|
80
|
+
}[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* An entity's state with its numbers rounded for the wire: positions to 1/256 of a unit (16 bits over a map of 256),
|
|
84
|
+
* the facing to a 256th of a turn, health and shield up to whole points (what is alive keeps at least one), mana down
|
|
85
|
+
* (an ability is never shown ready that the simulation would refuse), what is under way to hundredths, the seconds
|
|
86
|
+
* left of buffs and of shared cooldowns up to whole seconds
|
|
87
|
+
*
|
|
88
|
+
* @beta
|
|
89
|
+
*/
|
|
90
|
+
export declare function quantize(state: EntityState): EntityState;
|
|
91
|
+
/**
|
|
92
|
+
* Characters of a delta's text by what they carry, added to `into`: each field of an entity, of those added and those
|
|
93
|
+
* changed together (`entity.hp`; of what only its owner is told, `entity.own.abilities`), the other parts (`rest.fog`),
|
|
94
|
+
* `events`, `removed`, and what is left (ids, brackets, the tick) as `other`, so that they add up to `text`'s length.
|
|
95
|
+
* A field is its key, its value and the comma between, as `JSON.stringify` writes them
|
|
96
|
+
*/
|
|
97
|
+
export declare function bytesByKey(delta: Delta, text: string, into: Record<string, number>): void;
|
|
98
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import type { Logger } from '#engine/log';
|
|
2
|
+
import type { MapCamera, MapDoodad, MapEnvironment, MapPath, MapRegion } from '#engine/map';
|
|
3
|
+
import { type Lane } from '#engine/lanes';
|
|
4
|
+
import type { PlayerId } from '#engine/entity';
|
|
5
|
+
import type { Vec2 } from '#engine/math';
|
|
6
|
+
import type { Registry } from '#engine/registry';
|
|
7
|
+
import type { Terrain } from '#engine/terrain';
|
|
8
|
+
import type { World } from '#engine/world';
|
|
9
|
+
import type { CampInfo, FogState, GameSession, MineInfo, PlayerCommand, SessionEvent, Snapshot, SessionCan } from './protocol';
|
|
10
|
+
import type { Message } from '#engine/messages';
|
|
11
|
+
import { type WorldSave } from '#engine/save';
|
|
12
|
+
import { LocalDebug } from './debug';
|
|
13
|
+
import { SessionView } from '#engine/replication';
|
|
14
|
+
/**
|
|
15
|
+
* The events a computer player's seat hears (`forComputer`): the facts a brain reads and a save keeps for it (deaths,
|
|
16
|
+
* damage, healing, pings, chat, the game's own events) and the answers to its commands. The rest is for a screen (an
|
|
17
|
+
* attack's swing, a shot, a buff, a hammer blow, a line said), and a computer's seat is spared hearing it
|
|
18
|
+
*
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
export declare const COMPUTER_EVENTS: ReadonlySet<SessionEvent['type']>;
|
|
22
|
+
/** @beta */
|
|
23
|
+
export declare class LocalSession implements GameSession {
|
|
24
|
+
/** For tools and tests. Clients have no business here, they go through the session */
|
|
25
|
+
readonly world: World;
|
|
26
|
+
readonly playerId: PlayerId;
|
|
27
|
+
readonly terrain: Terrain;
|
|
28
|
+
readonly environment?: MapEnvironment;
|
|
29
|
+
readonly doodads: readonly MapDoodad[];
|
|
30
|
+
readonly regions: readonly MapRegion[];
|
|
31
|
+
readonly cameras: readonly MapCamera[];
|
|
32
|
+
readonly paths: readonly MapPath[];
|
|
33
|
+
readonly registry: Registry;
|
|
34
|
+
readonly tickRate: number;
|
|
35
|
+
alpha: number;
|
|
36
|
+
/** What the world says (`World.log`): a session in the page has it, and the client shows it with its own */
|
|
37
|
+
get log(): Logger;
|
|
38
|
+
/** Why the game ended on an error, once it has (`World.failure`) */
|
|
39
|
+
get failure(): {
|
|
40
|
+
message: string;
|
|
41
|
+
} | null;
|
|
42
|
+
/** Simulation speed multiplier, 0 pauses. A debug control, a real server sets the pace itself */
|
|
43
|
+
speed: number;
|
|
44
|
+
private accumulator;
|
|
45
|
+
/** Whether the team saw the whole map at the last snapshot (the debug switch): what it saw then only is forgotten after */
|
|
46
|
+
private wasRevealed;
|
|
47
|
+
/** What the player's team remembers, or an observer's own (`SessionView.memory`) */
|
|
48
|
+
private get memory();
|
|
49
|
+
/** Ids of what made it into the snapshot being put together as in sight. Kept to be cleared, not made anew */
|
|
50
|
+
private readonly inSight;
|
|
51
|
+
/** The names the map or the rules gave entities, by id, as of the snapshot being put together (`world.named`) */
|
|
52
|
+
private readonly namesNow;
|
|
53
|
+
private readonly disposers;
|
|
54
|
+
private pendingCheckpoint?;
|
|
55
|
+
checkpoint?: {
|
|
56
|
+
label: Message;
|
|
57
|
+
save: WorldSave;
|
|
58
|
+
};
|
|
59
|
+
readonly debug: LocalDebug;
|
|
60
|
+
/** Its pace, saves of its world, the debug tools' view, and what a computer player's brain reads (`SessionCan`) */
|
|
61
|
+
readonly can: SessionCan;
|
|
62
|
+
/**
|
|
63
|
+
* Who only watches, and sees everything: every entity, the whole map, every player's resources and heroes. From
|
|
64
|
+
* `playerId`'s side all the same (who is an ally, an enemy). For a server's watchers, whose commands go nowhere
|
|
65
|
+
*/
|
|
66
|
+
readonly observer: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Whose seat is a computer player's (`forComputer`): its snapshots leave out projectiles, missiles, corpses, reveals
|
|
69
|
+
* and the events a brain never reads, and it listens for none of those, so twelve computers cost the world less
|
|
70
|
+
*/
|
|
71
|
+
readonly forComputer: boolean;
|
|
72
|
+
/** The seat's side of the world: whose it is, what they may know, what was told to them since the last snapshot */
|
|
73
|
+
readonly view: SessionView;
|
|
74
|
+
constructor(
|
|
75
|
+
/** For tools and tests. Clients have no business here, they go through the session */
|
|
76
|
+
world: World, playerId: PlayerId,
|
|
77
|
+
/**
|
|
78
|
+
* `debug`: the player may use the debug commands (see `world.debugPlayers`). `ownsWorld`: the world is the
|
|
79
|
+
* session's, and goes with it (`dispose`): for a game played in the page, where the session is all the screen
|
|
80
|
+
* holds of it. Not for a world others play too, or one that goes on after this session (a host's seats, the computer's).
|
|
81
|
+
* `forComputer`: the seat is a computer player's, and its snapshots carry what a brain reads and none of what a
|
|
82
|
+
* screen needs (`COMPUTER_EVENTS`): cheaper to take, and fewer of the world's events to hear.
|
|
83
|
+
* `mostEffects` (`@beta`): how many of the effects the rules play are kept for their stop, 1024 when left out
|
|
84
|
+
*/
|
|
85
|
+
options?: {
|
|
86
|
+
observer?: boolean;
|
|
87
|
+
debug?: boolean;
|
|
88
|
+
ownsWorld?: boolean;
|
|
89
|
+
forComputer?: boolean;
|
|
90
|
+
mostEffects?: number;
|
|
91
|
+
});
|
|
92
|
+
/** Whether the seat is told of events of a kind: a player's seat of all of them, a computer's of what a brain reads */
|
|
93
|
+
private hears;
|
|
94
|
+
/** The player's team: theirs now, as the rules may move them to another (`setTeam`) */
|
|
95
|
+
get team(): number;
|
|
96
|
+
private isAlly;
|
|
97
|
+
/** Whether the player's team sees a spot of the map right now: an observer sees all of it */
|
|
98
|
+
private sees;
|
|
99
|
+
/** Whether the player's team can see the entity right now */
|
|
100
|
+
private knows;
|
|
101
|
+
/**
|
|
102
|
+
* What everyone in sight of an entity is told of it this tick, the same for every seat: worked out once for all
|
|
103
|
+
* the sessions of a world while a host's round of sending is on (`shareCaptures`), else for this session alone
|
|
104
|
+
*/
|
|
105
|
+
private common;
|
|
106
|
+
/**
|
|
107
|
+
* What this player is told of an entity: what everyone is (`common`, shared between the seats of a host), and on a
|
|
108
|
+
* copy of it what is this player's to know: an illusion's lifetime on its own side, the components replicated to it
|
|
109
|
+
* and what they make of themselves for it, and its own part (`own`) for an ally's
|
|
110
|
+
*/
|
|
111
|
+
private describe;
|
|
112
|
+
/**
|
|
113
|
+
* What the seats of this one's side are told alike this round (`Round.sides`), by entity: none outside a host's round.
|
|
114
|
+
* Set as the capture starts (`capture`)
|
|
115
|
+
*/
|
|
116
|
+
private sideNow;
|
|
117
|
+
/**
|
|
118
|
+
* Which seats are told the same of an entity where nothing of it is one player's: an observer's, or a team's with the
|
|
119
|
+
* same allies among the players (relations are a pair of players', not a team's)
|
|
120
|
+
*/
|
|
121
|
+
private sideKey;
|
|
122
|
+
/**
|
|
123
|
+
* Whether what this player is told of an entity is theirs alone, not their side's: a component replicated to its owner
|
|
124
|
+
* or shaping itself for each player (`Component.snapshot`), or control of another's unit shared with this player
|
|
125
|
+
*/
|
|
126
|
+
private isOnePlayers;
|
|
127
|
+
/** Where in the list being captured are those that may be one player's (`SideSeen.mine`): while the first seat of a side captures */
|
|
128
|
+
private mineNow;
|
|
129
|
+
/**
|
|
130
|
+
* What the team remembers of a structure is every teammate's to be told, not this seat's: without the parts of the
|
|
131
|
+
* description shaped for one player (components replicated to the owner, or made by their `snapshot` for whoever is
|
|
132
|
+
* told), which the seat that happened to see it first would otherwise give to the whole team
|
|
133
|
+
*/
|
|
134
|
+
private forTeam;
|
|
135
|
+
/** Adds what the player sees of an entity in sight to the snapshot, and remembers structures for when they are out of sight */
|
|
136
|
+
private see;
|
|
137
|
+
/** Throws when what was taken to be in sight is not what testing every entity gives. See `debugChecks` */
|
|
138
|
+
private checkSight;
|
|
139
|
+
/** The scenery the player's team sees right now */
|
|
140
|
+
private sceneryInSight;
|
|
141
|
+
/**
|
|
142
|
+
* On a map explored from the start, what stands on it and belongs to no player (trees, mines, rocks, neutral
|
|
143
|
+
* buildings, the creeps' own) known to the team from the first snapshot, as it stands, out of sight: the genre's melee
|
|
144
|
+
* maps. Once for a team (`TeamMemory.startKnown`); units, and players' buildings, only once seen
|
|
145
|
+
*/
|
|
146
|
+
private knowStart;
|
|
147
|
+
private capture;
|
|
148
|
+
/** The entities in sight, and what the side remembers out of it, as the first seat of a side (or a seat on its own) sees them */
|
|
149
|
+
private seeAll;
|
|
150
|
+
/**
|
|
151
|
+
* What another seat of the side saw this round, as this one sees it: the same, but what may be this player's alone
|
|
152
|
+
* described again for them. The side's memory is the first seat's to keep
|
|
153
|
+
*/
|
|
154
|
+
private seeAsSide;
|
|
155
|
+
/** The rest of a snapshot, round its entities: the players, and every feature's part (`SnapshotPart`) */
|
|
156
|
+
private finish;
|
|
157
|
+
snapshot(): Snapshot;
|
|
158
|
+
/**
|
|
159
|
+
* Moves the game on by `ticks` at the next update, however fast it goes: a step of a paused game (`speed` 0), as
|
|
160
|
+
* an editor's Step does. Ticks asked for while it runs are taken on top of its pace
|
|
161
|
+
*/
|
|
162
|
+
advance(ticks?: number): void;
|
|
163
|
+
/** A save of the world as it stands (`saveWorld`): at once, as a promise for what a session elsewhere answers later */
|
|
164
|
+
save(): Promise<WorldSave>;
|
|
165
|
+
/**
|
|
166
|
+
* Runs the game on by itself, a tick at a time, as fast as the page can, until `until` holds of the world, `most`
|
|
167
|
+
* ticks have run, the game is over, or `deadline` (`performance.now()`'s) is past: what an editor's "Play to" does a
|
|
168
|
+
* slice a frame, its pace and `advance` aside. The ticks are the same ticks the game runs at its own pace, so the
|
|
169
|
+
* same game comes to the same moment. What happened in them is in the next snapshot (`update`), as after a slow frame.
|
|
170
|
+
* `until` is asked before the first tick too: what holds already runs none
|
|
171
|
+
*/
|
|
172
|
+
runUntil(until: (world: World) => boolean, options?: {
|
|
173
|
+
most?: number;
|
|
174
|
+
deadline?: number;
|
|
175
|
+
}): {
|
|
176
|
+
ticks: number;
|
|
177
|
+
reached: boolean;
|
|
178
|
+
over: boolean;
|
|
179
|
+
};
|
|
180
|
+
/** What `runUntil` gives back, the debug tools' view brought up to date where it ran */
|
|
181
|
+
private ran;
|
|
182
|
+
/** Whether `runUntil` ran ticks since the last update: its next snapshot describes them, paused or not */
|
|
183
|
+
private ranOn;
|
|
184
|
+
/** A tick of the world, and the checkpoint it marked saved as the world stood at its end, not at the end of the frame */
|
|
185
|
+
private tickOnce;
|
|
186
|
+
update(dt: number): Snapshot[];
|
|
187
|
+
/** Sends a command. `seq` is the sender's own number for it, for a host passing on what a remote player numbered */
|
|
188
|
+
send(command: PlayerCommand, seq?: number): number;
|
|
189
|
+
/**
|
|
190
|
+
* The number of the last command sent: a computer's seat keeps it through a save, so the commands it sends after a
|
|
191
|
+
* load are numbered as they would have been
|
|
192
|
+
*
|
|
193
|
+
* @beta
|
|
194
|
+
*/
|
|
195
|
+
lastSeq: number;
|
|
196
|
+
fog(): FogState;
|
|
197
|
+
/** Where the game's money is mined, as the map shows it, seen or not (`GameSession.mines`, `minesFor`) */
|
|
198
|
+
mines(): readonly MineInfo[];
|
|
199
|
+
/** The lanes of the map, as the map shows them (`GameSession.lanes`) */
|
|
200
|
+
lanes(): readonly Lane[];
|
|
201
|
+
/** The camps as the player knows them (`GameSession.camps`, `campsFor`): worked out once a tick */
|
|
202
|
+
camps(): readonly CampInfo[];
|
|
203
|
+
canPlace(unitType: string, point: Vec2): boolean;
|
|
204
|
+
/** Which cells of a building's ground are in the way for the player: taken, or not explored by their team (`placementCells`) */
|
|
205
|
+
placeCells(unitType: string, point: Vec2): readonly boolean[] | undefined;
|
|
206
|
+
findPath(from: Vec2, to: Vec2, flying?: boolean): Vec2[] | null;
|
|
207
|
+
/** What happened since the last snapshot, not yet given in one: a copy, for a computer's save */
|
|
208
|
+
pendingEvents(): SessionEvent[];
|
|
209
|
+
/** Takes back what `pendingEvents` gave, ahead of what has happened since: in a game loaded from a save */
|
|
210
|
+
restoreEvents(events: readonly SessionEvent[]): void;
|
|
211
|
+
/** Whether the world goes with the session */
|
|
212
|
+
private readonly ownsWorld;
|
|
213
|
+
dispose(): void;
|
|
214
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { EntityId } from '#engine/entity';
|
|
2
|
+
import type { EntityState } from './protocol';
|
|
3
|
+
/**
|
|
4
|
+
* What a team remembers of the map: enemy structures out of sight as they were last seen, and camps found empty
|
|
5
|
+
*
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export interface TeamMemory {
|
|
9
|
+
/** Structures out of sight, the way they looked when last seen, by id */
|
|
10
|
+
structures: Record<EntityId, EntityState>;
|
|
11
|
+
/** The camps the team has seen empty, by id */
|
|
12
|
+
cleared: number[];
|
|
13
|
+
/**
|
|
14
|
+
* Whether what stands on a map explored from the start and is no player's (trees, mines, neutral buildings) has been
|
|
15
|
+
* put among `structures`, as it stood when the team first looked (`FogOfWar.exploredFromStart`)
|
|
16
|
+
*
|
|
17
|
+
* @beta
|
|
18
|
+
*/
|
|
19
|
+
startKnown?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Cells of the game's layers the rules changed out of the team's sight (`world.setCells`), as the team last knew
|
|
22
|
+
* them: by layer, the value by cell. Told as they are now when they come into sight (`cellsSeen`), and gone from here
|
|
23
|
+
*
|
|
24
|
+
* @beta
|
|
25
|
+
*/
|
|
26
|
+
cells?: Record<string, Record<number, number>>;
|
|
27
|
+
}
|