#92: map the direct-fire hit->zone path; the FOOT is pickable over only 3% of a mech's height

Oracle, night 7: "Unable to damage the foot panels on Loki via direct fire from
front or side.  Was able to damage on Thor."

FIRST, THE MECHANISM -- it is not what the issue assumed (missing collision
geometry).  A direct-fire hit gets its zone one of two ways, decided at
Mech::TakeDamageMessageHandler by `invalidDamageZone`:

  AIMED   (invalidDamageZone=0): the zone rides in on the message from the
          per-part aim pick, MechSegmentPick (#73, btl4vid.cpp).
  UNAIMED (invalidDamageZone=1): DamageLookupTable::ResolveHit runs the authored
          cylinder lottery -- impact HEIGHT picks a layer, ANGLE picks a pie
          slice, and a weighted random roll picks the zone from that slice.

Measured live, both paths are in use: the Thor logged 16 unaimed hits
(invalidZone=1 zone=-1 -> ResolveHit) alongside aimed ones carrying real zones.

THE FINDING.  MechSegmentPick is a BOUNDING-SPHERE test whose primary key is
SMALLEST RADIUS WINS -- a larger sphere can never beat a smaller one the ray also
grazes.  The leg spheres, dumped in world space and IDENTICAL on both chassis:

    knee  centre y=1.868  r=1.505     spans y 0.364 .. 3.373
    toe   centre y=0.302  r=1.689     spans y -1.387 .. 1.991

The toe sphere is BIGGER than the knee's and they overlap heavily, so the toe can
only win where the ray misses the knee sphere outright -- i.e. below y=0.364.
Against a reference height of 11.16 that is a 0.36-unit window, **3.3% of the
mech's height**, and it sits right on the ground.  Everywhere else a shot at the
foot is credited to the LEG.  That is the reported symptom.

This is a PORT ARTIFACT, not authentic: btl4vid.cpp's own comment concedes the
sphere test approximates "the per-part semantic the 1995 mesh intersection
produced".  Real mesh intersection has no such interference -- aiming at the foot
mesh hits the foot.

NOT EXPLAINED, and stated plainly: the per-CHASSIS asymmetry.  Loki and Thor have
identical leg spheres, identical foot geometry (LOK_LFOT.BGF and THR_LFOT.BGF are
both 3082 bytes with the same token layout), and identical foot layers in their
damage tables (only the upper/cockpit layers differ).  So nothing found here says
the Loki should behave differently from the Thor.  The bench could not settle it
because BT_AIM moves the drawn RETICLE, not the pick ray -- there is currently no
harness to aim the pick at a chosen height.  That harness is the next step.

Diagnostics added:
  [pickgeom]   one-shot dump of every pick sphere in WORLD space (zone, r, centre)
  [pickcand]   which spheres a ray actually threaded, their perpendicular d, and
               which won -- the probe that makes "smallest wins" visible
  [dmgtable]   the whole authored DamageLookupTable: layers, slices, zone weights
  [dmgresolve] per hit: localY, heightRef, layer, theta, resolved zone
  [cylgate]    invalidDamageZone / table pointer / incoming zone at the gate
(the last three under BT_DMGTABLE_LOG, the first two under BT_PICK_LOG)
plus scratchpad/night8/footpick.sh.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joe DiPrima
2026-08-01 19:47:30 -05:00
co-authored by Claude Opus 5
parent 8daac37e40
commit 5a425320b7
5 changed files with 154 additions and 1 deletions
+54 -1
View File
@@ -211,6 +211,44 @@ DamageLookupTable::DamageLookupTable(
{
layers.push_back(new PieSlice(owner, stream));
}
// #92 -- "unable to damage the foot panels on Loki ... could on Thor".
// Direct-fire damage does NOT use the mesh or the aim pick: the impact's
// HEIGHT picks a layer, its ANGLE picks a slice, and a weighted random roll
// picks the zone from that slice. So a zone that appears in NO slice of the
// lowest layer is simply unreachable by direct fire. Dump the whole table.
if (getenv("BT_DMGTABLE_LOG"))
DumpTable();
}
//
// #92 diagnostic: print every layer / slice / weighted zone entry.
//
void DamageLookupTable::DumpTable() const
{
DEBUG_STREAM << "[dmgtable] layers=" << layerCount << std::endl;
for (int L = 0; L < (int)layers.size(); ++L)
{
const PieSlice *layer = layers[L];
DEBUG_STREAM << "[dmgtable] layer " << L
<< " rotateWithTorso=" << layer->DiagRotateWithTorso()
<< " slices=" << layer->DiagSliceCount() << std::endl;
for (int S = 0; S < layer->DiagSliceCount(); ++S)
{
const DamageZonePercentTable *leaf = layer->DiagSlice(S);
if (leaf == 0) continue;
DEBUG_STREAM << "[dmgtable] slice " << S << ":";
Scalar prev = 0.0f;
for (int E = 0; E < leaf->DiagEntryCount(); ++E)
{
Scalar cum = leaf->DiagCumulative(E);
DEBUG_STREAM << " z" << leaf->DiagZone(E)
<< "=" << (int)((cum - prev) * 100.0f + 0.5f) << "%";
prev = cum;
}
DEBUG_STREAM << std::endl;
}
}
}
DamageLookupTable::~DamageLookupTable() // @0x49eadc
@@ -259,5 +297,20 @@ int
}
DamageZonePercentTable *leaf = layer->SelectSlice(theta); // FUN_0049e678
return leaf ? leaf->SelectZone() : -1; // FUN_0049de14
int resolved = leaf ? leaf->SelectZone() : -1; // FUN_0049de14
// #92: which LAYER does a given impact height land in? A foot shot that
// lands in a layer above the foot layer can never roll a foot zone.
if (getenv("BT_DMGTABLE_LOG"))
{
static int s_rh = 0;
if (s_rh++ < 400)
DEBUG_STREAM << "[dmgresolve] localY=" << local.y
<< " heightRef=" << heightRef
<< " frac=" << (depth / heightRef)
<< " layer=" << layerIndex << "/" << layerCount
<< " theta=" << theta
<< " -> zone " << resolved << std::endl;
}
return resolved;
}