From 7311aaef5a1a577b427ad38e16312fc7e1ad28c1 Mon Sep 17 00:00:00 2001 From: Davide Cappellini Date: Sat, 26 Sep 2026 01:38:51 +0200 Subject: [PATCH] movement j119 Task A: make the shipped TFIL heat shape env-overridable (default path byte-identical) --- ModularBot_garage/src/env_report.nim | 15 ++++++++-- common_libs/movements/the_floor_is_lava.nim | 32 +++++++++++++++++++-- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/ModularBot_garage/src/env_report.nim b/ModularBot_garage/src/env_report.nim index 486598a..4cd1873 100644 --- a/ModularBot_garage/src/env_report.nim +++ b/ModularBot_garage/src/env_report.nim @@ -247,13 +247,21 @@ proc printEffectiveValues(ctx: EnvReportContext) = emit("TR_POWER_FINISH_KILL", onOff(PowerFinishKill), sourceOf("TR_POWER_FINISH_KILL")) - # ── movement (TFIL ring) ────────────────────────────────────────────────── + # ── movement (TFIL heat shape + ring) ───────────────────────────────────── + # NOTE (j119): `TR_TFIL_CORRIDOR_HEAT` / `TR_TFIL_WALL_HOTNESS` drive BOTH + # movers now — the ring's own copies (reported here) AND the shipped base + # field (the_floor_is_lava, shipped defaults 20/30/10). The two modules export + # the same symbol names, so the reads below are module-qualified. emit("TR_TFIL_RANGE_LO", $RangeLo, sourceOf("TR_TFIL_RANGE_LO")) emit("TR_TFIL_RANGE_HI", $RangeHi, sourceOf("TR_TFIL_RANGE_HI")) emit("TR_TFIL_RANGE_TEMP", $RangeTemp, sourceOf("TR_TFIL_RANGE_TEMP")) emit("TR_TFIL_RANGE_K", $RangeK, sourceOf("TR_TFIL_RANGE_K")) - emit("TR_TFIL_CORRIDOR_HEAT", $CorridorHeat, sourceOf("TR_TFIL_CORRIDOR_HEAT")) - emit("TR_TFIL_WALL_HOTNESS", $WallHotness, sourceOf("TR_TFIL_WALL_HOTNESS")) + emit("TR_TFIL_CORRIDOR_HEAT", $the_floor_is_lava_ring.CorridorHeat, + sourceOf("TR_TFIL_CORRIDOR_HEAT")) + emit("TR_TFIL_WALL_HOTNESS", $the_floor_is_lava_ring.WallHotness, + sourceOf("TR_TFIL_WALL_HOTNESS")) + emit("TR_TFIL_WALL_RADIANCE", $the_floor_is_lava.WallRadiance, + sourceOf("TR_TFIL_WALL_RADIANCE")) emit("TR_TFIL_TILE_REPLAN", tileReplanName(TfilTileReplanMode), sourceOf("TR_TFIL_TILE_REPLAN")) emit("TR_TFIL_COMMIT_TICKS", $TfilCommitTicks, sourceOf("TR_TFIL_COMMIT_TICKS")) @@ -449,6 +457,7 @@ proc knownEnvNames*(): seq[string] = "TR_RAM_PLAN_MARGIN", "TR_RAM_PLAN_HITRATE", "TR_RAM_LOG", "TR_TFIL_RANGE_LO", "TR_TFIL_RANGE_HI", "TR_TFIL_RANGE_TEMP", "TR_TFIL_RANGE_K", "TR_TFIL_CORRIDOR_HEAT", "TR_TFIL_WALL_HOTNESS", + "TR_TFIL_WALL_RADIANCE", "TR_TFIL_TILE_REPLAN", "TR_TFIL_COMMIT_TICKS", "TR_TFIL_NO_REV", "TR_TFIL_COMMIT_LOG", "TR_TFIL_HEAT_TIME", "TR_TFIL_HEAT_TAU", "TR_TFIL_HEAT_POWER_GAIN", diff --git a/common_libs/movements/the_floor_is_lava.nim b/common_libs/movements/the_floor_is_lava.nim index fdb62a2..482e4fb 100644 --- a/common_libs/movements/the_floor_is_lava.nim +++ b/common_libs/movements/the_floor_is_lava.nim @@ -26,10 +26,23 @@ const EnemyAuraRadius = 54.0 ## 18 + 36 const EnemyCore = 40.0 ## lava per tile overlapping enemy body circle const EnemyAura = 10.0 ## lava per tile in enemy aura ring -const CorridorHeat = 20.0 +## The shipped heat SHAPE, env-overridable since j119 (the same pattern j106 +## used for the virtual pillar). The DEFAULTS below are the shipped values, so +## the default path is unchanged; the vars are read once at module init by +## `loadTfilHeatShapeEnv`. This is what makes the heat axis sweepable on ONE +## frozen binary (before this it was a Nim `const`, so no env arm could move it). +## TR_TFIL_CORRIDOR_HEAT default 20.0 lava per corridor-overlapping tile +## TR_TFIL_WALL_HOTNESS default 30.0 peak wall radiance +## TR_TFIL_WALL_RADIANCE default 10.0 wall radiance falloff +const + DefaultCorridorHeat = 20.0 + DefaultWallHotness = 30.0 + DefaultWallRadiance = 10.0 -const WallHotness = 30.0 -const WallRadiance = 10.0 +var + CorridorHeat* = DefaultCorridorHeat + WallHotness* = DefaultWallHotness + WallRadiance* = DefaultWallRadiance ## The "virtual centre pillar": heat OUR code paints on the arena centre even ## though the arena has NO physical pillar there. The shipped default is now @@ -135,6 +148,19 @@ proc loadTfilPillarEnv*() = loadTfilPillarEnv() +proc loadTfilHeatShapeEnv*() = + ## Read the shipped-mover heat-shape overrides. Called once at module init; + ## callable again after `putEnv` so one process can A/B the fields. The + ## defaults reproduce the shipped `const`s exactly, so the default field is + ## bit-identical. The `TR_TFIL_CORRIDOR_HEAT` / `TR_TFIL_WALL_HOTNESS` names + ## are shared with the ring mover (which reads its own copies with its own + ## retuned defaults); `TR_TFIL_WALL_RADIANCE` is new here. + CorridorHeat = max(0.0, getEnvFloat("TR_TFIL_CORRIDOR_HEAT", DefaultCorridorHeat)) + WallHotness = max(0.0, getEnvFloat("TR_TFIL_WALL_HOTNESS", DefaultWallHotness)) + WallRadiance = max(0.0, getEnvFloat("TR_TFIL_WALL_RADIANCE", DefaultWallRadiance)) + +loadTfilHeatShapeEnv() + # ── Time-indexed bullet heat (TR_TFIL_HEAT_TIME=1, default OFF = shipped) ───── # # WHY: the flat model gives every bullet-overlapping tile the same heat and