@reicek/neataptic-ts 0.1.21 → 0.1.23
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/.github/agents/boundary-mapper.agent.md +31 -0
- package/.github/agents/docs-scout.agent.md +29 -0
- package/.github/agents/plan-scout.agent.md +31 -0
- package/.github/agents/solid-split.agent.md +143 -0
- package/.github/copilot-instructions.md +119 -0
- package/.github/skills/solid-split-playbook/SKILL.md +220 -0
- package/.github/skills/solid-split-playbook/assets/docs-checklist.md +34 -0
- package/.github/skills/solid-split-playbook/assets/split-plan-template.md +48 -0
- package/.github/skills/solid-split-playbook/assets/split-workflow-checklist.md +51 -0
- package/.github/skills/trace-analyzer-extension/SKILL.md +63 -0
- package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +24 -0
- package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +101 -0
- package/.github/skills/trace-audit-reporting/SKILL.md +96 -0
- package/.github/skills/trace-audit-reporting/assets/performance-report-template.md +123 -0
- package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +132 -0
- package/package.json +7 -3
- package/plans/ES2023 migration +13 -8
- package/plans/Evolution_Training_Interoperability_Contracts.md +1 -1
- package/plans/Flappy_Bird_Folder_Documentation_Pass.md +53 -0
- package/plans/Flappy_Evolution_Worker_Documentation_Pass.md +58 -0
- package/plans/Interactive_Examples_and_Learning_Path.md +10 -2
- package/plans/Memory_Optimization.md +3 -3
- package/plans/README.md +63 -0
- package/plans/Roadmap.md +15 -3
- package/plans/asciiMaze_SOLID_split.done.md +130 -0
- package/plans/flappy_bird_SOLID_split.done.md +67 -0
- package/scripts/analyze-trace.ts +590 -0
- package/scripts/assets/theme.css +221 -34
- package/scripts/copy-examples.mjs +9 -5
- package/scripts/export-onnx.mjs +3 -3
- package/scripts/generate-bench-tables.mjs +10 -10
- package/scripts/generate-bench-tables.ts +10 -10
- package/scripts/generate-docs.ts +1415 -449
- package/scripts/render-docs-html.ts +15 -8
- package/src/README.md +127 -222
- package/src/architecture/README.md +117 -184
- package/src/architecture/architect.ts +6 -0
- package/src/architecture/layer/README.md +38 -38
- package/src/architecture/network/README.md +49 -31
- package/src/architecture/network/activate/README.md +77 -77
- package/src/architecture/network/connect/README.md +15 -13
- package/src/architecture/network/deterministic/README.md +7 -7
- package/src/architecture/network/evolve/README.md +44 -44
- package/src/architecture/network/gating/README.md +20 -20
- package/src/architecture/network/genetic/README.md +51 -51
- package/src/architecture/network/mutate/README.md +97 -97
- package/src/architecture/network/network.types.ts +39 -0
- package/src/architecture/network/onnx/README.md +264 -264
- package/src/architecture/network/prune/README.md +39 -39
- package/src/architecture/network/remove/README.md +26 -26
- package/src/architecture/network/serialize/README.md +56 -56
- package/src/architecture/network/serialize/network.serialize.json.utils.ts +1 -0
- package/src/architecture/network/serialize/network.serialize.utils.ts +6 -1
- package/src/architecture/network/serialize/network.serialize.utils.types.ts +1 -1
- package/src/architecture/network/slab/README.md +61 -61
- package/src/architecture/network/standalone/README.md +24 -24
- package/src/architecture/network/stats/README.md +9 -9
- package/src/architecture/network/topology/README.md +46 -46
- package/src/architecture/network/training/README.md +21 -21
- package/src/architecture/network.ts +114 -10
- package/src/methods/README.md +9 -87
- package/src/multithreading/README.md +8 -77
- package/src/multithreading/workers/README.md +2 -2
- package/src/multithreading/workers/browser/README.md +0 -6
- package/src/multithreading/workers/node/README.md +0 -3
- package/src/neat/README.md +623 -568
- package/src/neat/neat.evolve.population.utils.ts +29 -5
- package/src/neat/neat.helpers.ts +16 -0
- package/src/neat/neat.topology-intent.utils.ts +160 -0
- package/src/utils/README.md +18 -18
- package/test/examples/asciiMaze/README.md +59 -59
- package/test/examples/asciiMaze/asciiMaze.e2e.test.ts +14 -9
- package/test/examples/asciiMaze/browser-entry/README.md +196 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.abort.services.ts +95 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.constants.ts +23 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.curriculum.services.ts +115 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.globals.services.ts +106 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.host.services.ts +157 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.services.ts +14 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.ts +129 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.types.ts +120 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.utils.ts +98 -0
- package/test/examples/asciiMaze/browser-entry.ts +10 -576
- package/test/examples/asciiMaze/dashboardManager/README.md +276 -0
- package/test/examples/asciiMaze/dashboardManager/archive/README.md +16 -0
- package/test/examples/asciiMaze/dashboardManager/archive/dashboardManager.archive.services.ts +267 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.constants.ts +35 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.services.ts +103 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.ts +181 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.types.ts +267 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.utils.ts +254 -0
- package/test/examples/asciiMaze/dashboardManager/live/README.md +14 -0
- package/test/examples/asciiMaze/dashboardManager/live/dashboardManager.live.services.ts +264 -0
- package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +47 -0
- package/test/examples/asciiMaze/dashboardManager/telemetry/dashboardManager.telemetry.services.ts +513 -0
- package/test/examples/asciiMaze/dashboardManager.ts +13 -2335
- package/test/examples/asciiMaze/evolutionEngine/README.md +1058 -0
- package/test/examples/asciiMaze/evolutionEngine/curriculumPhase.ts +90 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.constants.ts +36 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.ts +58 -513
- package/test/examples/asciiMaze/evolutionEngine/engineState.types.ts +212 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.utils.ts +301 -0
- package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.types.ts +445 -0
- package/test/examples/asciiMaze/evolutionEngine/evolutionLoop.ts +81 -50
- package/test/examples/asciiMaze/evolutionEngine/optionsAndSetup.ts +2 -4
- package/test/examples/asciiMaze/evolutionEngine/populationDynamics.ts +17 -33
- package/test/examples/asciiMaze/evolutionEngine/populationPruning.ts +1 -1
- package/test/examples/asciiMaze/evolutionEngine/rngAndTiming.ts +1 -2
- package/test/examples/asciiMaze/evolutionEngine/sampling.ts +1 -1
- package/test/examples/asciiMaze/evolutionEngine/scratchPools.ts +2 -5
- package/test/examples/asciiMaze/evolutionEngine/setupHelpers.ts +30 -37
- package/test/examples/asciiMaze/evolutionEngine/telemetryMetrics.ts +16 -58
- package/test/examples/asciiMaze/evolutionEngine/trainingWarmStart.ts +2 -2
- package/test/examples/asciiMaze/evolutionEngine.ts +55 -55
- package/test/examples/asciiMaze/fitness.ts +2 -2
- package/test/examples/asciiMaze/fitness.types.ts +65 -0
- package/test/examples/asciiMaze/interfaces.ts +64 -1352
- package/test/examples/asciiMaze/mazeMovement/README.md +356 -0
- package/test/examples/asciiMaze/mazeMovement/finalization/README.md +49 -0
- package/test/examples/asciiMaze/mazeMovement/finalization/mazeMovement.finalization.ts +138 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.constants.ts +101 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.services.ts +230 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.ts +299 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.types.ts +185 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.utils.ts +153 -0
- package/test/examples/asciiMaze/mazeMovement/policy/README.md +91 -0
- package/test/examples/asciiMaze/mazeMovement/policy/mazeMovement.policy.ts +467 -0
- package/test/examples/asciiMaze/mazeMovement/runtime/README.md +95 -0
- package/test/examples/asciiMaze/mazeMovement/runtime/mazeMovement.runtime.ts +354 -0
- package/test/examples/asciiMaze/mazeMovement/shaping/README.md +124 -0
- package/test/examples/asciiMaze/mazeMovement/shaping/mazeMovement.shaping.ts +459 -0
- package/test/examples/asciiMaze/mazeMovement.ts +12 -2978
- package/test/examples/flappy_bird/README.md +193 -88
- package/test/examples/flappy_bird/browser-entry/README.md +1441 -0
- package/test/examples/flappy_bird/browser-entry/browser-entry.host.utils.ts +4 -324
- package/test/examples/flappy_bird/browser-entry/browser-entry.network-view.utils.ts +9 -396
- package/test/examples/flappy_bird/browser-entry/browser-entry.playback.utils.ts +6 -714
- package/test/examples/flappy_bird/browser-entry/browser-entry.render.types.ts +26 -3
- package/test/examples/flappy_bird/browser-entry/browser-entry.runtime.types.ts +16 -1
- package/test/examples/flappy_bird/browser-entry/browser-entry.simulation.types.ts +39 -5
- package/test/examples/flappy_bird/browser-entry/browser-entry.spawn.utils.ts +11 -31
- package/test/examples/flappy_bird/browser-entry/browser-entry.stats.types.ts +32 -4
- package/test/examples/flappy_bird/browser-entry/browser-entry.ts +11 -0
- package/test/examples/flappy_bird/browser-entry/browser-entry.types.ts +8 -0
- package/test/examples/flappy_bird/browser-entry/browser-entry.visualization.types.ts +50 -7
- package/test/examples/flappy_bird/browser-entry/browser-entry.visualization.utils.ts +21 -893
- package/test/examples/flappy_bird/browser-entry/browser-entry.worker.types.ts +91 -10
- package/test/examples/flappy_bird/browser-entry/host/README.md +318 -0
- package/test/examples/flappy_bird/browser-entry/host/host.canvas.service.ts +16 -0
- package/test/examples/flappy_bird/browser-entry/host/host.constants.ts +20 -0
- package/test/examples/flappy_bird/browser-entry/host/host.dom.service.ts +10 -0
- package/test/examples/flappy_bird/browser-entry/host/host.resize.service.ts +1 -295
- package/test/examples/flappy_bird/browser-entry/host/host.stats.service.ts +14 -0
- package/test/examples/flappy_bird/browser-entry/host/host.ts +592 -6
- package/test/examples/flappy_bird/browser-entry/host/host.types.ts +13 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/README.md +309 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.constants.ts +47 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.services.ts +392 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.ts +132 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.types.ts +92 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.utils.ts +272 -0
- package/test/examples/flappy_bird/browser-entry/network-view/README.md +389 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.draw.service.ts +13 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.labels.utils.ts +12 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.layout.utils.ts +14 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.topology.utils.ts +267 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.ts +823 -7
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.types.ts +11 -0
- package/test/examples/flappy_bird/browser-entry/playback/README.md +845 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/README.md +355 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +1068 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.batch.services.ts +64 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.cache.services.ts +207 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.constants.ts +197 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.batch.utils.ts +114 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.layout.utils.test.ts +96 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.layout.utils.ts +204 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.services.ts +49 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.utils.ts +313 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.layer.services.ts +81 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.math.utils.test.ts +33 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.math.utils.ts +201 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.selection.utils.ts +171 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.timing.utils.ts +124 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.utils.test.ts +279 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.utils.ts +132 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.scene.services.ts +26 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.services.ts +65 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.ts +48 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.types.ts +342 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.utils.ts +10 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.cache.services.ts +96 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.constants.ts +127 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.draw.services.ts +184 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.scene.services.ts +64 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.services.ts +6 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.ts +53 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.types.ts +105 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.utils.ts +100 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +541 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.bird.utils.ts +180 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.canvas.services.ts +77 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.entity.services.ts +167 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.scene.services.ts +57 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.service.test.ts +176 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.service.ts +113 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.services.ts +35 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.trail.utils.ts +248 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.types.ts +103 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.utils.ts +11 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.constants.ts +1 -1
- package/test/examples/flappy_bird/browser-entry/playback/playback.frame-render.service.ts +10 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.iteration.services.ts +192 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.loop.service.ts +12 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types.ts +78 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.render.pipe-outline.service.ts +128 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.render.service.ts +1 -116
- package/test/examples/flappy_bird/browser-entry/playback/playback.session.services.ts +184 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.snapshot.utils.test.ts +121 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.snapshot.utils.ts +8 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.layer.services.ts +36 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.service.ts +11 -128
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.services.ts +268 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.types.ts +91 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.utils.ts +11 -4
- package/test/examples/flappy_bird/browser-entry/playback/playback.trail.utils.ts +9 -86
- package/test/examples/flappy_bird/browser-entry/playback/playback.ts +75 -7
- package/test/examples/flappy_bird/browser-entry/playback/playback.types.ts +12 -9
- package/test/examples/flappy_bird/browser-entry/playback/playback.worker-channel.utils.ts +11 -123
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +55 -0
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/playback.snapshot.services.ts +103 -0
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/playback.snapshot.summary.utils.test.ts +45 -0
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/playback.snapshot.summary.utils.ts +28 -0
- package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +95 -0
- package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.history.services.test.ts +35 -0
- package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.history.services.ts +64 -0
- package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.opacity.utils.test.ts +37 -0
- package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.opacity.utils.ts +74 -0
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +71 -0
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.request.services.ts +45 -0
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.summary.services.ts +74 -0
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.types.ts +53 -0
- package/test/examples/flappy_bird/browser-entry/runtime/README.md +304 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.browser-globals.service.ts +15 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.errors.ts +17 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.evolution-launch.service.ts +56 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.evolution-loop.service.ts +19 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.lifecycle.service.ts +96 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.startup.service.ts +92 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.telemetry.service.ts +24 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.ts +31 -121
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.types.ts +65 -0
- package/test/examples/flappy_bird/browser-entry/visualization/README.md +568 -0
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.colors.utils.ts +26 -0
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.constants.ts +110 -0
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.draw.service.ts +979 -19
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.legend.utils.ts +157 -3
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.topology.utils.ts +13 -27
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.ts +7 -20
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.types.ts +14 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +238 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.errors.ts +11 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.generation.service.ts +12 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.playback.service.test.ts +143 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.playback.service.ts +140 -14
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.request.service.ts +27 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.ts +8 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.types.ts +23 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.url.service.ts +5 -0
- package/test/examples/flappy_bird/constants/README.md +1163 -0
- package/test/examples/flappy_bird/constants/constants.birds.ts +16 -38
- package/test/examples/flappy_bird/constants/constants.difficulty.ts +21 -0
- package/test/examples/flappy_bird/constants/constants.network-view.ts +24 -0
- package/test/examples/flappy_bird/constants/constants.network.ts +1 -1
- package/test/examples/flappy_bird/constants/constants.observation.ts +7 -0
- package/test/examples/flappy_bird/constants/constants.palette.ts +9 -2
- package/test/examples/flappy_bird/constants/constants.physics.ts +9 -0
- package/test/examples/flappy_bird/constants/constants.pipe-render.ts +3 -0
- package/test/examples/flappy_bird/constants/constants.pipes.ts +22 -3
- package/test/examples/flappy_bird/constants/constants.runtime.ts +28 -4
- package/test/examples/flappy_bird/constants/constants.starfield.ts +78 -3
- package/test/examples/flappy_bird/constants/constants.ts +6 -0
- package/test/examples/flappy_bird/environment/README.md +182 -0
- package/test/examples/flappy_bird/environment/environment.collision.utils.ts +7 -0
- package/test/examples/flappy_bird/environment/environment.constants.ts +16 -3
- package/test/examples/flappy_bird/environment/environment.observation.utils.ts +12 -19
- package/test/examples/flappy_bird/environment/environment.state.service.ts +10 -0
- package/test/examples/flappy_bird/environment/environment.step.service.ts +15 -66
- package/test/examples/flappy_bird/environment/environment.types.ts +14 -0
- package/test/examples/flappy_bird/evaluation/README.md +155 -0
- package/test/examples/flappy_bird/evaluation/evaluation.constants.ts +23 -4
- package/test/examples/flappy_bird/evaluation/evaluation.fitness.utils.ts +16 -1
- package/test/examples/flappy_bird/evaluation/evaluation.rollout.service.ts +7 -374
- package/test/examples/flappy_bird/evaluation/evaluation.seed.utils.ts +4 -0
- package/test/examples/flappy_bird/evaluation/evaluation.types.ts +18 -2
- package/test/examples/flappy_bird/evaluation/rollout/README.md +355 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.constants.ts +38 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.service.ts +71 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.services.ts +338 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.types.ts +69 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.utils.ts +399 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +845 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.constants.ts +49 -7
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.errors.ts +34 -3
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.evolution.service.ts +22 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.playback.service.ts +62 -26
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.protocol.service.ts +27 -1
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.runtime.service.ts +23 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.frame.service.ts +378 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types.ts +22 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.utils.ts +20 -203
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.snapshot.utils.test.ts +94 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.snapshot.utils.ts +78 -13
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.ts +235 -344
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types.ts +170 -22
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.warm-start.service.ts +314 -0
- package/test/examples/flappy_bird/flappy.simulation.shared.utils.ts +17 -0
- package/test/examples/flappy_bird/flappyEnvironment.ts +21 -0
- package/test/examples/flappy_bird/flappyEvaluation.ts +12 -0
- package/test/examples/flappy_bird/flappyEvolution.worker.ts +7 -0
- package/test/examples/flappy_bird/index.ts +8 -2
- package/test/examples/flappy_bird/rng.ts +10 -0
- package/test/examples/flappy_bird/simulation-shared/README.md +518 -0
- package/test/examples/flappy_bird/simulation-shared/observation/README.md +255 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.features.utils.ts +339 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.ts +19 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.vector.utils.ts +81 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.constants.ts +3 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.control.utils.ts +6 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.difficulty.utils.ts +9 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.errors.ts +10 -1
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.memory.utils.ts +18 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.observation.utils.ts +7 -402
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.spawn.utils.ts +36 -6
- package/test/examples/flappy_bird/{evaluation/evaluation.statistics.utils.ts → simulation-shared/simulation-shared.statistics.utils.ts} +30 -9
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.types.ts +38 -5
- package/test/examples/flappy_bird/trainFlappyBird.ts +13 -0
- package/test/examples/flappy_bird/trainer/README.md +676 -0
- package/test/examples/flappy_bird/trainer/evaluation/README.md +253 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.constants.ts +15 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.services.ts +86 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.ts +187 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.types.ts +32 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.utils.ts +182 -0
- package/test/examples/flappy_bird/trainer/trainer.evaluation.service.ts +13 -0
- package/test/examples/flappy_bird/trainer/trainer.fitness.service.ts +23 -1
- package/test/examples/flappy_bird/trainer/trainer.loop.service.ts +17 -1
- package/test/examples/flappy_bird/trainer/trainer.report.service.services.ts +181 -0
- package/test/examples/flappy_bird/trainer/trainer.report.service.ts +136 -0
- package/test/examples/flappy_bird/trainer/trainer.selection.utils.ts +89 -0
- package/test/examples/flappy_bird/trainer/trainer.setup.service.ts +22 -0
- package/test/examples/flappy_bird/trainer/trainer.signals.service.ts +8 -0
- package/test/examples/flappy_bird/trainer/trainer.ts +38 -553
- package/test/examples/flappy_bird/trainer/trainer.types.ts +44 -7
- package/test/neat/neat.topology-intent.test.ts +129 -0
- package/test/network/network.topology-intent.test.ts +44 -0
- package/test/examples/flappy_bird/browser-entry/browser-entry.utils.ts +0 -12
- package/test/examples/flappy_bird/environment/environment.ts +0 -7
- package/test/examples/flappy_bird/evaluation/evaluation.ts +0 -7
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.ts +0 -15
- package/test/examples/flappy_bird/trainer/trainer.statistics.utils.ts +0 -78
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
# browser-entry/playback
|
|
2
|
+
|
|
3
|
+
## browser-entry/playback/playback.types.ts
|
|
4
|
+
|
|
5
|
+
### PlaybackEdgeBounds
|
|
6
|
+
|
|
7
|
+
Shared playback utility types for the browser-entry subsystem.
|
|
8
|
+
|
|
9
|
+
These types support rendering concerns that cut across multiple playback
|
|
10
|
+
helpers, such as edge-aware trail fading and cached parallax backgrounds.
|
|
11
|
+
|
|
12
|
+
### PlaybackStarfieldLayerSpec
|
|
13
|
+
|
|
14
|
+
Declarative recipe for building one cached starfield parallax layer.
|
|
15
|
+
|
|
16
|
+
Each layer spec describes how dense, bright, blurred, and fast one visual
|
|
17
|
+
depth plane should feel.
|
|
18
|
+
|
|
19
|
+
### StarTile
|
|
20
|
+
|
|
21
|
+
Shared type contract for starfield tile rendering layers.
|
|
22
|
+
|
|
23
|
+
A tile is pre-rendered and repeated horizontally to draw efficient
|
|
24
|
+
parallax backgrounds during playback.
|
|
25
|
+
|
|
26
|
+
Separating the image type from the tile record lets the same starfield logic
|
|
27
|
+
work with ordinary canvases and `OffscreenCanvas` when available.
|
|
28
|
+
|
|
29
|
+
## browser-entry/playback/playback.starfield.types.ts
|
|
30
|
+
|
|
31
|
+
### playback.starfield.types
|
|
32
|
+
|
|
33
|
+
Starfield and parallax rendering contracts for playback backgrounds.
|
|
34
|
+
|
|
35
|
+
The playback view uses a cached layered starfield to add depth without paying
|
|
36
|
+
a large per-frame rendering cost. These types define the tile, layer, and
|
|
37
|
+
deterministic placement data needed for that effect.
|
|
38
|
+
|
|
39
|
+
### CreateStarTileCanvasOptions
|
|
40
|
+
|
|
41
|
+
Input contract for pre-rendering one deterministic starfield tile.
|
|
42
|
+
|
|
43
|
+
The generated tile is cached and repeated horizontally during playback,
|
|
44
|
+
so every field here affects both the visual look and the parallax cost.
|
|
45
|
+
|
|
46
|
+
### PlaybackStarfieldLayerSpec
|
|
47
|
+
|
|
48
|
+
Declarative recipe for building one cached starfield parallax layer.
|
|
49
|
+
|
|
50
|
+
Each layer spec describes how dense, bright, blurred, and fast one visual
|
|
51
|
+
depth plane should feel.
|
|
52
|
+
|
|
53
|
+
### StarfieldCanvasDimensions
|
|
54
|
+
|
|
55
|
+
Normalized canvas dimensions used by browser and offscreen tile creation.
|
|
56
|
+
|
|
57
|
+
The creation path works with both `HTMLCanvasElement` and `OffscreenCanvas`,
|
|
58
|
+
so dimensions are stored in a narrow shared shape rather than tied to one DOM
|
|
59
|
+
type.
|
|
60
|
+
|
|
61
|
+
### StarPlacement
|
|
62
|
+
|
|
63
|
+
Deterministic placement and appearance for one rendered star sprite.
|
|
64
|
+
|
|
65
|
+
Determinism matters here because cached starfield tiles should remain stable
|
|
66
|
+
across redraws instead of sparkling randomly every frame.
|
|
67
|
+
|
|
68
|
+
### StarTile
|
|
69
|
+
|
|
70
|
+
Shared type contract for starfield tile rendering layers.
|
|
71
|
+
|
|
72
|
+
A tile is pre-rendered and repeated horizontally to draw efficient
|
|
73
|
+
parallax backgrounds during playback.
|
|
74
|
+
|
|
75
|
+
Separating the image type from the tile record lets the same starfield logic
|
|
76
|
+
work with ordinary canvases and `OffscreenCanvas` when available.
|
|
77
|
+
|
|
78
|
+
### StarTileImage
|
|
79
|
+
|
|
80
|
+
Starfield and parallax rendering contracts for playback backgrounds.
|
|
81
|
+
|
|
82
|
+
The playback view uses a cached layered starfield to add depth without paying
|
|
83
|
+
a large per-frame rendering cost. These types define the tile, layer, and
|
|
84
|
+
deterministic placement data needed for that effect.
|
|
85
|
+
|
|
86
|
+
## browser-entry/playback/playback.orchestration.types.ts
|
|
87
|
+
|
|
88
|
+
### PlaybackEpisodeSummary
|
|
89
|
+
|
|
90
|
+
Playback orchestration contracts for the Flappy Bird browser demo.
|
|
91
|
+
|
|
92
|
+
These types describe the moving pieces of one playback episode: the public
|
|
93
|
+
summary returned at the end, the mutable loop bookkeeping used while frames
|
|
94
|
+
are streaming, and the session context mirrored locally in the browser.
|
|
95
|
+
|
|
96
|
+
### PlaybackIterationContext
|
|
97
|
+
|
|
98
|
+
Shared dependencies and mutable state used by one playback iteration.
|
|
99
|
+
|
|
100
|
+
Grouping these fields into one context object keeps the iteration services
|
|
101
|
+
declarative and avoids long parameter lists across the playback loop.
|
|
102
|
+
|
|
103
|
+
### PlaybackLoopState
|
|
104
|
+
|
|
105
|
+
Mutable loop bookkeeping shared across playback iterations.
|
|
106
|
+
|
|
107
|
+
This is the browser-side state machine for the playback loop: how much
|
|
108
|
+
simulation budget is being requested, whether the episode has finished, and
|
|
109
|
+
what aggregate summary has been observed so far.
|
|
110
|
+
|
|
111
|
+
### PlaybackMutableSummary
|
|
112
|
+
|
|
113
|
+
Mutable playback summary extended with latest leader telemetry fallbacks.
|
|
114
|
+
|
|
115
|
+
During playback the browser may need temporary "latest known" values before
|
|
116
|
+
the worker emits final aggregate statistics, so the mutable form carries both
|
|
117
|
+
final fields and rolling fallbacks.
|
|
118
|
+
|
|
119
|
+
### PlaybackSessionContext
|
|
120
|
+
|
|
121
|
+
Shared mutable playback state mirrored locally while worker playback runs.
|
|
122
|
+
|
|
123
|
+
The worker remains the source of truth for simulation, but the browser keeps
|
|
124
|
+
lightweight mirrored state for rendering, trail accumulation, and loop
|
|
125
|
+
orchestration.
|
|
126
|
+
|
|
127
|
+
## browser-entry/playback/playback.ts
|
|
128
|
+
|
|
129
|
+
### animatePopulationEpisode
|
|
130
|
+
|
|
131
|
+
`(canvas: HTMLCanvasElement, context: CanvasRenderingContext2D, evolutionWorker: Worker, onFrameStats: (stats: import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").PlaybackFrameStats) => void) => Promise<import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackEpisodeSummary>`
|
|
132
|
+
|
|
133
|
+
Public playback orchestration for the Flappy Bird browser demo.
|
|
134
|
+
|
|
135
|
+
Playback is the bridge between off-thread simulation and on-screen
|
|
136
|
+
visualization. The worker advances the world and streams packed snapshots;
|
|
137
|
+
this layer mirrors enough state locally to animate those snapshots at browser
|
|
138
|
+
frame cadence, render trails and backgrounds, and emit HUD telemetry.
|
|
139
|
+
|
|
140
|
+
### animatePopulationEpisodeInternal
|
|
141
|
+
|
|
142
|
+
`(canvas: HTMLCanvasElement, context: CanvasRenderingContext2D, evolutionWorker: Worker, onFrameStats: (stats: import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").PlaybackFrameStats) => void) => Promise<import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackEpisodeSummary>`
|
|
143
|
+
|
|
144
|
+
Internal playback orchestration entry retained for compatibility re-exports.
|
|
145
|
+
|
|
146
|
+
The implementation is shared with the public entry so legacy imports and the
|
|
147
|
+
newer folderized surface behave identically.
|
|
148
|
+
|
|
149
|
+
Parameters:
|
|
150
|
+
- `canvas` - - Target playback canvas.
|
|
151
|
+
- `context` - - Canvas 2D context.
|
|
152
|
+
- `evolutionWorker` - - Worker owning playback simulation state.
|
|
153
|
+
- `onFrameStats` - - Callback receiving per-frame playback telemetry.
|
|
154
|
+
|
|
155
|
+
Returns: Aggregate playback summary for the current episode.
|
|
156
|
+
|
|
157
|
+
### PlaybackEpisodeSummary
|
|
158
|
+
|
|
159
|
+
Playback orchestration contracts for the Flappy Bird browser demo.
|
|
160
|
+
|
|
161
|
+
These types describe the moving pieces of one playback episode: the public
|
|
162
|
+
summary returned at the end, the mutable loop bookkeeping used while frames
|
|
163
|
+
are streaming, and the session context mirrored locally in the browser.
|
|
164
|
+
|
|
165
|
+
## browser-entry/playback/playback.errors.ts
|
|
166
|
+
|
|
167
|
+
### playback.errors
|
|
168
|
+
|
|
169
|
+
Error message emitted when playback requires RAF but it is unavailable.
|
|
170
|
+
|
|
171
|
+
### PLAYBACK_ANIMATION_FRAME_UNAVAILABLE_ERROR_MESSAGE
|
|
172
|
+
|
|
173
|
+
### PlaybackAnimationFrameUnavailableError
|
|
174
|
+
|
|
175
|
+
Error thrown when a playback frame wait is requested without RAF support.
|
|
176
|
+
|
|
177
|
+
## browser-entry/playback/playback.constants.ts
|
|
178
|
+
|
|
179
|
+
### cachedStarfieldTilesByHeight
|
|
180
|
+
|
|
181
|
+
## browser-entry/playback/playback.loop.service.ts
|
|
182
|
+
|
|
183
|
+
### nextAnimationFrame
|
|
184
|
+
|
|
185
|
+
`() => Promise<void>`
|
|
186
|
+
|
|
187
|
+
Browser frame-pacing helpers for playback animation.
|
|
188
|
+
|
|
189
|
+
The playback loop advances worker simulation in batches but still presents
|
|
190
|
+
frames at browser animation cadence. This module isolates the
|
|
191
|
+
`requestAnimationFrame` dependency so playback orchestration can read more
|
|
192
|
+
clearly and fail with a targeted error when RAF is unavailable.
|
|
193
|
+
|
|
194
|
+
## browser-entry/playback/playback.render.service.ts
|
|
195
|
+
|
|
196
|
+
### drawPipeNeonOutline
|
|
197
|
+
|
|
198
|
+
`(context: CanvasRenderingContext2D, rectangleLeftPx: number, rectangleTopPx: number, rectangleWidthPx: number, rectangleHeightPx: number) => void`
|
|
199
|
+
|
|
200
|
+
Draws a simplified neon outline around a pipe rectangle.
|
|
201
|
+
|
|
202
|
+
Parameters:
|
|
203
|
+
- `context` - - Canvas 2D context.
|
|
204
|
+
- `rectangleLeftPx` - - Rectangle left position.
|
|
205
|
+
- `rectangleTopPx` - - Rectangle top position.
|
|
206
|
+
- `rectangleWidthPx` - - Rectangle width.
|
|
207
|
+
- `rectangleHeightPx` - - Rectangle height.
|
|
208
|
+
|
|
209
|
+
Returns: Nothing.
|
|
210
|
+
|
|
211
|
+
## browser-entry/playback/playback.session.services.ts
|
|
212
|
+
|
|
213
|
+
### createInitialPlaybackLoopState
|
|
214
|
+
|
|
215
|
+
`() => import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackLoopState`
|
|
216
|
+
|
|
217
|
+
Creates the mutable loop state used while processing playback steps.
|
|
218
|
+
|
|
219
|
+
This is the browser's running notebook for one episode: budget, completion
|
|
220
|
+
flag, and the latest known aggregate outcome metrics.
|
|
221
|
+
|
|
222
|
+
Returns: Initialized loop state and aggregate summary values.
|
|
223
|
+
|
|
224
|
+
### createInitialRenderState
|
|
225
|
+
|
|
226
|
+
`(viewportDimensions: { visibleWorldWidthPx: number; visibleWorldHeightPx: number; }) => import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").PopulationRenderState`
|
|
227
|
+
|
|
228
|
+
Creates the initial render state used before the first worker snapshot.
|
|
229
|
+
|
|
230
|
+
The browser starts from an empty-but-shaped render state so rendering helpers
|
|
231
|
+
can assume the object graph exists even before the worker has emitted any
|
|
232
|
+
population geometry.
|
|
233
|
+
|
|
234
|
+
Parameters:
|
|
235
|
+
- `viewportDimensions` - - Current visible world dimensions.
|
|
236
|
+
|
|
237
|
+
Returns: Initialized population render state.
|
|
238
|
+
|
|
239
|
+
### createInitialTrailState
|
|
240
|
+
|
|
241
|
+
`() => import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").TrailState`
|
|
242
|
+
|
|
243
|
+
Creates the initial trail state used before any snapshots have been applied.
|
|
244
|
+
|
|
245
|
+
Trails are purely visual history, so they begin empty and accumulate only as
|
|
246
|
+
playback frames are observed.
|
|
247
|
+
|
|
248
|
+
Returns: Empty trail state for all birds.
|
|
249
|
+
|
|
250
|
+
### initializePlaybackSessionContext
|
|
251
|
+
|
|
252
|
+
`(canvas: HTMLCanvasElement, evolutionWorker: Worker) => import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackSessionContext`
|
|
253
|
+
|
|
254
|
+
Initializes worker playback and local state mirrors for one episode.
|
|
255
|
+
|
|
256
|
+
This is the point where the browser and worker agree on a fresh episode. The
|
|
257
|
+
browser sends the initial viewport dimensions to the worker, then builds the
|
|
258
|
+
local render and summary mirrors that will be updated as snapshots arrive.
|
|
259
|
+
|
|
260
|
+
Parameters:
|
|
261
|
+
- `canvas` - - Target playback canvas.
|
|
262
|
+
- `evolutionWorker` - - Worker owning playback simulation state.
|
|
263
|
+
|
|
264
|
+
Returns: Session context shared across the playback loop.
|
|
265
|
+
|
|
266
|
+
### resolvePlaybackEpisodeSummary
|
|
267
|
+
|
|
268
|
+
`(summary: import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackMutableSummary) => import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackEpisodeSummary`
|
|
269
|
+
|
|
270
|
+
Folds the mutable loop summary into the public playback summary shape.
|
|
271
|
+
|
|
272
|
+
The public summary is intentionally smaller than the internal loop state. It
|
|
273
|
+
exposes the outcome, not the browser's intermediate bookkeeping.
|
|
274
|
+
|
|
275
|
+
Parameters:
|
|
276
|
+
- `summary` - - Mutable loop summary accumulated during playback.
|
|
277
|
+
|
|
278
|
+
Returns: Public playback episode summary.
|
|
279
|
+
|
|
280
|
+
### resolvePlaybackViewportDimensions
|
|
281
|
+
|
|
282
|
+
`(canvas: HTMLCanvasElement) => { visibleWorldWidthPx: number; visibleWorldHeightPx: number; }`
|
|
283
|
+
|
|
284
|
+
Session initialization and summary-folding helpers for playback.
|
|
285
|
+
|
|
286
|
+
These services answer three orchestration questions:
|
|
287
|
+
1. What viewport is the browser currently showing?
|
|
288
|
+
2. What local mirror state should exist before the first worker snapshot?
|
|
289
|
+
3. How should mutable loop state be folded back into a public summary?
|
|
290
|
+
|
|
291
|
+
### syncPlaybackViewportDimensions
|
|
292
|
+
|
|
293
|
+
`(canvas: HTMLCanvasElement, renderState: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").PopulationRenderState) => void`
|
|
294
|
+
|
|
295
|
+
Synchronizes the render state viewport fields with the current canvas size.
|
|
296
|
+
|
|
297
|
+
Playback can continue while the canvas size changes, so the browser refreshes
|
|
298
|
+
its local viewport mirror rather than assuming dimensions stay fixed.
|
|
299
|
+
|
|
300
|
+
Parameters:
|
|
301
|
+
- `canvas` - - Target playback canvas.
|
|
302
|
+
- `renderState` - - Mutable render state updated in place.
|
|
303
|
+
|
|
304
|
+
Returns: Nothing.
|
|
305
|
+
|
|
306
|
+
## browser-entry/playback/playback.starfield.service.ts
|
|
307
|
+
|
|
308
|
+
### resolveStarfieldTiles
|
|
309
|
+
|
|
310
|
+
`(visibleWorldHeightPx: number) => readonly import("test/examples/flappy_bird/browser-entry/playback/playback.starfield.types").StarTile[]`
|
|
311
|
+
|
|
312
|
+
Resolves (and lazily creates) cached starfield tile layers for the viewport.
|
|
313
|
+
|
|
314
|
+
Parameters:
|
|
315
|
+
- `visibleWorldHeightPx` - - Viewport height in world pixels.
|
|
316
|
+
|
|
317
|
+
Returns: Ordered far/mid/near starfield tiles.
|
|
318
|
+
|
|
319
|
+
## browser-entry/playback/playback.iteration.services.ts
|
|
320
|
+
|
|
321
|
+
### applyPlaybackStepSnapshot
|
|
322
|
+
|
|
323
|
+
`(sessionContext: import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackSessionContext, snapshot: import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").EvolutionPlaybackStepSnapshot) => void`
|
|
324
|
+
|
|
325
|
+
Applies the latest worker snapshot to render state and trail caches.
|
|
326
|
+
|
|
327
|
+
Parameters:
|
|
328
|
+
- `sessionContext` - - Shared mutable playback session state.
|
|
329
|
+
- `snapshot` - - Worker snapshot for the current playback batch.
|
|
330
|
+
|
|
331
|
+
Returns: Nothing.
|
|
332
|
+
|
|
333
|
+
### emitPlaybackFrameStats
|
|
334
|
+
|
|
335
|
+
`(iterationContext: import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackIterationContext, playbackStepPayload: { requestId: number; snapshot: import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").EvolutionPlaybackStepSnapshot; instrumentation?: { activationCallsPerFrame: number; simulationStepsPerRaf: number; } | undefined; done: boolean; averagePipesPassed?: number | undefined; p90FramesSurvived?: number | undefined; winnerPipesPassed?: number | undefined; winnerFramesSurvived?: number | undefined; }) => void`
|
|
336
|
+
|
|
337
|
+
Resolves leader telemetry and emits the public frame-stats callback.
|
|
338
|
+
|
|
339
|
+
Parameters:
|
|
340
|
+
- `iterationContext` - - Shared loop dependencies and mutable playback state.
|
|
341
|
+
- `playbackStepPayload` - - Worker playback result for the current iteration.
|
|
342
|
+
|
|
343
|
+
Returns: Nothing.
|
|
344
|
+
|
|
345
|
+
### requestPlaybackStepPayload
|
|
346
|
+
|
|
347
|
+
`(iterationContext: import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackIterationContext) => Promise<{ requestId: number; snapshot: import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").EvolutionPlaybackStepSnapshot; instrumentation?: { activationCallsPerFrame: number; simulationStepsPerRaf: number; } | undefined; done: boolean; averagePipesPassed?: number | undefined; p90FramesSurvived?: number | undefined; winnerPipesPassed?: number | undefined; winnerFramesSurvived?: number | undefined; }>`
|
|
348
|
+
|
|
349
|
+
Requests one playback step batch from the evolution worker.
|
|
350
|
+
|
|
351
|
+
Parameters:
|
|
352
|
+
- `iterationContext` - - Shared loop dependencies and mutable playback state.
|
|
353
|
+
|
|
354
|
+
Returns: Worker playback step payload for the current iteration.
|
|
355
|
+
|
|
356
|
+
### runPlaybackIteration
|
|
357
|
+
|
|
358
|
+
`(iterationContext: import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackIterationContext) => Promise<void>`
|
|
359
|
+
|
|
360
|
+
Executes one playback iteration from viewport sync through render pacing.
|
|
361
|
+
|
|
362
|
+
Parameters:
|
|
363
|
+
- `iterationContext` - - Shared loop dependencies and mutable playback state.
|
|
364
|
+
|
|
365
|
+
Returns: Nothing.
|
|
366
|
+
|
|
367
|
+
### runPlaybackLoop
|
|
368
|
+
|
|
369
|
+
`(iterationContext: import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackIterationContext) => Promise<void>`
|
|
370
|
+
|
|
371
|
+
Runs playback iterations until the worker reports that the episode is done.
|
|
372
|
+
|
|
373
|
+
Parameters:
|
|
374
|
+
- `iterationContext` - - Shared loop dependencies and mutable playback state.
|
|
375
|
+
|
|
376
|
+
Returns: Nothing.
|
|
377
|
+
|
|
378
|
+
### updatePlaybackLoopCompletion
|
|
379
|
+
|
|
380
|
+
`(loopState: import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackLoopState, playbackStepPayload: { requestId: number; snapshot: import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").EvolutionPlaybackStepSnapshot; instrumentation?: { activationCallsPerFrame: number; simulationStepsPerRaf: number; } | undefined; done: boolean; averagePipesPassed?: number | undefined; p90FramesSurvived?: number | undefined; winnerPipesPassed?: number | undefined; winnerFramesSurvived?: number | undefined; }) => void`
|
|
381
|
+
|
|
382
|
+
Updates the loop summary when the worker reports playback completion.
|
|
383
|
+
|
|
384
|
+
Parameters:
|
|
385
|
+
- `loopState` - - Mutable playback loop state.
|
|
386
|
+
- `playbackStepPayload` - - Worker playback result for the current iteration.
|
|
387
|
+
|
|
388
|
+
Returns: Nothing.
|
|
389
|
+
|
|
390
|
+
## browser-entry/playback/playback.starfield.services.ts
|
|
391
|
+
|
|
392
|
+
### createCanvasSizeFallback
|
|
393
|
+
|
|
394
|
+
`(canvasDimensions: import("test/examples/flappy_bird/browser-entry/playback/playback.starfield.types").StarfieldCanvasDimensions) => HTMLCanvasElement`
|
|
395
|
+
|
|
396
|
+
Creates a size-only fallback so non-browser tests can skip rendering safely.
|
|
397
|
+
|
|
398
|
+
Parameters:
|
|
399
|
+
- `canvasDimensions` - - Already-normalized pixel dimensions.
|
|
400
|
+
|
|
401
|
+
Returns: Minimal canvas-shaped object cast to the compatible return type.
|
|
402
|
+
|
|
403
|
+
### createCompatibleCanvas
|
|
404
|
+
|
|
405
|
+
`(widthPx: number, heightPx: number) => HTMLCanvasElement | OffscreenCanvas`
|
|
406
|
+
|
|
407
|
+
Creates a browser-compatible canvas with clamped integer dimensions.
|
|
408
|
+
|
|
409
|
+
Parameters:
|
|
410
|
+
- `widthPx` - - Requested tile width in pixels.
|
|
411
|
+
- `heightPx` - - Requested tile height in pixels.
|
|
412
|
+
|
|
413
|
+
Returns: Offscreen canvas when supported, otherwise a DOM canvas fallback.
|
|
414
|
+
|
|
415
|
+
### createDocumentCanvasIfSupported
|
|
416
|
+
|
|
417
|
+
`(canvasDimensions: import("test/examples/flappy_bird/browser-entry/playback/playback.starfield.types").StarfieldCanvasDimensions) => HTMLCanvasElement | null`
|
|
418
|
+
|
|
419
|
+
Creates a DOM canvas when document APIs are available.
|
|
420
|
+
|
|
421
|
+
Parameters:
|
|
422
|
+
- `canvasDimensions` - - Already-normalized pixel dimensions.
|
|
423
|
+
|
|
424
|
+
Returns: DOM canvas instance or `null` when unavailable.
|
|
425
|
+
|
|
426
|
+
### createOffscreenCanvasIfSupported
|
|
427
|
+
|
|
428
|
+
`(canvasDimensions: import("test/examples/flappy_bird/browser-entry/playback/playback.starfield.types").StarfieldCanvasDimensions) => OffscreenCanvas | null`
|
|
429
|
+
|
|
430
|
+
Creates an offscreen canvas when the current runtime supports it.
|
|
431
|
+
|
|
432
|
+
Parameters:
|
|
433
|
+
- `canvasDimensions` - - Already-normalized pixel dimensions.
|
|
434
|
+
|
|
435
|
+
Returns: Offscreen canvas instance or `null` when unavailable.
|
|
436
|
+
|
|
437
|
+
### createStarTileCanvas
|
|
438
|
+
|
|
439
|
+
`(options: import("test/examples/flappy_bird/browser-entry/playback/playback.starfield.types").CreateStarTileCanvasOptions) => import("test/examples/flappy_bird/browser-entry/playback/playback.starfield.types").StarTileImage`
|
|
440
|
+
|
|
441
|
+
Pre-renders a deterministic tile that can be reused across animation frames.
|
|
442
|
+
|
|
443
|
+
Parameters:
|
|
444
|
+
- `options` - - Declarative drawing recipe for one parallax layer.
|
|
445
|
+
|
|
446
|
+
Returns: Canvas image source containing the rendered star strip.
|
|
447
|
+
|
|
448
|
+
### initializeStarTileContext
|
|
449
|
+
|
|
450
|
+
`(options: { tileContext: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D; canvas: HTMLCanvasElement | OffscreenCanvas; }) => void`
|
|
451
|
+
|
|
452
|
+
Clears the canvas and applies the neutral settings shared by all rendered stars.
|
|
453
|
+
|
|
454
|
+
Parameters:
|
|
455
|
+
- `options` - - Context initialization dependencies.
|
|
456
|
+
|
|
457
|
+
Returns: Nothing. The provided context is mutated in place.
|
|
458
|
+
|
|
459
|
+
### normalizeCanvasDimensions
|
|
460
|
+
|
|
461
|
+
`(widthPx: number, heightPx: number) => import("test/examples/flappy_bird/browser-entry/playback/playback.starfield.types").StarfieldCanvasDimensions`
|
|
462
|
+
|
|
463
|
+
Normalizes requested canvas dimensions into positive integer pixel sizes.
|
|
464
|
+
|
|
465
|
+
Parameters:
|
|
466
|
+
- `widthPx` - - Requested width in pixels.
|
|
467
|
+
- `heightPx` - - Requested height in pixels.
|
|
468
|
+
|
|
469
|
+
Returns: Clamped integer dimensions safe for canvas allocation.
|
|
470
|
+
|
|
471
|
+
### renderSeededStars
|
|
472
|
+
|
|
473
|
+
`(options: { tileContext: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D; seededRandom: () => number; canvasOptions: import("test/examples/flappy_bird/browser-entry/playback/playback.starfield.types").CreateStarTileCanvasOptions; }) => void`
|
|
474
|
+
|
|
475
|
+
Draws all stars for one tile using a seeded random source.
|
|
476
|
+
|
|
477
|
+
Parameters:
|
|
478
|
+
- `options` - - Drawing context, seed source, and tile recipe.
|
|
479
|
+
|
|
480
|
+
Returns: Nothing. The provided context is mutated in place.
|
|
481
|
+
|
|
482
|
+
### resetStarTileContext
|
|
483
|
+
|
|
484
|
+
`(tileContext: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D) => void`
|
|
485
|
+
|
|
486
|
+
Restores neutral drawing state so later canvas consumers start from defaults.
|
|
487
|
+
|
|
488
|
+
Parameters:
|
|
489
|
+
- `tileContext` - - 2D context used to render the star tile.
|
|
490
|
+
|
|
491
|
+
Returns: Nothing. The provided context is mutated in place.
|
|
492
|
+
|
|
493
|
+
### resolveStarPlacement
|
|
494
|
+
|
|
495
|
+
`(options: { seededRandom: () => number; tileWidthPx: number; tileHeightPx: number; minSizePx: number; maxSizePx: number; minAlpha: number; maxAlpha: number; }) => import("test/examples/flappy_bird/browser-entry/playback/playback.starfield.types").StarPlacement`
|
|
496
|
+
|
|
497
|
+
Resolves one deterministic star placement and appearance from the seeded RNG.
|
|
498
|
+
|
|
499
|
+
Parameters:
|
|
500
|
+
- `options` - - Random source and star placement bounds.
|
|
501
|
+
|
|
502
|
+
Returns: Pixel location, square size, and alpha for one rendered star.
|
|
503
|
+
|
|
504
|
+
### resolveStarTileContext
|
|
505
|
+
|
|
506
|
+
`(canvas: HTMLCanvasElement | OffscreenCanvas) => CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D | null`
|
|
507
|
+
|
|
508
|
+
Resolves the rendering context used for star tile pre-rendering.
|
|
509
|
+
|
|
510
|
+
Parameters:
|
|
511
|
+
- `canvas` - - Compatible canvas returned by the runtime-specific factory.
|
|
512
|
+
|
|
513
|
+
Returns: A 2D drawing context when rendering is supported.
|
|
514
|
+
|
|
515
|
+
## browser-entry/playback/playback.frame-render.service.ts
|
|
516
|
+
|
|
517
|
+
### playback.frame-render.service
|
|
518
|
+
|
|
519
|
+
Compatibility facade for playback frame rendering.
|
|
520
|
+
|
|
521
|
+
Older imports still reach the frame renderer through this file while the
|
|
522
|
+
implementation now lives in the dedicated frame-render folder.
|
|
523
|
+
|
|
524
|
+
### renderPopulationFrame
|
|
525
|
+
|
|
526
|
+
`(context: CanvasRenderingContext2D, renderState: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").PopulationRenderState, trailState: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").TrailState) => void`
|
|
527
|
+
|
|
528
|
+
High-level frame-render orchestration for playback.
|
|
529
|
+
|
|
530
|
+
This boundary coordinates one visual frame of the playback experience. It
|
|
531
|
+
resolves the scene, prepares the canvas, paints the background and entities,
|
|
532
|
+
and maintains the short champion trail used for motion emphasis.
|
|
533
|
+
|
|
534
|
+
### updateTrailState
|
|
535
|
+
|
|
536
|
+
`(trailState: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").TrailState, renderState: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").PopulationRenderState) => void`
|
|
537
|
+
|
|
538
|
+
Updates the trail cache from the latest frame snapshot.
|
|
539
|
+
|
|
540
|
+
The renderer intentionally keeps only a short champion trail instead of full
|
|
541
|
+
history for every bird, which keeps the visual emphasis clear and the per-frame
|
|
542
|
+
work small.
|
|
543
|
+
|
|
544
|
+
Parameters:
|
|
545
|
+
- `trailState` - - Mutable trail state.
|
|
546
|
+
- `renderState` - - Current render state.
|
|
547
|
+
|
|
548
|
+
Returns: Nothing.
|
|
549
|
+
|
|
550
|
+
## browser-entry/playback/playback.starfield.layer.services.ts
|
|
551
|
+
|
|
552
|
+
### createStarTile
|
|
553
|
+
|
|
554
|
+
`(layerSpec: import("test/examples/flappy_bird/browser-entry/playback/playback.starfield.types").PlaybackStarfieldLayerSpec, tileHeightPx: number) => import("test/examples/flappy_bird/browser-entry/playback/playback.starfield.types").StarTile`
|
|
555
|
+
|
|
556
|
+
Creates one cached tile layer from a declarative layer specification.
|
|
557
|
+
|
|
558
|
+
Parameters:
|
|
559
|
+
- `layerSpec` - - Density and motion contract for a starfield layer.
|
|
560
|
+
- `tileHeightPx` - - Height of the visible sky band in pixels.
|
|
561
|
+
|
|
562
|
+
Returns: Cached tile metadata for parallax drawing.
|
|
563
|
+
|
|
564
|
+
## browser-entry/playback/playback.render.pipe-outline.service.ts
|
|
565
|
+
|
|
566
|
+
### drawPipeNeonOutline
|
|
567
|
+
|
|
568
|
+
`(context: CanvasRenderingContext2D, rectangleLeftPx: number, rectangleTopPx: number, rectangleWidthPx: number, rectangleHeightPx: number) => void`
|
|
569
|
+
|
|
570
|
+
Draws a simplified neon outline around a pipe rectangle.
|
|
571
|
+
|
|
572
|
+
Parameters:
|
|
573
|
+
- `context` - - Canvas 2D context.
|
|
574
|
+
- `rectangleLeftPx` - - Rectangle left position.
|
|
575
|
+
- `rectangleTopPx` - - Rectangle top position.
|
|
576
|
+
- `rectangleWidthPx` - - Rectangle width.
|
|
577
|
+
- `rectangleHeightPx` - - Rectangle height.
|
|
578
|
+
|
|
579
|
+
Returns: Nothing.
|
|
580
|
+
|
|
581
|
+
### resolveAlignedPipeOutlineRectangle
|
|
582
|
+
|
|
583
|
+
`(input: { rectangleLeftPx: number; rectangleTopPx: number; rectangleWidthPx: number; rectangleHeightPx: number; }) => { alignedLeftPx: number; alignedTopPx: number; alignedWidthPx: number; alignedHeightPx: number; }`
|
|
584
|
+
|
|
585
|
+
Resolves a pixel-aligned rectangle used by the pipe outline renderer.
|
|
586
|
+
|
|
587
|
+
Parameters:
|
|
588
|
+
- `input` - - Raw pipe rectangle values.
|
|
589
|
+
|
|
590
|
+
Returns: Aligned rectangle ready for outline rendering.
|
|
591
|
+
|
|
592
|
+
### resolvePipeOutlinePath
|
|
593
|
+
|
|
594
|
+
`(alignedRectangle: { alignedLeftPx: number; alignedTopPx: number; alignedWidthPx: number; alignedHeightPx: number; }) => Path2D`
|
|
595
|
+
|
|
596
|
+
Resolves the reusable outline path for one pipe body and its entrance rim.
|
|
597
|
+
|
|
598
|
+
Parameters:
|
|
599
|
+
- `alignedRectangle` - - Pixel-aligned rectangle used by the outline renderer.
|
|
600
|
+
|
|
601
|
+
Returns: Path containing the outer pipe outline and optional entrance rim.
|
|
602
|
+
|
|
603
|
+
## browser-entry/playback/playback.trail.utils.ts
|
|
604
|
+
|
|
605
|
+
### clamp01
|
|
606
|
+
|
|
607
|
+
`(value: number) => number`
|
|
608
|
+
|
|
609
|
+
Clamps a number to the inclusive [0, 1] range.
|
|
610
|
+
|
|
611
|
+
The trail renderer combines several normalized fade factors, so keeping this
|
|
612
|
+
utility local to the module makes the intent obvious: every opacity channel
|
|
613
|
+
must remain safe for direct canvas alpha use.
|
|
614
|
+
|
|
615
|
+
Parameters:
|
|
616
|
+
- `value` - - Candidate value.
|
|
617
|
+
|
|
618
|
+
Returns: Clamped value.
|
|
619
|
+
|
|
620
|
+
### pushChampionTrailPoint
|
|
621
|
+
|
|
622
|
+
`(trailPoints: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").TrailPoint[], frameIndex: number, yPosition: number) => void`
|
|
623
|
+
|
|
624
|
+
Appends one point to the champion-only short trail history.
|
|
625
|
+
|
|
626
|
+
The browser highlights the current leader with a shorter, denser trail than
|
|
627
|
+
the rest of the flock. Using a dedicated helper keeps that policy explicit in
|
|
628
|
+
the call site instead of scattering champion-specific retention numbers
|
|
629
|
+
through the playback renderer.
|
|
630
|
+
|
|
631
|
+
Parameters:
|
|
632
|
+
- `trailPoints` - - Mutable champion trail collection.
|
|
633
|
+
- `frameIndex` - - Source frame index.
|
|
634
|
+
- `yPosition` - - Bird y position.
|
|
635
|
+
|
|
636
|
+
Returns: Nothing.
|
|
637
|
+
|
|
638
|
+
### pushTrailPoint
|
|
639
|
+
|
|
640
|
+
`(trailPoints: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").TrailPoint[], frameIndex: number, yPosition: number, maxRetainedPoints: number) => void`
|
|
641
|
+
|
|
642
|
+
Appends one trail point while enforcing the maximum retained history length.
|
|
643
|
+
|
|
644
|
+
Playback trails are intentionally modeled as short rolling histories rather
|
|
645
|
+
than unbounded path logs. That keeps the neon afterimage readable, prevents
|
|
646
|
+
old turns from dominating the current frame, and avoids per-frame growth in a
|
|
647
|
+
long-running browser session.
|
|
648
|
+
|
|
649
|
+
Parameters:
|
|
650
|
+
- `trailPoints` - - Mutable trail collection.
|
|
651
|
+
- `frameIndex` - - Source frame index.
|
|
652
|
+
- `yPosition` - - Bird y position.
|
|
653
|
+
- `maxRetainedPoints` - - Optional maximum retained trail history length.
|
|
654
|
+
|
|
655
|
+
Returns: Nothing.
|
|
656
|
+
|
|
657
|
+
### resolveEdgeOpacityFactor
|
|
658
|
+
|
|
659
|
+
`(pointXPx: number, pointYPx: number, edgeBounds: import("test/examples/flappy_bird/browser-entry/playback/playback.types").PlaybackEdgeBounds) => number`
|
|
660
|
+
|
|
661
|
+
Converts distance-to-edge into a normalized opacity factor.
|
|
662
|
+
|
|
663
|
+
Trail points fade as they approach the viewport border so the rendered path
|
|
664
|
+
feels cropped by the camera instead of abruptly chopped off. This mirrors the
|
|
665
|
+
common animation principle of easing visual intensity near a frame boundary.
|
|
666
|
+
|
|
667
|
+
Returns 0 exactly on or beyond an edge and rises to 1 once distance exceeds
|
|
668
|
+
the configured fade band.
|
|
669
|
+
|
|
670
|
+
Parameters:
|
|
671
|
+
- `pointXPx` - - Point x position.
|
|
672
|
+
- `pointYPx` - - Point y position.
|
|
673
|
+
- `edgeBounds` - - Visible world bounds used for edge distance checks.
|
|
674
|
+
|
|
675
|
+
Returns: Opacity multiplier in [0, 1].
|
|
676
|
+
|
|
677
|
+
### resolveTrailLifetimeOpacityFactor
|
|
678
|
+
|
|
679
|
+
`(frameOffset: number, maxTrailFrameOffset: number) => number`
|
|
680
|
+
|
|
681
|
+
Converts trail age into a normalized opacity factor.
|
|
682
|
+
|
|
683
|
+
This helper implements the other half of the afterimage effect: recent trail
|
|
684
|
+
samples should read as energetic and bright, while older samples should fade
|
|
685
|
+
away smoothly so the viewer's eye stays anchored to the current flock motion.
|
|
686
|
+
|
|
687
|
+
Oldest retained history approaches 0 opacity; newest approaches 1.
|
|
688
|
+
|
|
689
|
+
Parameters:
|
|
690
|
+
- `frameOffset` - - Frames between this point and newest trail point.
|
|
691
|
+
- `maxTrailFrameOffset` - - Oldest age offset currently retained by trail.
|
|
692
|
+
|
|
693
|
+
Returns: Opacity multiplier in [0, 1].
|
|
694
|
+
|
|
695
|
+
## browser-entry/playback/playback.render.utils.ts
|
|
696
|
+
|
|
697
|
+
### PlaybackBirdRenderStyle
|
|
698
|
+
|
|
699
|
+
Pure render-style result for one bird body draw pass.
|
|
700
|
+
|
|
701
|
+
### resolveBirdRenderStyle
|
|
702
|
+
|
|
703
|
+
`(birdIndex: number, championBirdIndex: number) => import("test/examples/flappy_bird/browser-entry/playback/playback.render.utils").PlaybackBirdRenderStyle`
|
|
704
|
+
|
|
705
|
+
Resolves opacity, body color, and champion marker for one bird.
|
|
706
|
+
|
|
707
|
+
Parameters:
|
|
708
|
+
- `birdIndex` - - Index of the bird currently being rendered.
|
|
709
|
+
- `championBirdIndex` - - Resolved champion index for the frame.
|
|
710
|
+
|
|
711
|
+
Returns: Pure style payload used by the render service.
|
|
712
|
+
|
|
713
|
+
### resolveChampionBirdIndex
|
|
714
|
+
|
|
715
|
+
`(renderState: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").PopulationRenderState) => number`
|
|
716
|
+
|
|
717
|
+
Resolves the champion bird index for the current render frame.
|
|
718
|
+
|
|
719
|
+
Champion selection first prefers the primary winner resolver and then
|
|
720
|
+
falls back to the first alive bird when no winner index is available.
|
|
721
|
+
|
|
722
|
+
Parameters:
|
|
723
|
+
- `renderState` - - Current frame render snapshot.
|
|
724
|
+
|
|
725
|
+
Returns: Champion index or `-1` when no bird is alive.
|
|
726
|
+
|
|
727
|
+
## browser-entry/playback/playback.snapshot.utils.ts
|
|
728
|
+
|
|
729
|
+
### playback.snapshot.utils
|
|
730
|
+
|
|
731
|
+
Compatibility facade for playback snapshot helpers.
|
|
732
|
+
|
|
733
|
+
Legacy imports still reach snapshot synchronization through this file while
|
|
734
|
+
the implementation now lives in the dedicated snapshot folder.
|
|
735
|
+
|
|
736
|
+
### applyPlaybackSnapshot
|
|
737
|
+
|
|
738
|
+
`(renderState: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").PopulationRenderState, snapshot: import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").EvolutionPlaybackStepSnapshot) => void`
|
|
739
|
+
|
|
740
|
+
Snapshot synchronization helpers for playback.
|
|
741
|
+
|
|
742
|
+
The worker streams packed typed-array snapshots, while the browser renderer
|
|
743
|
+
wants stable mutable arrays of pipes and birds. This module performs that
|
|
744
|
+
translation in place so playback can stay fast and allocation-light.
|
|
745
|
+
|
|
746
|
+
### resolveLeaderFramesSurvived
|
|
747
|
+
|
|
748
|
+
`(renderState: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").PopulationRenderState) => number`
|
|
749
|
+
|
|
750
|
+
Small summary helpers derived from hydrated playback render state.
|
|
751
|
+
|
|
752
|
+
Once a packed snapshot has been synchronized into the browser render state,
|
|
753
|
+
these helpers compute simple aggregate values needed by the HUD and playback
|
|
754
|
+
reporting flow.
|
|
755
|
+
|
|
756
|
+
## browser-entry/playback/playback.starfield.utils.ts
|
|
757
|
+
|
|
758
|
+
### createSeededRandom
|
|
759
|
+
|
|
760
|
+
`(seed: number) => () => number`
|
|
761
|
+
|
|
762
|
+
Creates a deterministic pseudo-random generator for starfield tile layouts.
|
|
763
|
+
|
|
764
|
+
Parameters:
|
|
765
|
+
- `seed` - - Unsigned integer seed.
|
|
766
|
+
|
|
767
|
+
Returns: Function that yields values in the range [0, 1).
|
|
768
|
+
|
|
769
|
+
### positiveModulo
|
|
770
|
+
|
|
771
|
+
`(value: number, modulo: number) => number`
|
|
772
|
+
|
|
773
|
+
Resolves positive modulo suitable for horizontal tiling offsets.
|
|
774
|
+
|
|
775
|
+
Parameters:
|
|
776
|
+
- `value` - - Input value to wrap.
|
|
777
|
+
- `modulo` - - Modulus base.
|
|
778
|
+
|
|
779
|
+
Returns: Wrapped value in [0, modulo).
|
|
780
|
+
|
|
781
|
+
## browser-entry/playback/playback.worker-channel.utils.ts
|
|
782
|
+
|
|
783
|
+
### PlaybackStepPayload
|
|
784
|
+
|
|
785
|
+
Shared alias for the worker playback-step payload.
|
|
786
|
+
|
|
787
|
+
This keeps the playback worker-channel modules focused on playback semantics
|
|
788
|
+
instead of long imported protocol names.
|
|
789
|
+
|
|
790
|
+
### PlaybackStepRequest
|
|
791
|
+
|
|
792
|
+
Playback-specific worker-channel contracts.
|
|
793
|
+
|
|
794
|
+
These types sit above the lower-level browser worker protocol and describe the
|
|
795
|
+
request budgeting plus summary data flow used by the playback loop.
|
|
796
|
+
|
|
797
|
+
### resolvePlaybackCompletionSummary
|
|
798
|
+
|
|
799
|
+
`(playbackStepPayload: { requestId: number; snapshot: import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").EvolutionPlaybackStepSnapshot; instrumentation?: { activationCallsPerFrame: number; simulationStepsPerRaf: number; } | undefined; done: boolean; averagePipesPassed?: number | undefined; p90FramesSurvived?: number | undefined; winnerPipesPassed?: number | undefined; winnerFramesSurvived?: number | undefined; }, latestLeaderPipesPassed: number, latestLeaderFramesSurvived: number) => { averagePipesPassed: number; p90FramesSurvived: number; winnerPipesPassed: number; winnerFramesSurvived: number; }`
|
|
800
|
+
|
|
801
|
+
Resolves final playback summary values when the worker reports completion.
|
|
802
|
+
|
|
803
|
+
Some end-of-episode aggregates may be omitted from the worker payload, so the
|
|
804
|
+
browser falls back to the latest leader values it has already observed during
|
|
805
|
+
playback.
|
|
806
|
+
|
|
807
|
+
Parameters:
|
|
808
|
+
- `playbackStepPayload` - - Playback payload returned by worker.
|
|
809
|
+
- `latestLeaderPipesPassed` - - Last observed leader pipes passed fallback.
|
|
810
|
+
- `latestLeaderFramesSurvived` - - Last observed leader frames fallback.
|
|
811
|
+
|
|
812
|
+
Returns: Final aggregate playback summary.
|
|
813
|
+
|
|
814
|
+
### resolvePlaybackFrameStats
|
|
815
|
+
|
|
816
|
+
`(playbackStepPayload: { requestId: number; snapshot: import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").EvolutionPlaybackStepSnapshot; instrumentation?: { activationCallsPerFrame: number; simulationStepsPerRaf: number; } | undefined; done: boolean; averagePipesPassed?: number | undefined; p90FramesSurvived?: number | undefined; winnerPipesPassed?: number | undefined; winnerFramesSurvived?: number | undefined; }, frameIndex: number, activeBirdCount: number, leaderPipesPassed: number, leaderFramesSurvived: number) => import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").PlaybackFrameStats`
|
|
817
|
+
|
|
818
|
+
Summary and HUD helpers for playback worker-channel results.
|
|
819
|
+
|
|
820
|
+
Once the worker replies with a playback-step payload, these helpers turn that
|
|
821
|
+
raw protocol data into the browser-facing telemetry and end-of-episode summary
|
|
822
|
+
values used elsewhere in the playback loop.
|
|
823
|
+
|
|
824
|
+
### resolvePlaybackStepRequest
|
|
825
|
+
|
|
826
|
+
`(input: import("test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.types").ResolvePlaybackStepRequestInput) => import("test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.types").ResolvePlaybackStepRequestResult`
|
|
827
|
+
|
|
828
|
+
Playback batch-request helpers for the browser worker channel.
|
|
829
|
+
|
|
830
|
+
The playback loop accumulates simulation budget in fractional units, then
|
|
831
|
+
converts that budget into integer worker step requests on each render tick.
|
|
832
|
+
|
|
833
|
+
### ResolvePlaybackStepRequestInput
|
|
834
|
+
|
|
835
|
+
Input used to resolve the next playback-step request and budget remainder.
|
|
836
|
+
|
|
837
|
+
Playback uses a fractional frame budget so browser render cadence and worker
|
|
838
|
+
simulation cadence can be smoothed together over time.
|
|
839
|
+
|
|
840
|
+
### ResolvePlaybackStepRequestResult
|
|
841
|
+
|
|
842
|
+
Output for the resolved playback-step request and frame-budget remainder.
|
|
843
|
+
|
|
844
|
+
The resolved request records both the integer step batch to send now and the
|
|
845
|
+
leftover fractional budget to carry into the next render tick.
|