@v12-engine/engine 0.1.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abilities/amounts.d.ts +28 -0
- package/dist/abilities/amounts.js +74 -0
- package/dist/abilities/amounts.js.map +1 -0
- package/dist/abilities/buffs.d.ts +106 -6
- package/dist/abilities/buffs.js +443 -0
- package/dist/abilities/buffs.js.map +1 -0
- package/dist/abilities/castTold.d.ts +2 -0
- package/dist/abilities/castTold.js +66 -0
- package/dist/abilities/castTold.js.map +1 -0
- package/dist/abilities/chance.d.ts +38 -0
- package/dist/abilities/chance.js +77 -0
- package/dist/abilities/chance.js.map +1 -0
- package/dist/abilities/charges.d.ts +18 -0
- package/dist/abilities/charges.js +101 -0
- package/dist/abilities/charges.js.map +1 -0
- package/dist/abilities/control.d.ts +28 -0
- package/dist/abilities/control.js +113 -0
- package/dist/abilities/control.js.map +1 -0
- package/dist/abilities/dispel.js +51 -0
- package/dist/abilities/dispel.js.map +1 -0
- package/dist/abilities/effectFields.d.ts +1 -1
- package/dist/abilities/effectFields.js +676 -0
- package/dist/abilities/effectFields.js.map +1 -0
- package/dist/abilities/effectIndex.d.ts +27 -0
- package/dist/abilities/effectIndex.js +64 -0
- package/dist/abilities/effectIndex.js.map +1 -0
- package/dist/abilities/effects/buff.d.ts +9 -3
- package/dist/abilities/effects/buff.js +84 -0
- package/dist/abilities/effects/buff.js.map +1 -0
- package/dist/abilities/effects/conditions.d.ts +2 -0
- package/dist/abilities/effects/conditions.js +41 -0
- package/dist/abilities/effects/conditions.js.map +1 -0
- package/dist/abilities/effects/core.js +54 -0
- package/dist/abilities/effects/core.js.map +1 -0
- package/dist/abilities/effects/damage.d.ts +1 -1
- package/dist/abilities/effects/damage.js +43 -0
- package/dist/abilities/effects/damage.js.map +1 -0
- package/dist/abilities/effects/heal.d.ts +2 -2
- package/dist/abilities/effects/heal.js +51 -0
- package/dist/abilities/effects/heal.js.map +1 -0
- package/dist/abilities/effects/missile.d.ts +13 -1
- package/dist/abilities/effects/missile.js +104 -0
- package/dist/abilities/effects/missile.js.map +1 -0
- package/dist/abilities/effects/morph.d.ts +5 -0
- package/dist/abilities/effects/morph.js +43 -0
- package/dist/abilities/effects/morph.js.map +1 -0
- package/dist/abilities/effects/moves.d.ts +16 -4
- package/dist/abilities/effects/moves.js +212 -0
- package/dist/abilities/effects/moves.js.map +1 -0
- package/dist/abilities/effects/passives.d.ts +19 -9
- package/dist/abilities/effects/passives.js +131 -0
- package/dist/abilities/effects/passives.js.map +1 -0
- package/dist/abilities/effects/proxy.d.ts +5 -0
- package/dist/abilities/effects/proxy.js +60 -0
- package/dist/abilities/effects/proxy.js.map +1 -0
- package/dist/abilities/effects/sight.d.ts +2 -2
- package/dist/abilities/effects/sight.js +39 -0
- package/dist/abilities/effects/sight.js.map +1 -0
- package/dist/abilities/effects/spawn.d.ts +5 -2
- package/dist/abilities/effects/spawn.js +40 -0
- package/dist/abilities/effects/spawn.js.map +1 -0
- package/dist/abilities/effects/timed.d.ts +2 -2
- package/dist/abilities/effects/timed.js +96 -0
- package/dist/abilities/effects/timed.js.map +1 -0
- package/dist/abilities/effects/trade.d.ts +1 -1
- package/dist/abilities/effects/trade.js +25 -0
- package/dist/abilities/effects/trade.js.map +1 -0
- package/dist/abilities/effects.d.ts +97 -23
- package/dist/abilities/effects.js +860 -0
- package/dist/abilities/effects.js.map +1 -0
- package/dist/abilities/land.d.ts +38 -4
- package/dist/abilities/land.js +189 -0
- package/dist/abilities/land.js.map +1 -0
- package/dist/abilities/recast.d.ts +45 -0
- package/dist/abilities/recast.js +118 -0
- package/dist/abilities/recast.js.map +1 -0
- package/dist/abilities/scaled.js +40 -0
- package/dist/abilities/scaled.js.map +1 -0
- package/dist/abilities/screen.d.ts +6 -0
- package/dist/abilities/screen.js +83 -0
- package/dist/abilities/screen.js.map +1 -0
- package/dist/abilities/shapes.d.ts +66 -0
- package/dist/abilities/shapes.js +122 -0
- package/dist/abilities/shapes.js.map +1 -0
- package/dist/abilities/text.d.ts +14 -2
- package/dist/abilities/text.js +204 -0
- package/dist/abilities/text.js.map +1 -0
- package/dist/abilities/triggers.d.ts +98 -0
- package/dist/abilities/triggers.js +351 -0
- package/dist/abilities/triggers.js.map +1 -0
- package/dist/abilityChanges.d.ts +131 -0
- package/dist/abilityChanges.js +345 -0
- package/dist/abilityChanges.js.map +1 -0
- package/dist/ai/area.d.ts +4 -1
- package/dist/ai/brain.d.ts +4 -1
- package/dist/ai/brain.js +844 -0
- package/dist/ai/brain.js.map +1 -0
- package/dist/ai/budget.js +74 -0
- package/dist/ai/budget.js.map +1 -0
- package/dist/ai/checks.d.ts +9 -1
- package/dist/ai/checks.js +242 -0
- package/dist/ai/checks.js.map +1 -0
- package/dist/ai/computer.d.ts +11 -4
- package/dist/ai/computer.js +251 -0
- package/dist/ai/computer.js.map +1 -0
- package/dist/ai/defence.d.ts +4 -0
- package/dist/ai/defence.js +430 -0
- package/dist/ai/defence.js.map +1 -0
- package/dist/ai/define.d.ts +3 -2
- package/dist/ai/define.js +31 -0
- package/dist/ai/define.js.map +1 -0
- package/dist/ai/economy.d.ts +10 -7
- package/dist/ai/economy.js +780 -0
- package/dist/ai/economy.js.map +1 -0
- package/dist/ai/geometry.js +38 -0
- package/dist/ai/geometry.js.map +1 -0
- package/dist/ai/goals.d.ts +1 -0
- package/dist/ai/goals.js +560 -0
- package/dist/ai/goals.js.map +1 -0
- package/dist/ai/knowledge.d.ts +72 -7
- package/dist/ai/knowledge.js +804 -0
- package/dist/ai/knowledge.js.map +1 -0
- package/dist/ai/lanes.d.ts +10 -2
- package/dist/ai/lanes.js +715 -0
- package/dist/ai/lanes.js.map +1 -0
- package/dist/ai/melee/build.js +264 -0
- package/dist/ai/melee/build.js.map +1 -0
- package/dist/ai/melee/goals.d.ts +7 -0
- package/dist/ai/melee/goals.js +720 -0
- package/dist/ai/melee/goals.js.map +1 -0
- package/dist/ai/melee/heroes.js +68 -0
- package/dist/ai/melee/heroes.js.map +1 -0
- package/dist/ai/melee/index.d.ts +1 -1
- package/dist/ai/melee/index.js +51 -0
- package/dist/ai/melee/index.js.map +1 -0
- package/dist/ai/melee/production.js +29 -0
- package/dist/ai/melee/production.js.map +1 -0
- package/dist/ai/melee/surrender.js +64 -0
- package/dist/ai/melee/surrender.js.map +1 -0
- package/dist/ai/micro.d.ts +9 -0
- package/dist/ai/micro.js +1316 -0
- package/dist/ai/micro.js.map +1 -0
- package/dist/ai/mission.d.ts +9 -2
- package/dist/ai/mission.js +538 -0
- package/dist/ai/mission.js.map +1 -0
- package/dist/ai/missionRules.d.ts +1 -1
- package/dist/ai/missionRules.js +26 -0
- package/dist/ai/missionRules.js.map +1 -0
- package/dist/ai/module.d.ts +6 -2
- package/dist/ai/module.js +37 -0
- package/dist/ai/module.js.map +1 -0
- package/dist/ai/options.d.ts +3 -3
- package/dist/ai/plans/build.d.ts +20 -1
- package/dist/ai/plans/build.js +608 -0
- package/dist/ai/plans/build.js.map +1 -0
- package/dist/ai/plans/placement.d.ts +4 -1
- package/dist/ai/plans/placement.js +295 -0
- package/dist/ai/plans/placement.js.map +1 -0
- package/dist/ai/plans/plans.d.ts +9 -0
- package/dist/ai/plans/plans.js +110 -0
- package/dist/ai/plans/plans.js.map +1 -0
- package/dist/ai/plans/production.d.ts +14 -2
- package/dist/ai/plans/production.js +434 -0
- package/dist/ai/plans/production.js.map +1 -0
- package/dist/ai/plans/purse.d.ts +6 -3
- package/dist/ai/plans/purse.js +139 -0
- package/dist/ai/plans/purse.js.map +1 -0
- package/dist/ai/plans/tech.d.ts +6 -0
- package/dist/ai/plans/tech.js +122 -0
- package/dist/ai/plans/tech.js.map +1 -0
- package/dist/ai/profiles.d.ts +4 -4
- package/dist/{profiles-B3NS9jwk.js → ai/profiles.js} +3 -98
- package/dist/ai/profiles.js.map +1 -0
- package/dist/ai/reach.js +54 -0
- package/dist/ai/reach.js.map +1 -0
- package/dist/ai/report.d.ts +8 -0
- package/dist/ai/report.js +87 -0
- package/dist/ai/report.js.map +1 -0
- package/dist/ai/roles.d.ts +4 -0
- package/dist/ai/roles.js +207 -0
- package/dist/ai/roles.js.map +1 -0
- package/dist/ai/rules.d.ts +8 -2
- package/dist/ai/rules.js +416 -0
- package/dist/ai/rules.js.map +1 -0
- package/dist/ai/scouting.d.ts +6 -0
- package/dist/ai/scouting.js +324 -0
- package/dist/ai/scouting.js.map +1 -0
- package/dist/ai/settings.js +99 -0
- package/dist/ai/settings.js.map +1 -0
- package/dist/ai/squads.d.ts +21 -2
- package/dist/ai/squads.js +916 -0
- package/dist/ai/squads.js.map +1 -0
- package/dist/ai/strength.js +320 -0
- package/dist/ai/strength.js.map +1 -0
- package/dist/ai/task.d.ts +3 -1
- package/dist/ai/task.js +17 -0
- package/dist/ai/task.js.map +1 -0
- package/dist/ai/tasks/attack.js +24 -0
- package/dist/ai/tasks/attack.js.map +1 -0
- package/dist/ai/tasks/capture.d.ts +3 -3
- package/dist/ai/tasks/capture.js +37 -0
- package/dist/ai/tasks/capture.js.map +1 -0
- package/dist/ai/tasks/creep.js +29 -0
- package/dist/ai/tasks/creep.js.map +1 -0
- package/dist/ai/tasks/defend.js +61 -0
- package/dist/ai/tasks/defend.js.map +1 -0
- package/dist/ai/tasks/drop.js +81 -0
- package/dist/ai/tasks/drop.js.map +1 -0
- package/dist/ai/tasks/escort.js +59 -0
- package/dist/ai/tasks/escort.js.map +1 -0
- package/dist/ai/tasks/gather.js +48 -0
- package/dist/ai/tasks/gather.js.map +1 -0
- package/dist/ai/tasks/harass.js +39 -0
- package/dist/ai/tasks/harass.js.map +1 -0
- package/dist/ai/tasks/hold.js +32 -0
- package/dist/ai/tasks/hold.js.map +1 -0
- package/dist/ai/tasks/index.js +34 -0
- package/dist/ai/tasks/index.js.map +1 -0
- package/dist/ai/tasks/move.js +26 -0
- package/dist/ai/tasks/move.js.map +1 -0
- package/dist/ai/tasks/patrol.js +59 -0
- package/dist/ai/tasks/patrol.js.map +1 -0
- package/dist/ai/tasks/retreat.js +28 -0
- package/dist/ai/tasks/retreat.js.map +1 -0
- package/dist/ai/tasks/scout.js +73 -0
- package/dist/ai/tasks/scout.js.map +1 -0
- package/dist/ai/tasks/shared.d.ts +1 -1
- package/dist/ai/tasks/shared.js +137 -0
- package/dist/ai/tasks/shared.js.map +1 -0
- package/dist/ai/team.d.ts +18 -1
- package/dist/ai/team.js +492 -0
- package/dist/ai/team.js.map +1 -0
- package/dist/ai/threat.d.ts +6 -0
- package/dist/ai/threat.js +206 -0
- package/dist/ai/threat.js.map +1 -0
- package/dist/ai/view.d.ts +21 -7
- package/dist/ai/view.js +677 -0
- package/dist/ai/view.js.map +1 -0
- package/dist/ai/waves.d.ts +6 -0
- package/dist/ai/waves.js +410 -0
- package/dist/ai/waves.js.map +1 -0
- package/dist/ai.js +54 -6239
- package/dist/aiTesting.d.ts +6 -3
- package/dist/aiTesting.js +229 -0
- package/dist/aiTesting.js.map +1 -0
- package/dist/areas.d.ts +4 -1
- package/dist/areas.js +295 -0
- package/dist/areas.js.map +1 -0
- package/dist/attacks.d.ts +3 -3
- package/dist/attacks.js +127 -0
- package/dist/attacks.js.map +1 -0
- package/dist/burning.d.ts +267 -0
- package/dist/burning.js +795 -0
- package/dist/burning.js.map +1 -0
- package/dist/bytes.js +21 -0
- package/dist/bytes.js.map +1 -0
- package/dist/callings.d.ts +71 -0
- package/dist/callings.js +157 -0
- package/dist/callings.js.map +1 -0
- package/dist/cameraOrders.d.ts +78 -0
- package/dist/cameraOrders.js +114 -0
- package/dist/cameraOrders.js.map +1 -0
- package/dist/camps.d.ts +70 -4
- package/dist/camps.js +501 -0
- package/dist/camps.js.map +1 -0
- package/dist/capture.d.ts +15 -3
- package/dist/capture.js +304 -0
- package/dist/capture.js.map +1 -0
- package/dist/cellLayers.d.ts +78 -13
- package/dist/cellLayers.js +275 -0
- package/dist/cellLayers.js.map +1 -0
- package/dist/cellPatches.d.ts +24 -0
- package/dist/cellPatches.js +73 -0
- package/dist/cellPatches.js.map +1 -0
- package/dist/cinematics.d.ts +10 -5
- package/dist/cinematics.js +161 -0
- package/dist/cinematics.js.map +1 -0
- package/dist/clock.d.ts +2 -2
- package/dist/clock.js +78 -0
- package/dist/clock.js.map +1 -0
- package/dist/commands.d.ts +36 -4
- package/dist/commands.js +636 -0
- package/dist/commands.js.map +1 -0
- package/dist/components.d.ts +31 -10
- package/dist/components.js +74 -0
- package/dist/components.js.map +1 -0
- package/dist/computers.d.ts +4 -4
- package/dist/computers.js +194 -0
- package/dist/computers.js.map +1 -0
- package/dist/concealment.d.ts +25 -2
- package/dist/concealment.js +409 -0
- package/dist/concealment.js.map +1 -0
- package/dist/coreComponents.js +130 -0
- package/dist/coreComponents.js.map +1 -0
- package/dist/createGame.d.ts +306 -0
- package/dist/createGame.js +405 -0
- package/dist/createGame.js.map +1 -0
- package/dist/dashing.d.ts +18 -2
- package/dist/dashing.js +41 -0
- package/dist/dashing.js.map +1 -0
- package/dist/debug.d.ts +8 -0
- package/dist/debug.js +5 -3
- package/dist/debug2.js +76 -0
- package/dist/debug2.js.map +1 -0
- package/dist/debugCommands.d.ts +6 -6
- package/dist/debugCommands.js +537 -0
- package/dist/debugCommands.js.map +1 -0
- package/dist/debugging.d.ts +1 -0
- package/dist/defaultSets.d.ts +183 -0
- package/dist/defaultSets.js +216 -0
- package/dist/defaultSets.js.map +1 -0
- package/dist/definitions.d.ts +6 -0
- package/dist/definitions.js +78 -0
- package/dist/definitions.js.map +1 -0
- package/dist/defs.d.ts +1895 -165
- package/dist/defs.js +380 -0
- package/dist/defs.js.map +1 -0
- package/dist/denying.d.ts +4 -4
- package/dist/denying.js +106 -0
- package/dist/denying.js.map +1 -0
- package/dist/destructibles.d.ts +2 -2
- package/dist/destructibles.js +36 -0
- package/dist/destructibles.js.map +1 -0
- package/dist/determinism.d.ts +4 -4
- package/dist/determinism.js +247 -0
- package/dist/determinism.js.map +1 -0
- package/dist/dialog.d.ts +17 -2
- package/dist/dialog.js +108 -0
- package/dist/dialog.js.map +1 -0
- package/dist/effectRefs.js +28 -0
- package/dist/effectRefs.js.map +1 -0
- package/dist/effects.d.ts +27 -11
- package/dist/effects.js +110 -0
- package/dist/effects.js.map +1 -0
- package/dist/endings.d.ts +1 -1
- package/dist/endings.js +78 -0
- package/dist/endings.js.map +1 -0
- package/dist/engagement.d.ts +40 -6
- package/dist/engagement.js +530 -0
- package/dist/engagement.js.map +1 -0
- package/dist/engineEvents.d.ts +72 -9
- package/dist/engineEvents.js +520 -0
- package/dist/engineEvents.js.map +1 -0
- package/dist/entity.d.ts +275 -26
- package/dist/entity.js +441 -0
- package/dist/entity.js.map +1 -0
- package/dist/entityIndex.d.ts +10 -3
- package/dist/entityIndex.js +149 -0
- package/dist/entityIndex.js.map +1 -0
- package/dist/errors.d.ts +6 -2
- package/dist/errors.js +59 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +11 -5
- package/dist/events.js +158 -0
- package/dist/events.js.map +1 -0
- package/dist/exactMath.js +273 -0
- package/dist/exactMath.js.map +1 -0
- package/dist/features.d.ts +1 -1
- package/dist/features.js +127 -0
- package/dist/features.js.map +1 -0
- package/dist/fields.d.ts +25 -5
- package/dist/fields.js +140 -0
- package/dist/fields.js.map +1 -0
- package/dist/fixture.d.ts +3 -3
- package/dist/fixture.js +512 -0
- package/dist/fixture.js.map +1 -0
- package/dist/fog.d.ts +26 -3
- package/dist/fog.js +333 -0
- package/dist/fog.js.map +1 -0
- package/dist/foliage.d.ts +476 -0
- package/dist/foliage.js +1478 -0
- package/dist/foliage.js.map +1 -0
- package/dist/foliageDebug.d.ts +57 -0
- package/dist/foliageDebug.js +172 -0
- package/dist/foliageDebug.js.map +1 -0
- package/dist/foliageRegrowth.d.ts +20 -0
- package/dist/foliageRegrowth.js +332 -0
- package/dist/foliageRegrowth.js.map +1 -0
- package/dist/formState.d.ts +67 -0
- package/dist/formState.js +65 -0
- package/dist/formState.js.map +1 -0
- package/dist/formation.d.ts +46 -8
- package/dist/formation.js +297 -0
- package/dist/formation.js.map +1 -0
- package/dist/forms.d.ts +58 -0
- package/dist/forms.js +146 -0
- package/dist/forms.js.map +1 -0
- package/dist/friendlyFire.d.ts +2 -2
- package/dist/friendlyFire.js +37 -0
- package/dist/friendlyFire.js.map +1 -0
- package/dist/game.d.ts +141 -48
- package/dist/game.js +834 -0
- package/dist/game.js.map +1 -0
- package/dist/gameData.d.ts +96 -22
- package/dist/gameData.js +1690 -0
- package/dist/gameData.js.map +1 -0
- package/dist/gameFiles.d.ts +3 -3
- package/dist/gameFiles.js +14 -0
- package/dist/gameFiles.js.map +1 -0
- package/dist/gates.js +92 -0
- package/dist/gates.js.map +1 -0
- package/dist/generate.d.ts +28 -1
- package/dist/generate.js +1062 -0
- package/dist/generate.js.map +1 -0
- package/dist/generateWorker.d.ts +7 -3
- package/dist/generateWorker.js +86 -0
- package/dist/generateWorker.js.map +1 -0
- package/dist/grid.d.ts +9 -0
- package/dist/grid.js +102 -0
- package/dist/grid.js.map +1 -0
- package/dist/ground.d.ts +17 -1
- package/dist/ground.js +375 -0
- package/dist/ground.js.map +1 -0
- package/dist/groundObjects.d.ts +70 -0
- package/dist/groundObjects.js +371 -0
- package/dist/groundObjects.js.map +1 -0
- package/dist/groundSpeed.d.ts +20 -3
- package/dist/groundSpeed.js +117 -0
- package/dist/groundSpeed.js.map +1 -0
- package/dist/hero.d.ts +126 -10
- package/dist/hero.js +432 -0
- package/dist/hero.js.map +1 -0
- package/dist/holds.d.ts +94 -0
- package/dist/holds.js +305 -0
- package/dist/holds.js.map +1 -0
- package/dist/home.d.ts +1 -1
- package/dist/home.js +30 -0
- package/dist/home.js.map +1 -0
- package/dist/hooks.d.ts +339 -57
- package/dist/hooks.js +105 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hotReload.d.ts +6 -5
- package/dist/hotReload.js +145 -0
- package/dist/hotReload.js.map +1 -0
- package/dist/ids.d.ts +3 -3
- package/dist/ids.js +30 -0
- package/dist/ids.js.map +1 -0
- package/dist/idsFile.d.ts +36 -0
- package/dist/idsFile.js +134 -0
- package/dist/idsFile.js.map +1 -0
- package/dist/index.d.ts +105 -68
- package/dist/index.js +194 -4701
- package/dist/inspect.d.ts +29 -2
- package/dist/{inspect-D9dWHmZ0.js → inspect.js} +21 -12
- package/dist/inspect.js.map +1 -0
- package/dist/inventory.d.ts +14 -1
- package/dist/inventory.js +84 -0
- package/dist/inventory.js.map +1 -0
- package/dist/items.d.ts +136 -8
- package/dist/items.js +585 -0
- package/dist/items.js.map +1 -0
- package/dist/lanes.d.ts +12 -3
- package/dist/lanes.js +496 -0
- package/dist/lanes.js.map +1 -0
- package/dist/life.d.ts +6 -2
- package/dist/life.js +287 -0
- package/dist/life.js.map +1 -0
- package/dist/log.d.ts +26 -3
- package/dist/log.js +192 -0
- package/dist/log.js.map +1 -0
- package/dist/manaBurn.d.ts +2 -2
- package/dist/manaBurn.js +75 -0
- package/dist/manaBurn.js.map +1 -0
- package/dist/map/file.d.ts +56 -3
- package/dist/map/file.js +264 -0
- package/dist/map/file.js.map +1 -0
- package/dist/map/images.js +61 -0
- package/dist/map/images.js.map +1 -0
- package/dist/map/look.d.ts +1 -1
- package/dist/map/look.js +30 -0
- package/dist/map/look.js.map +1 -0
- package/dist/map/pathProfile.js +183 -0
- package/dist/map/pathProfile.js.map +1 -0
- package/dist/map/resize.d.ts +4 -0
- package/dist/map/resize.js +136 -0
- package/dist/map/resize.js.map +1 -0
- package/dist/map/schema.js +257 -0
- package/dist/map/schema.js.map +1 -0
- package/dist/map/terrain.js +214 -0
- package/dist/map/terrain.js.map +1 -0
- package/dist/map/types.d.ts +92 -13
- package/dist/map/types.js +251 -0
- package/dist/map/types.js.map +1 -0
- package/dist/mapCheck/cells.js +94 -0
- package/dist/mapCheck/cells.js.map +1 -0
- package/dist/mapCheck/rules/foliage.d.ts +9 -0
- package/dist/mapCheck/rules/foliage.js +83 -0
- package/dist/mapCheck/rules/foliage.js.map +1 -0
- package/dist/mapCheck/rules/names.js +39 -0
- package/dist/mapCheck/rules/names.js.map +1 -0
- package/dist/mapCheck/rules/objects.d.ts +1 -1
- package/dist/mapCheck/rules/objects.js +56 -0
- package/dist/mapCheck/rules/objects.js.map +1 -0
- package/dist/mapCheck/rules/paths.js +32 -0
- package/dist/mapCheck/rules/paths.js.map +1 -0
- package/dist/mapCheck/rules/players.js +20 -0
- package/dist/mapCheck/rules/players.js.map +1 -0
- package/dist/mapCheck/rules/races.js +56 -0
- package/dist/mapCheck/rules/races.js.map +1 -0
- package/dist/mapCheck/rules/random.js +47 -0
- package/dist/mapCheck/rules/random.js.map +1 -0
- package/dist/mapCheck/rules/regions.js +30 -0
- package/dist/mapCheck/rules/regions.js.map +1 -0
- package/dist/mapCheck/rules/targets.js +31 -0
- package/dist/mapCheck/rules/targets.js.map +1 -0
- package/dist/mapCheck/rules/walking.js +45 -0
- package/dist/mapCheck/rules/walking.js.map +1 -0
- package/dist/mapCheck.d.ts +2 -2
- package/dist/mapCheck.js +63 -0
- package/dist/mapCheck.js.map +1 -0
- package/dist/mapFields.d.ts +25 -2
- package/dist/mapFields.js +134 -0
- package/dist/mapFields.js.map +1 -0
- package/dist/mapFile.js +176 -0
- package/dist/mapFile.js.map +1 -0
- package/dist/mapMeasure.d.ts +8 -0
- package/dist/mapMeasure.js +283 -0
- package/dist/mapMeasure.js.map +1 -0
- package/dist/mapMerge.d.ts +1 -0
- package/dist/mapMerge.js +172 -0
- package/dist/mapMerge.js.map +1 -0
- package/dist/mapObjectives.js +138 -0
- package/dist/mapObjectives.js.map +1 -0
- package/dist/mapObjects.js +80 -0
- package/dist/mapObjects.js.map +1 -0
- package/dist/math.d.ts +37 -7
- package/dist/math.js +155 -0
- package/dist/math.js.map +1 -0
- package/dist/messages.d.ts +71 -4
- package/dist/messages.js +29 -0
- package/dist/messages.js.map +1 -0
- package/dist/missionRules.d.ts +10 -2
- package/dist/{missionRules-C-bGxm0Q.js → missionRules.js} +30 -150
- package/dist/missionRules.js.map +1 -0
- package/dist/mods.d.ts +39 -20
- package/dist/mods.js +271 -0
- package/dist/mods.js.map +1 -0
- package/dist/moves.d.ts +87 -0
- package/dist/moves.js +539 -0
- package/dist/moves.js.map +1 -0
- package/dist/names.d.ts +7 -0
- package/dist/names.js +122 -0
- package/dist/names.js.map +1 -0
- package/dist/navigation/agentParams.js +14 -0
- package/dist/navigation/agentParams.js.map +1 -0
- package/dist/navigation/air.d.ts +7 -3
- package/dist/navigation/air.js +401 -0
- package/dist/navigation/air.js.map +1 -0
- package/dist/navigation/builds.d.ts +34 -2
- package/dist/navigation/builds.js +287 -0
- package/dist/navigation/builds.js.map +1 -0
- package/dist/navigation/groundAreas.d.ts +59 -1
- package/dist/navigation/groundAreas.js +407 -0
- package/dist/navigation/groundAreas.js.map +1 -0
- package/dist/navigation/navigation.d.ts +98 -9
- package/dist/navigation/recast.d.ts +194 -18
- package/dist/navigation/recast.js +1379 -0
- package/dist/navigation/recast.js.map +1 -0
- package/dist/navigation/sidePaths.d.ts +8 -3
- package/dist/navigation/sidePaths.js +241 -0
- package/dist/navigation/sidePaths.js.map +1 -0
- package/dist/navigation/sized.js +243 -0
- package/dist/navigation/sized.js.map +1 -0
- package/dist/nearest.js +32 -0
- package/dist/nearest.js.map +1 -0
- package/dist/noise.js +59 -0
- package/dist/noise.js.map +1 -0
- package/dist/objectives.d.ts +12 -3
- package/dist/objectives.js +144 -0
- package/dist/objectives.js.map +1 -0
- package/dist/orders/basic.d.ts +5 -5
- package/dist/orders/basic.js +417 -0
- package/dist/orders/basic.js.map +1 -0
- package/dist/orders/build.js +278 -0
- package/dist/orders/build.js.map +1 -0
- package/dist/orders/cast.d.ts +13 -3
- package/dist/orders/cast.js +558 -0
- package/dist/orders/cast.js.map +1 -0
- package/dist/orders/facts.js +16 -0
- package/dist/orders/facts.js.map +1 -0
- package/dist/orders/harvest.d.ts +21 -5
- package/dist/orders/harvest.js +540 -0
- package/dist/orders/harvest.js.map +1 -0
- package/dist/orders/idle.d.ts +3 -1
- package/dist/orders/idle.js +234 -0
- package/dist/orders/idle.js.map +1 -0
- package/dist/orders/items.js +92 -0
- package/dist/orders/items.js.map +1 -0
- package/dist/orders/queue.js +108 -0
- package/dist/orders/queue.js.map +1 -0
- package/dist/orders/waiting.d.ts +39 -0
- package/dist/orders/waiting.js +149 -0
- package/dist/orders/waiting.js.map +1 -0
- package/dist/pack.schema.js +13 -0
- package/dist/pack.schema.js.map +1 -0
- package/dist/pack.schema.json +7622 -841
- package/dist/packs/director/index.d.ts +13 -5
- package/dist/packs/director/index.js +204 -0
- package/dist/packs/director/index.js.map +1 -0
- package/dist/packs/heroes/campaign.d.ts +3 -2
- package/dist/packs/heroes/campaign.js +241 -0
- package/dist/packs/heroes/campaign.js.map +1 -0
- package/dist/packs/heroes/carry.d.ts +6 -0
- package/dist/packs/heroes/carry.js +112 -0
- package/dist/packs/heroes/carry.js.map +1 -0
- package/dist/packs/heroes/commands.js +115 -0
- package/dist/packs/heroes/commands.js.map +1 -0
- package/dist/packs/heroes/fallen.d.ts +43 -0
- package/dist/packs/heroes/fallen.js +61 -0
- package/dist/packs/heroes/fallen.js.map +1 -0
- package/dist/packs/heroes/hire.js +60 -0
- package/dist/packs/heroes/hire.js.map +1 -0
- package/dist/packs/heroes/index.d.ts +7 -6
- package/dist/packs/heroes/index.js +130 -0
- package/dist/packs/heroes/index.js.map +1 -0
- package/dist/packs/heroes/loop.d.ts +95 -0
- package/dist/packs/heroes/loop.js +250 -0
- package/dist/packs/heroes/loop.js.map +1 -0
- package/dist/packs/heroes/making.d.ts +6 -3
- package/dist/packs/heroes/making.js +55 -0
- package/dist/packs/heroes/making.js.map +1 -0
- package/dist/packs/heroes/respawn.d.ts +3 -3
- package/dist/packs/heroes/respawn.js +87 -0
- package/dist/packs/heroes/respawn.js.map +1 -0
- package/dist/packs/heroes/sets.d.ts +32 -0
- package/dist/packs/heroes/sets.js +51 -0
- package/dist/packs/heroes/sets.js.map +1 -0
- package/dist/packs/heroes/spells.d.ts +16 -0
- package/dist/packs/heroes/spells.js +269 -0
- package/dist/packs/heroes/spells.js.map +1 -0
- package/dist/packs/items/defaults.d.ts +43 -0
- package/dist/packs/items/defaults.js +1504 -0
- package/dist/packs/items/defaults.js.map +1 -0
- package/dist/packs/items/index.d.ts +27 -0
- package/dist/packs/items/index.js +214 -0
- package/dist/packs/items/index.js.map +1 -0
- package/dist/packs/moba/index.d.ts +3 -3
- package/dist/packs/moba/index.js +174 -0
- package/dist/packs/moba/index.js.map +1 -0
- package/dist/packs/pack.d.ts +15 -15
- package/dist/packs/pack.js +14 -0
- package/dist/packs/pack.js.map +1 -0
- package/dist/packs.d.ts +15 -7
- package/dist/packs.js +222 -0
- package/dist/packs.js.map +1 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.js +109 -0
- package/dist/paths.js.map +1 -0
- package/dist/plain.js +57 -0
- package/dist/plain.js.map +1 -0
- package/dist/player.d.ts +33 -10
- package/dist/player.js +159 -0
- package/dist/player.js.map +1 -0
- package/dist/portals.d.ts +1 -1
- package/dist/portals.js +194 -0
- package/dist/portals.js.map +1 -0
- package/dist/prefabs.d.ts +25 -2
- package/dist/prefabs.js +239 -0
- package/dist/prefabs.js.map +1 -0
- package/dist/presetBuildings.js +58 -0
- package/dist/presetBuildings.js.map +1 -0
- package/dist/presetFoliage.d.ts +27 -0
- package/dist/presetFoliage.js +98 -0
- package/dist/presetFoliage.js.map +1 -0
- package/dist/presetGround.js +65 -0
- package/dist/presetGround.js.map +1 -0
- package/dist/proxies.d.ts +12 -0
- package/dist/proxies.js +79 -0
- package/dist/proxies.js.map +1 -0
- package/dist/query.d.ts +56 -0
- package/dist/query.js +88 -0
- package/dist/query.js.map +1 -0
- package/dist/races.d.ts +15 -14
- package/dist/races.js +172 -0
- package/dist/races.js.map +1 -0
- package/dist/randomGroups.js +91 -0
- package/dist/randomGroups.js.map +1 -0
- package/dist/registry.d.ts +117 -53
- package/dist/registry.js +323 -0
- package/dist/registry.js.map +1 -0
- package/dist/remains.d.ts +11 -9
- package/dist/remains.js +188 -0
- package/dist/remains.js.map +1 -0
- package/dist/replication.d.ts +12 -7
- package/dist/replication.js +100 -0
- package/dist/replication.js.map +1 -0
- package/dist/rng.d.ts +2 -0
- package/dist/rng.js +40 -0
- package/dist/rng.js.map +1 -0
- package/dist/rules.d.ts +186 -99
- package/dist/rules.js +179 -0
- package/dist/rules.js.map +1 -0
- package/dist/rulesCheck.d.ts +5 -4
- package/dist/rulesCheck.js +693 -0
- package/dist/rulesCheck.js.map +1 -0
- package/dist/runes.d.ts +2 -2
- package/dist/runes.js +80 -0
- package/dist/runes.js.map +1 -0
- package/dist/save.d.ts +37 -12
- package/dist/save.js +532 -0
- package/dist/save.js.map +1 -0
- package/dist/scenario.d.ts +2 -2
- package/dist/scenario.js +99 -0
- package/dist/scenario.js.map +1 -0
- package/dist/scheduler.d.ts +3 -0
- package/dist/scheduler.js +156 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/score.d.ts +19 -19
- package/dist/score.js +709 -0
- package/dist/score.js.map +1 -0
- package/dist/sequences.d.ts +10 -6
- package/dist/sequences.js +206 -0
- package/dist/sequences.js.map +1 -0
- package/dist/server/doorman.js +154 -0
- package/dist/server/doorman.js.map +1 -0
- package/dist/server/gameServer.d.ts +16 -1
- package/dist/server/gameServer.js +643 -0
- package/dist/server/gameServer.js.map +1 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/lobby.js +199 -0
- package/dist/server/lobby.js.map +1 -0
- package/dist/server/log.js +18 -0
- package/dist/server/log.js.map +1 -0
- package/dist/server/match.js +267 -0
- package/dist/server/match.js.map +1 -0
- package/dist/server/mode.d.ts +18 -9
- package/dist/server/mode.js +220 -0
- package/dist/server/mode.js.map +1 -0
- package/dist/{navigation-worker.js → server/navigation-worker.js} +1 -1
- package/dist/server/navigation-worker.js.map +1 -0
- package/dist/server/navigation.js +39 -0
- package/dist/server/navigation.js.map +1 -0
- package/dist/server/ops.d.ts +4 -0
- package/dist/server/ops.js +137 -0
- package/dist/server/ops.js.map +1 -0
- package/dist/server/packs.d.ts +3 -3
- package/dist/server/packs.js +32 -0
- package/dist/server/packs.js.map +1 -0
- package/dist/server/ratings.d.ts +5 -0
- package/dist/server/ratings.js +104 -0
- package/dist/server/ratings.js.map +1 -0
- package/dist/server/relay.d.ts +12 -2
- package/dist/server/relay.js +144 -0
- package/dist/server/relay.js.map +1 -0
- package/dist/server/rooms.d.ts +9 -2
- package/dist/server/rooms.js +442 -0
- package/dist/server/rooms.js.map +1 -0
- package/dist/server/seat.js +116 -0
- package/dist/server/seat.js.map +1 -0
- package/dist/server/seatSettings.d.ts +3 -3
- package/dist/server/seatSettings.js +63 -0
- package/dist/server/seatSettings.js.map +1 -0
- package/dist/server/secret.js +13 -0
- package/dist/server/secret.js.map +1 -0
- package/dist/server/start.d.ts +13 -6
- package/dist/server/start.js +76 -0
- package/dist/server/start.js.map +1 -0
- package/dist/server/websocket.d.ts +9 -1
- package/dist/server/websocket.js +306 -0
- package/dist/server/websocket.js.map +1 -0
- package/dist/server.js +15 -2861
- package/dist/session/can.js +26 -0
- package/dist/session/can.js.map +1 -0
- package/dist/session/commandReplay.d.ts +8 -2
- package/dist/session/commandReplay.js +293 -0
- package/dist/session/commandReplay.js.map +1 -0
- package/dist/session/debug.js +151 -0
- package/dist/session/debug.js.map +1 -0
- package/dist/session/delay.js +62 -0
- package/dist/session/delay.js.map +1 -0
- package/dist/session/delta.d.ts +14 -1
- package/dist/session/delta.js +407 -0
- package/dist/session/delta.js.map +1 -0
- package/dist/session/entityState.js +415 -0
- package/dist/session/entityState.js.map +1 -0
- package/dist/session/local.d.ts +47 -5
- package/dist/session/local.js +670 -0
- package/dist/session/local.js.map +1 -0
- package/dist/session/memory.d.ts +20 -2
- package/dist/session/memory.js +131 -0
- package/dist/session/memory.js.map +1 -0
- package/dist/session/protocol.d.ts +325 -31
- package/dist/session/protocol.js +55 -0
- package/dist/session/protocol.js.map +1 -0
- package/dist/session/remote.d.ts +74 -12
- package/dist/session/remote.js +1394 -0
- package/dist/session/remote.js.map +1 -0
- package/dist/session/replay.d.ts +11 -2
- package/dist/session/replay.js +160 -0
- package/dist/session/replay.js.map +1 -0
- package/dist/session/seed.js +12 -0
- package/dist/session/seed.js.map +1 -0
- package/dist/session/share.d.ts +5 -1
- package/dist/session/share.js +94 -0
- package/dist/session/share.js.map +1 -0
- package/dist/session/socket.d.ts +1 -1
- package/dist/session/socket.js +29 -0
- package/dist/session/socket.js.map +1 -0
- package/dist/session/wire.d.ts +5 -0
- package/dist/session/wire.js +84 -0
- package/dist/session/wire.js.map +1 -0
- package/dist/session/worker.d.ts +77 -12
- package/dist/session/worker.js +499 -0
- package/dist/session/worker.js.map +1 -0
- package/dist/shared.d.ts +31 -5
- package/dist/shared.js +166 -0
- package/dist/shared.js.map +1 -0
- package/dist/sides.d.ts +9 -3
- package/dist/sides.js +149 -0
- package/dist/sides.js.map +1 -0
- package/dist/sight.js +85 -0
- package/dist/sight.js.map +1 -0
- package/dist/simulate-worker.js +1 -1
- package/dist/simulate.d.ts +12 -8
- package/dist/{simulate-oXBiw1Ff.js → simulate.js} +10 -11
- package/dist/simulate.js.map +1 -0
- package/dist/smart.js +77 -0
- package/dist/smart.js.map +1 -0
- package/dist/spatial.d.ts +32 -16
- package/dist/spatial.js +234 -0
- package/dist/spatial.js.map +1 -0
- package/dist/spawning.d.ts +1 -0
- package/dist/spawning.js +224 -0
- package/dist/spawning.js.map +1 -0
- package/dist/stances.d.ts +6 -3
- package/dist/stances.js +169 -0
- package/dist/stances.js.map +1 -0
- package/dist/start.d.ts +10 -10
- package/dist/start.js +75 -0
- package/dist/start.js.map +1 -0
- package/dist/stats.d.ts +42 -16
- package/dist/stats.js +290 -0
- package/dist/stats.js.map +1 -0
- package/dist/summoned.d.ts +52 -0
- package/dist/summoned.js +38 -0
- package/dist/summoned.js.map +1 -0
- package/dist/summons.d.ts +10 -13
- package/dist/summons.js +271 -0
- package/dist/summons.js.map +1 -0
- package/dist/systems/abilities.js +224 -0
- package/dist/systems/abilities.js.map +1 -0
- package/dist/systems/combat.d.ts +35 -1
- package/dist/systems/combat.js +677 -0
- package/dist/systems/combat.js.map +1 -0
- package/dist/systems/combatTold.d.ts +3 -1
- package/dist/systems/combatTold.js +85 -0
- package/dist/systems/combatTold.js.map +1 -0
- package/dist/systems/construction.js +80 -0
- package/dist/systems/construction.js.map +1 -0
- package/dist/systems/economy.d.ts +0 -6
- package/dist/systems/economy.js +128 -0
- package/dist/systems/economy.js.map +1 -0
- package/dist/systems/fog.d.ts +1 -1
- package/dist/systems/fog.js +120 -0
- package/dist/systems/fog.js.map +1 -0
- package/dist/systems/life.js +32 -0
- package/dist/systems/life.js.map +1 -0
- package/dist/systems/movement.d.ts +24 -12
- package/dist/systems/movement.js +1247 -0
- package/dist/systems/movement.js.map +1 -0
- package/dist/systems/orders.js +64 -0
- package/dist/systems/orders.js.map +1 -0
- package/dist/systems/production.js +322 -0
- package/dist/systems/production.js.map +1 -0
- package/dist/systems/productionQueue.js +120 -0
- package/dist/systems/productionQueue.js.map +1 -0
- package/dist/systems/victory.d.ts +1 -1
- package/dist/systems/victory.js +56 -0
- package/dist/systems/victory.js.map +1 -0
- package/dist/talk.d.ts +6 -6
- package/dist/talk.js +153 -0
- package/dist/talk.js.map +1 -0
- package/dist/targeting.d.ts +142 -0
- package/dist/targeting.js +49 -0
- package/dist/targeting.js.map +1 -0
- package/dist/tech.d.ts +20 -3
- package/dist/tech.js +239 -0
- package/dist/tech.js.map +1 -0
- package/dist/techTree.d.ts +7 -0
- package/dist/techTree.js +90 -0
- package/dist/techTree.js.map +1 -0
- package/dist/terrain.d.ts +59 -7
- package/dist/terrain.js +389 -0
- package/dist/terrain.js.map +1 -0
- package/dist/terrainSave.d.ts +6 -0
- package/dist/terrainSave.js +74 -0
- package/dist/terrainSave.js.map +1 -0
- package/dist/testing.d.ts +8 -7
- package/dist/testing.js +13 -739
- package/dist/testing.js.map +1 -1
- package/dist/tiles.d.ts +1 -1
- package/dist/tiles.js +43 -0
- package/dist/tiles.js.map +1 -0
- package/dist/timers.d.ts +29 -4
- package/dist/timers.js +242 -0
- package/dist/timers.js.map +1 -0
- package/dist/tomes.d.ts +4 -4
- package/dist/tomes.js +94 -0
- package/dist/tomes.js.map +1 -0
- package/dist/trade.js +103 -0
- package/dist/trade.js.map +1 -0
- package/dist/transport.d.ts +6 -1
- package/dist/transport.js +281 -0
- package/dist/transport.js.map +1 -0
- package/dist/tunables.d.ts +10 -3
- package/dist/tunables.js +56 -0
- package/dist/tunables.js.map +1 -0
- package/dist/unitResources.d.ts +67 -0
- package/dist/unitResources.js +266 -0
- package/dist/unitResources.js.map +1 -0
- package/dist/upkeep.d.ts +6 -1
- package/dist/upkeep.js +26 -0
- package/dist/upkeep.js.map +1 -0
- package/dist/veterancy.d.ts +8 -3
- package/dist/veterancy.js +131 -0
- package/dist/veterancy.js.map +1 -0
- package/dist/vision.d.ts +36 -0
- package/dist/vision.js +133 -0
- package/dist/vision.js.map +1 -0
- package/dist/walls.d.ts +1 -1
- package/dist/walls.js +278 -0
- package/dist/walls.js.map +1 -0
- package/dist/world.d.ts +606 -88
- package/dist/world.js +1263 -0
- package/dist/world.js.map +1 -0
- package/package.json +2 -2
- package/dist/ai.js.map +0 -1
- package/dist/attributes.d.ts +0 -66
- package/dist/brain-BvVdUhX8.js +0 -7659
- package/dist/brain-BvVdUhX8.js.map +0 -1
- package/dist/builds-C6LfgvEU.js +0 -460
- package/dist/builds-C6LfgvEU.js.map +0 -1
- package/dist/coreComponents-syuh2fPG.js +0 -5149
- package/dist/coreComponents-syuh2fPG.js.map +0 -1
- package/dist/debugCommands-CzjrSm66.js +0 -14739
- package/dist/debugCommands-CzjrSm66.js.map +0 -1
- package/dist/determinism-BCymQwiE.js +0 -518
- package/dist/determinism-BCymQwiE.js.map +0 -1
- package/dist/game-DiJEN-Ks.js +0 -5800
- package/dist/game-DiJEN-Ks.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/inspect-D9dWHmZ0.js.map +0 -1
- package/dist/local-Dkovq42k.js +0 -1379
- package/dist/local-Dkovq42k.js.map +0 -1
- package/dist/missionRules-C-bGxm0Q.js.map +0 -1
- package/dist/navigation-worker.js.map +0 -1
- package/dist/packs-g5thvmGn.js +0 -3199
- package/dist/packs-g5thvmGn.js.map +0 -1
- package/dist/profiles-B3NS9jwk.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/simulate-oXBiw1Ff.js.map +0 -1
package/dist/ai/computer.d.ts
CHANGED
|
@@ -11,14 +11,17 @@ import { type AiSettings } from './settings';
|
|
|
11
11
|
/**
|
|
12
12
|
* A computer player: whatever plays a seat of a world from what it sees, through commands as a player does. The
|
|
13
13
|
* engine's own is a `Brain` of modules (`defineBrain`), the melee player among them; a game gives its own in code
|
|
14
|
-
* (`defineComputer`, listed in `
|
|
14
|
+
* (`defineComputer`, listed in `Rules.brains`). `think` is asked about once a second (`createComputerSystem`); `save` and `restore` keep what
|
|
15
15
|
* it remembers through a save
|
|
16
16
|
*
|
|
17
17
|
* @beta
|
|
18
18
|
*/
|
|
19
19
|
export interface ComputerPlayer {
|
|
20
|
+
/** Runs one think: looks at the world and sends commands as a player does */
|
|
20
21
|
think(): void;
|
|
22
|
+
/** Gives what it remembers as plain data for a save; when left out it remembers nothing */
|
|
21
23
|
save?(): unknown;
|
|
24
|
+
/** Takes back what `save` gave, from a saved game */
|
|
22
25
|
restore?(memory: unknown): void;
|
|
23
26
|
/** What it is thinking, as plain data: what the debug tools show of the player it plays (its goal, its scores) */
|
|
24
27
|
inspect?(): unknown;
|
|
@@ -64,6 +67,7 @@ export interface ComputerTiming {
|
|
|
64
67
|
* @beta
|
|
65
68
|
*/
|
|
66
69
|
export interface ComputerSystem<C extends ComputerPlayer = ComputerPlayer> extends System {
|
|
70
|
+
/** The computer player this system runs */
|
|
67
71
|
readonly computer: C;
|
|
68
72
|
/** The player it plays */
|
|
69
73
|
readonly player: PlayerId;
|
|
@@ -137,7 +141,7 @@ export declare const aiTeams: import("#engine/components").Component<Record<stri
|
|
|
137
141
|
export declare function createBrainSystem(world: World, playerId: PlayerId, brain: BrainDef, options?: AiOptions): ComputerSystem<Brain>;
|
|
138
142
|
/**
|
|
139
143
|
* A computer player of the game's own that is not made of modules (a `ComputerPlayer`: anything that thinks), as a brain
|
|
140
|
-
* the game lists (`
|
|
144
|
+
* the game lists (`Rules.brains`) and seats as it does any (`world.computers.seat(player, { brain })`): found again
|
|
141
145
|
* by its id when a save is loaded. `make` is handed the seat's session, its context and what it was seated with, the
|
|
142
146
|
* map's under the seat's; it thinks as often as those say (`every`, 1 second when left out)
|
|
143
147
|
*
|
|
@@ -153,13 +157,16 @@ export declare function defineComputer<C extends ComputerPlayer>(id: string, mak
|
|
|
153
157
|
* @beta
|
|
154
158
|
*/
|
|
155
159
|
export interface MapAi {
|
|
156
|
-
/** The brain the player is seated with, by id (`
|
|
160
|
+
/** The brain the player is seated with, by id (`Rules.brains`): over its race's (`GameAi.races`), under the seat's */
|
|
157
161
|
brain?: string;
|
|
162
|
+
/** The id of the difficulty the computer plays at, which a game's brain reads from its settings */
|
|
158
163
|
difficulty?: string;
|
|
164
|
+
/** The id of the personality the computer plays with, which a game's brain reads from its settings */
|
|
159
165
|
personality?: string;
|
|
166
|
+
/** Settings for the brain, over the ones its difficulty and personality give */
|
|
160
167
|
settings?: AiSettings;
|
|
161
168
|
/**
|
|
162
|
-
* Settings by the race the player plays (`
|
|
169
|
+
* Settings by the race the player plays (`Rules.races`), over `settings`: for a player whose race the lobby
|
|
163
170
|
* chooses or draws (`random`), a build order or waves for each
|
|
164
171
|
*/
|
|
165
172
|
races?: Record<string, AiSettings>;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { defineComponent } from "../components.js";
|
|
2
|
+
import { invalidateStats } from "../stats.js";
|
|
3
|
+
import { listKitComponents } from "../coreComponents.js";
|
|
4
|
+
import { MISSION_RULES } from "../missionRules.js";
|
|
5
|
+
import { LocalSession } from "../session/local.js";
|
|
6
|
+
import { evaluate } from "./rules.js";
|
|
7
|
+
import { resolveSettings } from "./settings.js";
|
|
8
|
+
import { resolveProfile } from "./profiles.js";
|
|
9
|
+
import { Brain, createBrain } from "./brain.js";
|
|
10
|
+
import { emptyTeam } from "./team.js";
|
|
11
|
+
//#region src/ai/computer.ts
|
|
12
|
+
/**
|
|
13
|
+
* The hooks a profile's handicap (`AiProfile.handicap`) is given to the world by, for one player: what its workers bring
|
|
14
|
+
* in (`beforeDeposit`), the health of what it has (`stats`), the damage it deals (`beforeDamage`), how long what it
|
|
15
|
+
* makes takes (`beforeProduce`). None for a handicap of 1, or none given. Ids `core.ai.handicap.<player>` and
|
|
16
|
+
* `core.ai.handicap.<what>.<player>`
|
|
17
|
+
*/
|
|
18
|
+
function handicapHooks(player, handicap) {
|
|
19
|
+
const hooks = [];
|
|
20
|
+
const { income, health, damage, buildTime } = handicap ?? {};
|
|
21
|
+
if (income !== void 0 && income !== 1) hooks.push({
|
|
22
|
+
id: `core.ai.handicap.${player}`,
|
|
23
|
+
hook: "beforeDeposit",
|
|
24
|
+
run: (_world, event) => {
|
|
25
|
+
if (event.player === player) event.amount = Math.round(event.amount * income);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
if (health !== void 0 && health !== 1) hooks.push({
|
|
29
|
+
id: `core.ai.handicap.health.${player}`,
|
|
30
|
+
hook: "stats",
|
|
31
|
+
run: (_world, event) => {
|
|
32
|
+
if (event.entity.owner === player) event.add({ percent: { health: health - 1 } });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
if (damage !== void 0 && damage !== 1) hooks.push({
|
|
36
|
+
id: `core.ai.handicap.damage.${player}`,
|
|
37
|
+
hook: "beforeDamage",
|
|
38
|
+
run: (_world, event) => {
|
|
39
|
+
if (event.source?.owner === player) event.amount *= damage;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
if (buildTime !== void 0 && buildTime !== 1) hooks.push({
|
|
43
|
+
id: `core.ai.handicap.buildTime.${player}`,
|
|
44
|
+
hook: "beforeProduce",
|
|
45
|
+
run: (_world, event) => {
|
|
46
|
+
if (event.player === player) event.time *= buildTime;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return hooks;
|
|
50
|
+
}
|
|
51
|
+
/** How much of each new think goes into the averaged time of a seat. Small: the panel shows a steady number */
|
|
52
|
+
var SMOOTHING = .1;
|
|
53
|
+
/** What a computer player's own numbers start from: the world's seed and the player, mixed so that two seats of one game draw differently */
|
|
54
|
+
var seedOf = (seed, player) => Math.imul((seed ^ 2654435769) >>> 0, 1664525) + player * 1013904223 >>> 0;
|
|
55
|
+
/**
|
|
56
|
+
* Seats a computer player at a world: made of a session of its own (it sees what that player sees, and plays through
|
|
57
|
+
* commands, so it cannot cheat), asked to think about once a second. `make` is handed the session and what a brain
|
|
58
|
+
* takes besides (`BrainContext`: a seed of its own, the budget, whether the world profiles). Add the result to the
|
|
59
|
+
* world (`world.addSystem`), or seat through `world.computers.seat`, which remembers it for a save
|
|
60
|
+
*
|
|
61
|
+
* @beta
|
|
62
|
+
*/
|
|
63
|
+
function createComputerSystem(world, playerId, make, options = {}) {
|
|
64
|
+
const session = new LocalSession(world, playerId, {
|
|
65
|
+
observer: !!options.observer || options.profile?.vision === "all",
|
|
66
|
+
forComputer: options.snapshot === "lean"
|
|
67
|
+
});
|
|
68
|
+
const handicaps = handicapHooks(playerId, options.profile?.handicap);
|
|
69
|
+
for (const hook of handicaps) world.hooks.add(hook);
|
|
70
|
+
if (handicaps.some((hook) => hook.hook === "stats")) invalidateStats(world);
|
|
71
|
+
const team = () => {
|
|
72
|
+
const boards = world.state(aiTeams);
|
|
73
|
+
const id = String(world.players.get(playerId)?.team ?? playerId);
|
|
74
|
+
return boards[id] ??= emptyTeam();
|
|
75
|
+
};
|
|
76
|
+
const computer = make(session, {
|
|
77
|
+
seed: seedOf(world.seed, playerId),
|
|
78
|
+
budget: options.budget,
|
|
79
|
+
profiling: () => world.scheduler.profiling,
|
|
80
|
+
team,
|
|
81
|
+
checks: world.checks.ai
|
|
82
|
+
});
|
|
83
|
+
const interval = Math.max(1, Math.round((options.every ?? 1) * world.tickRate));
|
|
84
|
+
const offset = options.offset ?? playerId * 7;
|
|
85
|
+
const timing = {
|
|
86
|
+
last: 0,
|
|
87
|
+
average: 0,
|
|
88
|
+
longest: 0
|
|
89
|
+
};
|
|
90
|
+
/** Milliseconds of the think under way, across its ticks */
|
|
91
|
+
let spent = 0;
|
|
92
|
+
return {
|
|
93
|
+
name: `ai-${playerId}`,
|
|
94
|
+
computer,
|
|
95
|
+
player: playerId,
|
|
96
|
+
session,
|
|
97
|
+
update() {
|
|
98
|
+
if (computer.paused) return;
|
|
99
|
+
if ((world.tick + offset) % interval !== 0 && !computer.busy) return;
|
|
100
|
+
const start = performance.now();
|
|
101
|
+
computer.think();
|
|
102
|
+
spent += performance.now() - start;
|
|
103
|
+
if (computer.busy) return;
|
|
104
|
+
timing.last = spent;
|
|
105
|
+
timing.average = timing.average === 0 ? spent : timing.average + (spent - timing.average) * SMOOTHING;
|
|
106
|
+
if (spent > timing.longest) timing.longest = spent;
|
|
107
|
+
spent = 0;
|
|
108
|
+
},
|
|
109
|
+
timing() {
|
|
110
|
+
const brain = computer instanceof Brain ? computer : void 0;
|
|
111
|
+
if (!brain) return { ...timing };
|
|
112
|
+
const modules = Object.keys(brain.moduleTiming).length ? { ...brain.moduleTiming } : void 0;
|
|
113
|
+
const longestByModule = Object.keys(brain.moduleLongest).length ? { ...brain.moduleLongest } : void 0;
|
|
114
|
+
const { snapshotTiming: snapshot, viewTiming: view, knowledgeTiming: knowledge } = brain;
|
|
115
|
+
return {
|
|
116
|
+
...timing,
|
|
117
|
+
...brain.thinkTicks > 0 && { ticks: brain.thinkTicks },
|
|
118
|
+
...modules && { modules },
|
|
119
|
+
...longestByModule && { longestByModule },
|
|
120
|
+
...snapshot !== void 0 && { snapshot },
|
|
121
|
+
...view !== void 0 && { view },
|
|
122
|
+
...knowledge !== void 0 && { knowledge }
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
dispose() {
|
|
126
|
+
computer.dispose?.();
|
|
127
|
+
session.dispose();
|
|
128
|
+
for (const hook of handicaps) world.hooks.remove(hook.hook, hook.id);
|
|
129
|
+
if (handicaps.some((hook) => hook.hook === "stats")) invalidateStats(world);
|
|
130
|
+
options.onDispose?.();
|
|
131
|
+
},
|
|
132
|
+
save: () => {
|
|
133
|
+
const memory = computer.save?.();
|
|
134
|
+
return {
|
|
135
|
+
sent: session.lastSeq,
|
|
136
|
+
...memory !== void 0 && { memory }
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
restore: (_world, data) => {
|
|
140
|
+
const { sent, memory } = data;
|
|
141
|
+
session.lastSeq = sent;
|
|
142
|
+
if (memory !== void 0) computer.restore?.(memory);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The boards of the teams' computers (`TeamBoard`, AI plan C5), by team: in the world, so that a save keeps the
|
|
148
|
+
* requests and the plan of an attack together, and never replicated, so that no player gets it in a snapshot
|
|
149
|
+
*
|
|
150
|
+
* @beta
|
|
151
|
+
*/
|
|
152
|
+
var aiTeams = defineComponent({
|
|
153
|
+
id: "core.ai.teams",
|
|
154
|
+
default: () => ({})
|
|
155
|
+
});
|
|
156
|
+
listKitComponents(aiTeams);
|
|
157
|
+
/**
|
|
158
|
+
* Seats a brain at a world as one of its players, asked to think as its definition or the options say (`every`), with
|
|
159
|
+
* the budget the options give. Add the result to the world, or go through `world.computers.seat`
|
|
160
|
+
*
|
|
161
|
+
* @beta
|
|
162
|
+
*/
|
|
163
|
+
function createBrainSystem(world, playerId, brain, options = {}) {
|
|
164
|
+
const { profile } = resolveProfile(options, world.registry, void 0, world.players.get(playerId)?.race);
|
|
165
|
+
return createComputerSystem(world, playerId, (session, context) => createBrain(brain, session, options, context), {
|
|
166
|
+
every: options.every ?? (typeof brain.every === "function" ? brain.every(options) : brain.every) ?? profile.every ?? 1,
|
|
167
|
+
budget: profile.budget,
|
|
168
|
+
profile,
|
|
169
|
+
snapshot: brain.snapshot ?? "lean"
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* A computer player of the game's own that is not made of modules (a `ComputerPlayer`: anything that thinks), as a brain
|
|
174
|
+
* the game lists (`Rules.brains`) and seats as it does any (`world.computers.seat(player, { brain })`): found again
|
|
175
|
+
* by its id when a save is loaded. `make` is handed the seat's session, its context and what it was seated with, the
|
|
176
|
+
* map's under the seat's; it thinks as often as those say (`every`, 1 second when left out)
|
|
177
|
+
*
|
|
178
|
+
* @beta
|
|
179
|
+
*/
|
|
180
|
+
function defineComputer(id, make) {
|
|
181
|
+
return {
|
|
182
|
+
id,
|
|
183
|
+
modules: [],
|
|
184
|
+
seat: (world, player, given) => {
|
|
185
|
+
const options = mapAiOptions(world, player, given);
|
|
186
|
+
return createComputerSystem(world, player, (session, context) => make(session, context, options), {
|
|
187
|
+
every: options.every,
|
|
188
|
+
budget: options.budget,
|
|
189
|
+
profile: resolveProfile(options, world.registry, void 0, world.players.get(player)?.race).profile
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The seat's options with what the map says of the player under them (`MapPlayer.data.ai`), where the map gives the player
|
|
196
|
+
* to the computer: the lobby's and the scene's say goes over the map's (decision 10), its settings layered over the map's
|
|
197
|
+
* (the map's for the race the player plays over the rest of the map's)
|
|
198
|
+
*
|
|
199
|
+
* @internal
|
|
200
|
+
*/
|
|
201
|
+
function mapAiOptions(world, playerId, options) {
|
|
202
|
+
const player = world.map.player(playerId);
|
|
203
|
+
const map = player?.controller === "computer" ? player.data?.ai : void 0;
|
|
204
|
+
if (!map || typeof map !== "object") return options;
|
|
205
|
+
const race = world.players.get(playerId)?.race;
|
|
206
|
+
const raced = race !== void 0 ? map.races?.[race] : void 0;
|
|
207
|
+
return {
|
|
208
|
+
...map.difficulty !== void 0 && { difficulty: map.difficulty },
|
|
209
|
+
...map.personality !== void 0 && { personality: map.personality },
|
|
210
|
+
...options,
|
|
211
|
+
...(map.settings || raced || options.settings) && { settings: resolveSettings([
|
|
212
|
+
map.settings,
|
|
213
|
+
raced,
|
|
214
|
+
options.settings
|
|
215
|
+
]) }
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/** A seed of a watcher's own numbers: the world's, mixed with the player's */
|
|
219
|
+
var watcherSeedOf = (seed, player) => Math.imul((seed ^ 2135587861) >>> 0, 1664525) + player * 1013904223 >>> 0;
|
|
220
|
+
/** The watcher's brain: nothing of its own, the kit's reading of the picture alone */
|
|
221
|
+
var WATCHER = {
|
|
222
|
+
id: MISSION_RULES,
|
|
223
|
+
modules: []
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Seats a watcher for the mission rules (`missionRules`, campaign plan MS1): a brain with no modules of its own, at a
|
|
227
|
+
* player, on an observer's session (it sees the whole map; `mine` and `enemy` are that player's), which reads the
|
|
228
|
+
* picture as a brain does when asked to (`think`) and answers a rule's condition (`ask`: the kit's `evaluate`). Its
|
|
229
|
+
* numbers are seeded from the world's and the player's, and its memory is the rules' to save
|
|
230
|
+
*
|
|
231
|
+
* @internal
|
|
232
|
+
*/
|
|
233
|
+
function ruleWatcher(world, player) {
|
|
234
|
+
const session = new LocalSession(world, player, {
|
|
235
|
+
observer: true,
|
|
236
|
+
forComputer: true
|
|
237
|
+
});
|
|
238
|
+
const brain = createBrain(WATCHER, session, {}, { seed: watcherSeedOf(world.seed, player) });
|
|
239
|
+
return {
|
|
240
|
+
think: () => brain.think(),
|
|
241
|
+
ask: (condition) => evaluate(condition, brain),
|
|
242
|
+
tell: (word, data, tick) => brain.tell(word, data, tick),
|
|
243
|
+
takeTold: (word) => void brain.takeTold(word),
|
|
244
|
+
save: () => brain.save(),
|
|
245
|
+
restore: (memory) => brain.restore(memory)
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
export { aiTeams, createBrainSystem, createComputerSystem, defineComputer, mapAiOptions, ruleWatcher };
|
|
250
|
+
|
|
251
|
+
//# sourceMappingURL=computer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computer.js","names":[],"sources":["../../src/ai/computer.ts"],"sourcesContent":["import { defineComponent } from '#engine/components'\nimport { listKitComponents } from '#engine/coreComponents'\nimport type { PlayerId } from '#engine/entity'\nimport type { System } from '#engine/registry'\nimport { LocalSession } from '#engine/session/local'\nimport { invalidateStats } from '#engine/stats'\nimport type { HookDef } from '#engine/hooks'\nimport type { World } from '#engine/world'\nimport { MISSION_RULES, type RulesWatcher } from '#engine/missionRules'\nimport { evaluate } from './rules'\nimport type { AiOptions } from './options'\nimport { Brain, type BrainContext, type BrainDef, createBrain } from './brain'\nimport type { ThinkBudgetOptions } from './budget'\nimport { emptyTeam, type TeamBoard } from './team'\nimport { type AiProfile, resolveProfile } from './profiles'\nimport { type AiSettings, resolveSettings } from './settings'\n\n/*\n * The seat of a computer player (AI plan, A1): the one place the kit touches the world. A computer player is a player:\n * it gets a session of its own at the world (`LocalSession`: what that player sees, under their fog, and nothing else)\n * and plays by sending commands through it, as a mouse does. `createComputerSystem` makes the system that asks it to\n * think once in a while, each seat at another tick, so that twelve computers do not all think at once; it also times\n * the thinks, for the report. `world.computers` is who is seated: it keeps each seat in the world (`core.computers`,\n * kept in a save, so that a loaded game has its computers back by itself), and is how the game reaches a seated brain\n * (`tell`, `pause`, `get`). A seat with no brain named gets the first brain the game lists (`Rules.brains`). It names no brain of its own: the engine's (`meleeBrain`) are\n * `@v12-engine/engine/ai`'s, and a game that does not list one carries none of them. Nothing else in `ai/` imports the\n * world (a test asserts it): a brain that had the world could see through the fog\n */\n\n/**\n * A computer player: whatever plays a seat of a world from what it sees, through commands as a player does. The\n * engine's own is a `Brain` of modules (`defineBrain`), the melee player among them; a game gives its own in code\n * (`defineComputer`, listed in `Rules.brains`). `think` is asked about once a second (`createComputerSystem`); `save` and `restore` keep what\n * it remembers through a save\n *\n * @beta\n */\nexport interface ComputerPlayer {\n\t/** Runs one think: looks at the world and sends commands as a player does */\n\tthink(): void\n\t/** Gives what it remembers as plain data for a save; when left out it remembers nothing */\n\tsave?(): unknown\n\t/** Takes back what `save` gave, from a saved game */\n\trestore?(memory: unknown): void\n\t/** What it is thinking, as plain data: what the debug tools show of the player it plays (its goal, its scores) */\n\tinspect?(): unknown\n\t/** Whether a think is under way across ticks (a brain's budget): it is asked to think on at the next tick */\n\treadonly busy?: boolean\n\t/** Whether it sits still (`world.computers.pause`). A player without the field cannot be paused */\n\tpaused?: boolean\n\t/** Takes in a word from the game (`world.computers.tell`), with the tick it is told at */\n\ttell?(word: string, data: unknown, tick: number): void\n\t/** Lets go of what it holds outside its seat, once unseated */\n\tdispose?(): void\n}\n\n/**\n * Milliseconds a computer player's thinks took: for the report and the stats panel, never for a decision\n *\n * @beta\n */\nexport interface ComputerTiming {\n\t/** The last think, all its ticks where it was sliced */\n\tlast: number\n\t/** Averaged over its thinks */\n\taverage: number\n\t/** The longest think there was */\n\tlongest: number\n\t/** Ticks the last think took: 1, unless the brain's budget sliced it over ticks */\n\tticks?: number\n\t/** By module, averaged, while the world profiles (`Scheduler.profiling`): a brain's */\n\tmodules?: Record<string, number>\n\t/** By module, the most one pass of it took, always: a brain's. What `ThinkBudgetOptions.warnAfterMs` is measured against */\n\tlongestByModule?: Record<string, number>\n\t/** Of a think, what taking the picture of the game took (the seat's `snapshot()`), averaged, while the world profiles: a brain's */\n\tsnapshot?: number\n\t/** Of a think, what reading the picture into the view took (`AiView`), averaged, while the world profiles: a brain's */\n\tview?: number\n\t/** Of a think, what bringing the brain's knowledge up to date took, averaged, while the world profiles: a brain's */\n\tknowledge?: number\n}\n\n/**\n * The system a computer player plays from: it is asked to think about once a second (`every`, in seconds), each seat\n * at another tick of it, to spread the work; it is named for its seat (`ai-<player>`), which a save keeps what it\n * remembers by\n *\n * @beta\n */\nexport interface ComputerSystem<C extends ComputerPlayer = ComputerPlayer> extends System {\n\t/** The computer player this system runs */\n\treadonly computer: C\n\t/** The player it plays */\n\treadonly player: PlayerId\n\t/** The seat it plays through */\n\treadonly session: LocalSession\n\t/** Milliseconds its thinks took: the last, an average, the longest, and by module while the world profiles */\n\ttiming(): ComputerTiming\n\t/** Lets go of its seat: the session's listeners, what the computer player holds. The world stays */\n\tdispose(): void\n}\n\n/**\n * What a save keeps of a computer's seat (`ComputerSystem.save`): the number of the last command it sent, and what the\n * computer player remembers (`ComputerPlayer.save`), when it does\n *\n * @internal\n */\nexport interface ComputerSave {\n\t/** The number of the last command the seat sent */\n\tsent: number\n\t/** What the computer player remembers (`ComputerPlayer.save`), when it keeps anything */\n\tmemory?: unknown\n}\n\n/**\n * How a seat asks its computer player to think (`createComputerSystem`)\n *\n * @beta\n */\nexport interface ComputerSeatOptions {\n\t/** Seconds between thinks: 1 when left out */\n\tevery?: number\n\t/**\n\t * How much of a think one tick may do (`ThinkBudgetOptions`: modules a tick, units looked at a tick as the modules say,\n\t * the milliseconds a module is warned over), or the modules a tick as a number: a think with more goes on at the next\n\t * tick, over the same picture. Everything in one tick when left out\n\t */\n\tbudget?: number | ThinkBudgetOptions\n\t/** The tick in each round the seat thinks at: seven times the player's id when left out, so that seats think at different moments */\n\toffset?: number\n\t/**\n\t * What the seat's picture of the game carries: `lean`, what a computer reads (the entities, the players, the items, the\n\t * deaths, damage, pings, chat and the game's own events) and none of what a screen needs (projectiles, missiles,\n\t * corpses, reveals, the effects and the rest of the events), which is cheaper to take and to hear; `full`, everything a\n\t * player's seat gets. `full` when left out here; a brain's seat is `lean` unless its definition says otherwise\n\t * (`BrainDef.snapshot`)\n\t */\n\tsnapshot?: 'lean' | 'full'\n\t/**\n\t * Whether the seat sees everything, as an observer does (`LocalSession`'s `observer`): the one way a computer sees\n\t * through the fog, for a profile with `vision: 'all'` (insane). Its own seat's sight when left out\n\t */\n\tobserver?: boolean\n\t/**\n\t * How well the seat plays (`AiProfile`): its `handicap` (what its workers bring in, the health of what it has, the\n\t * damage it deals, how long what it makes takes, made more or less through hooks that go with the seat) and `vision: 'all'` (it sees everything, as `observer`). A brain's seat and a game's\n\t * own computer (`defineComputer`) are both given the profile of their difficulty\n\t */\n\tprofile?: AiProfile\n\t/** Called as the seat is taken away (`dispose`): to undo what seating did outside the computer (a hook added) */\n\tonDispose?: () => void\n}\n\n/**\n * The hooks a profile's handicap (`AiProfile.handicap`) is given to the world by, for one player: what its workers bring\n * in (`beforeDeposit`), the health of what it has (`stats`), the damage it deals (`beforeDamage`), how long what it\n * makes takes (`beforeProduce`). None for a handicap of 1, or none given. Ids `core.ai.handicap.<player>` and\n * `core.ai.handicap.<what>.<player>`\n */\nfunction handicapHooks(player: PlayerId, handicap: AiProfile['handicap']): HookDef[] {\n\tconst hooks: HookDef[] = []\n\tconst { income, health, damage, buildTime } = handicap ?? {}\n\tif (income !== undefined && income !== 1)\n\t\thooks.push({\n\t\t\tid: `core.ai.handicap.${player}`,\n\t\t\thook: 'beforeDeposit',\n\t\t\trun: (_world, event) => {\n\t\t\t\tif (event.player === player) event.amount = Math.round(event.amount * income)\n\t\t\t}\n\t\t})\n\tif (health !== undefined && health !== 1)\n\t\thooks.push({\n\t\t\tid: `core.ai.handicap.health.${player}`,\n\t\t\thook: 'stats',\n\t\t\trun: (_world, event) => {\n\t\t\t\tif (event.entity.owner === player) event.add({ percent: { health: health - 1 } })\n\t\t\t}\n\t\t})\n\tif (damage !== undefined && damage !== 1)\n\t\thooks.push({\n\t\t\tid: `core.ai.handicap.damage.${player}`,\n\t\t\thook: 'beforeDamage',\n\t\t\trun: (_world, event) => {\n\t\t\t\tif (event.source?.owner === player) event.amount *= damage\n\t\t\t}\n\t\t})\n\tif (buildTime !== undefined && buildTime !== 1)\n\t\thooks.push({\n\t\t\tid: `core.ai.handicap.buildTime.${player}`,\n\t\t\thook: 'beforeProduce',\n\t\t\trun: (_world, event) => {\n\t\t\t\tif (event.player === player) event.time *= buildTime\n\t\t\t}\n\t\t})\n\treturn hooks\n}\n\n/** How much of each new think goes into the averaged time of a seat. Small: the panel shows a steady number */\nconst SMOOTHING = 0.1\n\n/** What a computer player's own numbers start from: the world's seed and the player, mixed so that two seats of one game draw differently */\nconst seedOf = (seed: number, player: PlayerId) => (Math.imul((seed ^ 0x9e3779b9) >>> 0, 1664525) + player * 1013904223) >>> 0\n\n/**\n * Seats a computer player at a world: made of a session of its own (it sees what that player sees, and plays through\n * commands, so it cannot cheat), asked to think about once a second. `make` is handed the session and what a brain\n * takes besides (`BrainContext`: a seed of its own, the budget, whether the world profiles). Add the result to the\n * world (`world.addSystem`), or seat through `world.computers.seat`, which remembers it for a save\n *\n * @beta\n */\nexport function createComputerSystem<C extends ComputerPlayer>(\n\tworld: World,\n\tplayerId: PlayerId,\n\tmake: (session: LocalSession, context: BrainContext) => C,\n\toptions: ComputerSeatOptions = {}\n): ComputerSystem<C> {\n\tconst session = new LocalSession(world, playerId, {\n\t\tobserver: !!options.observer || options.profile?.vision === 'all',\n\t\tforComputer: options.snapshot === 'lean'\n\t})\n\t// its handicaps, asked of the game's rules through their hooks: the profile's, not the computer's doing\n\tconst handicaps = handicapHooks(playerId, options.profile?.handicap)\n\tfor (const hook of handicaps) world.hooks.add(hook)\n\tif (handicaps.some((hook) => hook.hook === 'stats')) invalidateStats(world)\n\t// the board of the player's team, shared by its computers: read anew each time, for a load replaces the world's states\n\tconst team = () => {\n\t\tconst boards = world.state(aiTeams)\n\t\tconst id = String(world.players.get(playerId)?.team ?? playerId)\n\t\treturn (boards[id] ??= emptyTeam())\n\t}\n\tconst computer = make(session, {\n\t\tseed: seedOf(world.seed, playerId),\n\t\tbudget: options.budget,\n\t\tprofiling: () => world.scheduler.profiling,\n\t\tteam,\n\t\tchecks: world.checks.ai\n\t})\n\tconst interval = Math.max(1, Math.round((options.every ?? 1) * world.tickRate))\n\t// players think at different moments, to spread the work\n\tconst offset = options.offset ?? playerId * 7\n\tconst timing: ComputerTiming = { last: 0, average: 0, longest: 0 }\n\t/** Milliseconds of the think under way, across its ticks */\n\tlet spent = 0\n\treturn {\n\t\tname: `ai-${playerId}`,\n\t\tcomputer,\n\t\tplayer: playerId,\n\t\tsession,\n\t\tupdate() {\n\t\t\tif (computer.paused) return\n\t\t\tif ((world.tick + offset) % interval !== 0 && !computer.busy) return\n\t\t\tconst start = performance.now()\n\t\t\tcomputer.think()\n\t\t\tspent += performance.now() - start\n\t\t\tif (computer.busy) return\n\t\t\ttiming.last = spent\n\t\t\ttiming.average = timing.average === 0 ? spent : timing.average + (spent - timing.average) * SMOOTHING\n\t\t\tif (spent > timing.longest) timing.longest = spent\n\t\t\tspent = 0\n\t\t},\n\t\ttiming() {\n\t\t\tconst brain = computer instanceof Brain ? computer : undefined\n\t\t\tif (!brain) return { ...timing }\n\t\t\tconst modules = Object.keys(brain.moduleTiming).length ? { ...brain.moduleTiming } : undefined\n\t\t\tconst longestByModule = Object.keys(brain.moduleLongest).length ? { ...brain.moduleLongest } : undefined\n\t\t\tconst { snapshotTiming: snapshot, viewTiming: view, knowledgeTiming: knowledge } = brain\n\t\t\treturn {\n\t\t\t\t...timing,\n\t\t\t\t...(brain.thinkTicks > 0 && { ticks: brain.thinkTicks }),\n\t\t\t\t...(modules && { modules }),\n\t\t\t\t...(longestByModule && { longestByModule }),\n\t\t\t\t...(snapshot !== undefined && { snapshot }),\n\t\t\t\t...(view !== undefined && { view }),\n\t\t\t\t...(knowledge !== undefined && { knowledge })\n\t\t\t}\n\t\t},\n\t\tdispose() {\n\t\t\tcomputer.dispose?.()\n\t\t\tsession.dispose()\n\t\t\tfor (const hook of handicaps) world.hooks.remove(hook.hook, hook.id)\n\t\t\tif (handicaps.some((hook) => hook.hook === 'stats')) invalidateStats(world)\n\t\t\toptions.onDispose?.()\n\t\t},\n\t\t// what it remembers goes into a save, with the number of the last command its seat sent; a game loaded from it\n\t\t// adds the computer player again, and it carries on\n\t\tsave: (): ComputerSave => {\n\t\t\tconst memory = computer.save?.()\n\t\t\treturn { sent: session.lastSeq, ...(memory !== undefined && { memory }) }\n\t\t},\n\t\trestore: (_world: World, data: unknown) => {\n\t\t\tconst { sent, memory } = data as ComputerSave\n\t\t\tsession.lastSeq = sent\n\t\t\tif (memory !== undefined) computer.restore?.(memory)\n\t\t}\n\t}\n}\n\n/**\n * The boards of the teams' computers (`TeamBoard`, AI plan C5), by team: in the world, so that a save keeps the\n * requests and the plan of an attack together, and never replicated, so that no player gets it in a snapshot\n *\n * @beta\n */\nexport const aiTeams = defineComponent<Record<string, TeamBoard>>({ id: 'core.ai.teams', default: () => ({}) })\n// the engine's own, found in every world's registry where the kit is loaded\nlistKitComponents(aiTeams)\n\n/**\n * Seats a brain at a world as one of its players, asked to think as its definition or the options say (`every`), with\n * the budget the options give. Add the result to the world, or go through `world.computers.seat`\n *\n * @beta\n */\nexport function createBrainSystem(world: World, playerId: PlayerId, brain: BrainDef, options: AiOptions = {}): ComputerSystem<Brain> {\n\t// its profile (D1): how often it thinks where the seat and the brain say nothing, whether it sees everything, its handicaps\n\tconst { profile } = resolveProfile(options, world.registry, undefined, world.players.get(playerId)?.race)\n\tconst every = options.every ?? (typeof brain.every === 'function' ? brain.every(options) : brain.every) ?? profile.every ?? 1\n\treturn createComputerSystem(world, playerId, (session, context) => createBrain(brain, session, options, context), {\n\t\tevery,\n\t\t// the budget (F2): the profile's, with the seat's own over it\n\t\tbudget: profile.budget,\n\t\tprofile,\n\t\t// the picture cut to what a brain reads, unless the brain says it reads everything\n\t\tsnapshot: brain.snapshot ?? 'lean'\n\t})\n}\n\n/**\n * A computer player of the game's own that is not made of modules (a `ComputerPlayer`: anything that thinks), as a brain\n * the game lists (`Rules.brains`) and seats as it does any (`world.computers.seat(player, { brain })`): found again\n * by its id when a save is loaded. `make` is handed the seat's session, its context and what it was seated with, the\n * map's under the seat's; it thinks as often as those say (`every`, 1 second when left out)\n *\n * @beta\n */\nexport function defineComputer<C extends ComputerPlayer>(\n\tid: string,\n\tmake: (session: LocalSession, context: BrainContext, options: AiOptions) => C\n): BrainDef {\n\treturn {\n\t\tid,\n\t\tmodules: [],\n\t\tseat: (world, player, given) => {\n\t\t\tconst options = mapAiOptions(world, player, given)\n\t\t\treturn createComputerSystem(world, player, (session, context) => make(session, context, options), {\n\t\t\t\tevery: options.every,\n\t\t\t\tbudget: options.budget,\n\t\t\t\t// the difficulty's handicap and vision, as a brain's seat has them\n\t\t\t\tprofile: resolveProfile(options, world.registry, undefined, world.players.get(player)?.race).profile\n\t\t\t})\n\t\t}\n\t}\n}\n\n/**\n * What a map says of how its computer player plays (`MapPlayer.data.ai`, decision 6 of the AI plan), for a player the map\n * gives the computer (`controller: 'computer'`): a difficulty and a personality by name, and settings (`AiSettings`:\n * its flags, its build order as `plans.order`, its waves as `waves.waves`, any area's numbers). Plain data, as the map's\n * file holds it\n *\n * @beta\n */\nexport interface MapAi {\n\t/** The brain the player is seated with, by id (`Rules.brains`): over its race's (`GameAi.races`), under the seat's */\n\tbrain?: string\n\t/** The id of the difficulty the computer plays at, which a game's brain reads from its settings */\n\tdifficulty?: string\n\t/** The id of the personality the computer plays with, which a game's brain reads from its settings */\n\tpersonality?: string\n\t/** Settings for the brain, over the ones its difficulty and personality give */\n\tsettings?: AiSettings\n\t/**\n\t * Settings by the race the player plays (`Rules.races`), over `settings`: for a player whose race the lobby\n\t * chooses or draws (`random`), a build order or waves for each\n\t */\n\traces?: Record<string, AiSettings>\n}\n\n/**\n * The seat's options with what the map says of the player under them (`MapPlayer.data.ai`), where the map gives the player\n * to the computer: the lobby's and the scene's say goes over the map's (decision 10), its settings layered over the map's\n * (the map's for the race the player plays over the rest of the map's)\n *\n * @internal\n */\nexport function mapAiOptions(world: World, playerId: PlayerId, options: AiOptions): AiOptions {\n\tconst player = world.map.player(playerId)\n\tconst map = player?.controller === 'computer' ? (player.data?.ai as MapAi | undefined) : undefined\n\tif (!map || typeof map !== 'object') return options\n\tconst race = world.players.get(playerId)?.race\n\tconst raced = race !== undefined ? map.races?.[race] : undefined\n\treturn {\n\t\t...(map.difficulty !== undefined && { difficulty: map.difficulty }),\n\t\t...(map.personality !== undefined && { personality: map.personality }),\n\t\t...options,\n\t\t...((map.settings || raced || options.settings) && { settings: resolveSettings([map.settings, raced, options.settings]) })\n\t}\n}\n\n/** A seed of a watcher's own numbers: the world's, mixed with the player's */\nconst watcherSeedOf = (seed: number, player: PlayerId) => (Math.imul((seed ^ 0x7f4a7c15) >>> 0, 1664525) + player * 1013904223) >>> 0\n\n/** The watcher's brain: nothing of its own, the kit's reading of the picture alone */\nconst WATCHER: BrainDef = { id: MISSION_RULES, modules: [] }\n\n/**\n * Seats a watcher for the mission rules (`missionRules`, campaign plan MS1): a brain with no modules of its own, at a\n * player, on an observer's session (it sees the whole map; `mine` and `enemy` are that player's), which reads the\n * picture as a brain does when asked to (`think`) and answers a rule's condition (`ask`: the kit's `evaluate`). Its\n * numbers are seeded from the world's and the player's, and its memory is the rules' to save\n *\n * @internal\n */\nexport function ruleWatcher(world: World, player: PlayerId): RulesWatcher {\n\tconst session = new LocalSession(world, player, { observer: true, forComputer: true })\n\tconst brain = createBrain(WATCHER, session, {}, { seed: watcherSeedOf(world.seed, player) })\n\treturn {\n\t\tthink: () => brain.think(),\n\t\task: (condition) => evaluate(condition, brain),\n\t\ttell: (word, data, tick) => brain.tell(word, data, tick),\n\t\ttakeTold: (word) => void brain.takeTold(word),\n\t\tsave: () => brain.save(),\n\t\trestore: (memory) => brain.restore(memory as never)\n\t}\n}\n"],"mappings":"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"}
|
package/dist/ai/defence.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export interface DefenceOptions {
|
|
|
35
35
|
* @beta
|
|
36
36
|
*/
|
|
37
37
|
export interface DefenceMemory {
|
|
38
|
+
/** The version of the memory's format: 1 so far */
|
|
38
39
|
v: 1;
|
|
39
40
|
/** By base (the id of what it is around): where, how many raids, the one on now (since when), when last seen, the strongest */
|
|
40
41
|
raids: Record<string, {
|
|
@@ -67,6 +68,7 @@ export interface Raid {
|
|
|
67
68
|
* @beta
|
|
68
69
|
*/
|
|
69
70
|
export interface DefenceReport {
|
|
71
|
+
/** The raids on now, each with where it is, the enemy units in it, their strength, the squad that answers it and how many defend, since when and how many so far */
|
|
70
72
|
raids: {
|
|
71
73
|
at: [number, number];
|
|
72
74
|
intruders: number[];
|
|
@@ -76,11 +78,13 @@ export interface DefenceReport {
|
|
|
76
78
|
since: number;
|
|
77
79
|
count: number;
|
|
78
80
|
}[];
|
|
81
|
+
/** The bases raided, each with where it is, how many raids it had and the tick of the last */
|
|
79
82
|
bases: {
|
|
80
83
|
at: [number, number];
|
|
81
84
|
raids: number;
|
|
82
85
|
last: number;
|
|
83
86
|
}[];
|
|
87
|
+
/** The towers it wants, each with where, the type wanted and how far the want is along */
|
|
84
88
|
towers: {
|
|
85
89
|
at: [number, number];
|
|
86
90
|
want: string;
|