Files
Neutron/docs/analysis/original-collision.md

320 lines
19 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Follow-up original collision evidence
Continuation2026-10-26: checkpoint/collision-response.md supersedes the earlier
recursive-sliding inference with REA/byte/probe evidence for47BD80 and its callers.
The source kernel is now a separate tested component; live capsule replacement,
full contact/support order and pivot fidelity remain open.
Static investigation and isolated copied-DLL probes,2026-10-24. The bounded
OriginalBodySupport module now translates the vertical support/segment path.
This does not supersede the complete provisional SceneCollision solver or prove
original gameplay fidelity; full body collision/pivot/cadence remain unresolved.
HasCollision is serialized type6 at EXE40D423 into interface+584. LV1B includes
-1defaults, explicit1Carl, explicit0plant/teleport/OMT props. Per-object collision
exclusions DisableCollisionID4730F0/EnableCollisionID473170 maintain separate lists;
visibility/material alone cannot choose collision masks.
Jimmy grounded update42469B..4246E3 sets physical-radius slot264 to60 when WORD
4F0588!=0, versus160 otherwise. Shape/animation reset42369A..4236AA sets authored
radius60 through interface slot110, forwarding the radius. Gate semantics/root and
vertical support differ from the preview feet capsule: do not blindly replace its
radius24 with60 and call that original collision. Static resolver47B4B0 ->47BBB0 ->
47BD80 reads interface+15C radius; recovered vertical support47B890 is below.
ASE mode2 conversion of standing Jimmy was executed against a copied DLL in the
isolated harness: its raw bounds remain unchanged and both frame offsets are zero.
No hidden scale/pivot correction was found. The remaining sole/root discrepancy
must not be replaced with a guessed scale or translation.
## Reproducible source evidence
All addresses below are preferred virtual addresses. Neutron `.text` addresses
map to file offsets VA minus `0x400000`; OMT2 addresses should be mapped through
their PE section table. Original files are only read, never executed or modified
by this investigation. Bounded `objdump -d -M intel --start-address=...
--stop-address=...` reads were used for instruction interpretation.
Run `python3 tools/binary/collision_evidence.py` from GamePort. This read-only
script checks27 decisive EXE/DLL instruction-byte sequences, resolves interface and
game vtable slots from original PE bytes, and derives source mesh/GAM facts. It
uses the existing bounded PE, OMT and GAM readers and adds no dependencies.
Neutron.exe SHA-256 is
`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
The script does not execute original instructions; its calculated values are
static consequences, not observed original gameplay.
## Jimmy PostLoad: radius and vertical clearance
Jimmy's game interface is complete object plus `0xC0`, vtable `0x4A373C`.
The **interface** slots below must not be looked up in the complete-object OMT
vtable `0x4A3BDC`.
| Interface slot | Implementation | Field/behavior |
| --- | --- | --- |
| `0x100` | `0x4711E0` | Authored support factor at interface `+0x2C`; forwards to slot `0x254` |
| `0x110` | `0x471240` | Authored radius at `+0x34`; forwards to slot `0x264` |
| `0x250` | `0x471AF0` | Current support factor getter, `+0x154` |
| `0x254` | `0x471B00` | Current support factor setter, `+0x154` |
| `0x260` | `0x471B30` | Current radius getter, `+0x15C` |
| `0x264` | `0x471B40` | Current radius setter, `+0x15C` |
| `0x310` | `0x472300` | Current physics position, `+0x214..+0x220` |
| `0x318` | `0x472330` | Physics position setter and changed hook |
| `0x40C` | `0x423610` | Jimmy PostLoad |
`0x423631` passes the string `Calling PostLoad for C3DJimmy()` (VA `0x4EF3B4`).
After restoring the base shape through complete-object slot `0xAC`, PostLoad
pushes `0x42700000 = 60.0f` at `0x4236A3` and calls interface slot `0x110` at
`0x4236AA`. It then pushes `0x3FA1EB85 = 1.2649999856948853f` at `0x4236B3`
and calls interface slot `0x100` at `0x4236BA`.
The earlier player constructor factor `0.7` at `0x4373C2..0x4373C9` is therefore
superseded by Jimmy PostLoad. It is not friction: constructor friction `0.8`
goes through `0x4711B0` and interface slot `0x24C`. The factor's original source
name is not recovered; "support factor" describes its verified use below.
Grounded update `0x42469B..0x4246E9` sets the current radius again. It uses 160
when WORD current gadget selector `0x4F0588` equals zero and 60 otherwise. The
selector is initialized to `-1` by Jimmy constructor `0x42225F`, so no-gadget
grounded behavior takes the 60 branch. Grounded gadget-specific changes are
distinct from a uniform player body dimension and must remain state-dependent.
This establishes original radius 60 for the ordinary path; it does **not**
establish a vertical capsule of height 209.4361. The current provisional capsule
radius 24 cannot be described as recovered, and simply replacing that radius
without recovering root/solver conventions would mix two different models.
## Vertical support handler `0x47B890`
This handler queries source geometry separately from the horizontal/ceiling
triangle resolver. It exits immediately if geometry collision byte `0x4F69E5`
is zero. Its active path reads radius through slot `0x260` and support factor
through `0x250` at `0x47B8B0` / `0x47B8BE`. The multiplication at `0x47B8C8`
stores `radius * factor` (the subsequent `push` means the store at `0x47B8D5`
is local offset `+0x08`, not `+0x0C`; tracking that stack shift matters).
Recovered active-path outline, omitting callback bookkeeping:
```text
r = currentRadius
h = currentSupportFactor
clearance = (h == 1 or h < 0.1) ? r : r*h
P = currentPhysicsPosition
Q = previous/resolverPosition (slot 0x2F8)
top = max(P.y, Q.y)
if segmentQuery(Q, P, 0) hits H:
top += length(P-Q) - length(H-Q)
start = (P.x, top + clearance, P.z)
end = (P.x, P.y - 2*r, P.z)
if segmentQuery(start, end, 0) hits F:
resolvedY = F.y + r*h
if preventLowering(slot0x208) and P.y > resolvedY: return
setPosition(P.x, resolvedY, P.z)
zero acceleration.Y and velocity.Y, preserving X/Z
setGrounded(true)
preserve hit polygon and shape for callbacks
```
The ray span uses the conditional `clearance`; the final support height adds
the stored product `r*h`. The distinction matters for factors below0.1, although
ordinary Jimmy's1.265 branch uses the same product in both places. Ray assembly
is `0x47BA33..0x47BAD1`, hit Y plus product `0x47BAE1..0x47BAEF`, position write
`0x47BB23..0x47BB32`, grounded write `0x47BB7C..0x47BB80`. The handler invokes
an optional interface landing hook only when prior grounded byte `0x695D49`
was false (`0x47BB51..0x47BB5E`).
For radius60 and PostLoad factor1.265, float32 clearance is **75.9000015** world
units. At the actual lab spawn XZ, the only source polygon below GAM root26.6619
is Box06/shape71/polygon497/material17 at Y=0.5486332333; its stored normal is
approximately `(−0.00002292,1,−0.00002965)`. The next vertical hits are overhead
surfaces at473.6309 and491.0861. Thus the ordinary successful flat support branch
predicts physics root Y about **76.448635**, not a permanent root-to-floor offset
of26.1133 inferred from serialized GAM placement.
That is a conditional static prediction, not an original frame capture. Initial
GAM placement can be corrected by physics after loading. With raw standing
minimum local Y=-64.6165, the predicted root would put its lowest raw vertex
11.2835 units above that floor. This remaining discrepancy must not be turned
into an invented scale factor. The port's present sole-based render transform
and floor-derived actor offset remain separate approximations.
## Shape bounds and render transform
Complete-object shape-change hook `0x462270` reads current shape pointer `+0x8C`,
copies shape bounding-sphere radius `shape+0x4C` into interface slot `0x110`,
then asks shape virtual `0x44` for six cube bounds. It forwards two four-float
records through interface slots `0x2E8` / `0x2E0`, stored at `+0x1D4` /
`+0x1C4` by `0x472120` / `0x4720C0`. These are bound records, not a recovered
capsule radius/height constructor. Jimmy's explicit PostLoad radius60 follows
the base-shape restore and therefore overrides the automatically copied radius.
OMT shape `prepare` at DLL `0x100062A0` computes sphere center and maximum
vertex distance (`0x100062EE..0x10006389`) using the bounding-box center finder
`0x10005470`. This computes bounds and does not itself move the vertices.
Physics-to-render position hook `0x4624B0` reads interface slot `0x310` and copies
XYZ directly to complete-object offsets `+0x44,+0x48,+0x4C` (interface-relative
`-0x7C,-0x78,-0x74`) at `0x4624CA..0x4624E8`. No extra vertical translation
or scalar multiplier occurs in this hook.
Jimmy complete-object slot `0x7C` targets import thunk `0x47EDB4`, which jumps
through IAT `0x48D36C` to OMT `get_dynamic_offset@OMedia3DMorphAnim`, DLL
`0x100033F0`. It reads current animation frame `+0x98` and returns that frame's
XYZ offsets `+0x08,+0x0C,+0x10`; without a frame it returns zero. Base frame
constructor DLL `0x10021180` initializes those offsets to zero. Therefore this
hook has no hardcoded Jimmy floor/pivot adjustment. Full converter/frame writes
still need controlled probing before asserting every relevant offset stays zero.
## ASE object mode2 does not imply a scale correction
The DLL object-mode global `0x1013D6CC` has five absolute-address references in
the inspected binary (the script lists their operand addresses). ASE-specific
reads at `0x1001396E` and `0x10013CBF` control GROUP/GEOMOBJECT separation. ASE
constructor `0x10012DF1` sets its "first object" flag1 and `0x10012DF7` sets
group depth0. In object mode2, the first ungrouped GEOMOBJECT clears that flag
and does not request a new shape (`0x10013CD2..0x10013D15`).
`jimstop.ase` contains one GEOMOBJECT, no GROUP and no TM_ANIMATION. Its ordinary
vertex-list handler `0x10014EE0` parses each XYZ, swaps Y/Z and appends the
four-float vector to either base-shape vectors or the current morph frame
(`0x10014F59..0x10014FA8`). There is no multiplication by NODE_TM scale or a
constant0.4 in that handler. NODE_TM parsing `0x10014130` stores matrix rows
and an inverse matrix in converter state; this is not evidence that the baked
mesh vertices should be transformed a second time.
The earlier mode0 probe matched raw standing bounds (rendering.md). The follow-up
mode2 animated probe now also matches them; its two jimstop frames both have
offset(0,0,0). Do not apply an unproven0.4 scale or call the actor pivot solved.
## Static scene inclusion versus entity activation
Static grid registration is `0x479140`, called by scene-object InitPhysics
`0x464B00`. It visits every shape polygon and makes these exclusions:
1. `0x4794C0` handles checkpoint materials named exactly `cstart` or
`ccheck1`..`ccheck9`, marking their polygon word at `+0x1C` as4 and calling
the game checkpoint hook.
2. `0x4797A0` asks game virtual slot `0x134` whether to consume a polygon.
For CJimmyGame and CLevel01BGame this slot is `0x475CD0`, which returns false.
3. Otherwise it computes polygon centroid/radius and XZ bounds, then registers
it in a260×260 grid with cell index `trunc(world*0.002+130)`.
The checkpoint filter immediately returns false when polygon material is null
(`0x4794E8..0x4794ED`). **Null material is therefore retained for static collision**,
even though it is skipped by drawing. This directly supports retaining the lab's
325 unresolved-material triangles. The actual LV1B materials contain no
`cstart`/`ccheck*` names. Follow-up recovery of the CALLER at44DD2F..44DD70
shows that NC-prefixed shape names skip464B00 entirely: shape94 ncwater's18
triangles are excluded, leaving2,851 registered source triangles. The polygon
function itself has no general decorative-material filter. See water-collision.md
for source bytes, vtable path and the distinction between shape and material names.
Two grids are populated: all polygons at base `0x5CFC7C` and a wall/ceiling grid
at `0x509B24` when stored polygon normal.Y is strictly below0.7
(`0x47987D` captures normal.Y; `0x4798B3..0x4798CF` performs the comparison).
The vertical segment query `0x47C6E0` uses the all-polygon grid, retaining the
nearest hit along the input segment. The static sweep `0x47B4B0` uses the
wall/ceiling grid. Its radius comes from interface slot `0x260`; closest-hit
state feeds recursive sliding and callbacks. Its full narrow-phase behavior
`0x47BBB0 ->0x47BD80` remains incompletely translated, so the current port's
two-sided capsule and0.65 slope threshold are still provisional.
Entity collision is a different layer. HasCollision registration at `0x40D423`
binds a type6 property to interface `+0x584` (complete object `+0x644`). During
activation, `0x40E40A..0x40E45D` treats-1 as "retain default", zero as disable
(slot `0x3A4` plus slot `0x214=false`), and nonzero as enable (slot `0x3AC` plus
`0x214=true`). This is separate from visibility and the all-polygon static grid.
Actual LV1B values are nine default-1, one explicit1 and seven explicit0.
Carl is explicitly enabled; plant/teleport/OMT props provide explicit exclusions.
`DisableCollisionID` `0x4730F0` searches global entities by ObjectID at interface
`+0x404` and adds matches to the caller's exclusion list `+0x254` if absent;
`EnableCollisionID` `0x473170` removes matching entries. Parent/entity analysis
also recovered the ordinary pair test at `0x47B3E0`: strict actor-root Euclidean
distance less than the sum of current radii, followed by exclusions. Mode2 pair
geometry follows another path and must not be replaced with that metric blindly.
## Recovered guard, ray kernel and frame phase
Support slot208 is4719D0, reading interface+13A. Guard47BAFD..47BB0A rejects
currentRoot.Y strictly greater than hitY+r*h. It does not inspect velocity; it
prevents lowering a body above support even while that body is descending.
C3DAI constructor407B4D..51 enables the authored flag through470F70, which
forwards to current flag setter4719E0. The earlier label "upward guard" was
imprecise. Clearance comparison48D920 is float0.10000000149, not0.5.
Goddard inherits support factor0.30000001192 at407B2B/407B30; PostLoad41E64A/
41E651 overrides radius to130, so ordinary flat clearance is39.0. No corresponding
factor override was found in the traced Goddard constructor/PostLoad path.
EXE469B70 is a Moller-Trumbore-style segment test. It normalizes direction using
quick_magnitude, retains source winding, and accepts determinant<=-epsilon when
twoSided=false, or absolute determinant>=epsilon when true. Epsilon4D5E40/44 is
±1.1920928955078125e-7. Barycentric u/v boundaries are inclusive; t>=0 is accepted
but t>=segmentLength is rejected (469DDD/469DEE). Hit XYZ is correct: the pop edi
at469DF6 shifts subsequent stack operands, so apparently repeated offsets do not
mean repeated direction components.47C6E0 retains strictly nearer hits; equal ties
follow original grid traversal. No slope-normal cutoff is applied by this query.
Physics479D20 captures prior grounded via218 at479D2E, saves695D49, and clears
current grounded through21C at479D4E when geometry-support flag1C8 is set.
Impulse/acceleration/gravity integration precedes wall/ceiling resolution47B4B0;
support47B890 is called at47A235 after the resulting position is assigned, then
friction47A330 and small-velocity clearing follow. The new support module preserves
this phase boundary; it is not the entire479D20 implementation.
## quick_magnitude lookup recovery and actual DLL comparison
OMT1001FF70 keeps largest absolute component m and other components a,b, computes
index=trunc((a²+b²)*16384/(a²+b²+m²))&16383, then returns m/sine[halfAcos[index]].
Initializer100EDC00 uses these stored doubles:
- sine[i]=float(sin(i*0.0003834951969604492)), with exact quadrant overrides;
- halfAcos[i]=trunc(acos(i/8192.0-1)*2607.5945876921437*0.5).
This is a sine table, not the cosine table initially suspected. The isolated
copied-DLL probe observed FNV1a32 fingerprints431383b5 for all16384 sine floats
and4f800433 for all16384 half-acos words. Modern Python regeneration matches both
whole-table fingerprints. The C# function also matches eight actual original-DLL
float-bit outputs, including3/4/0 ->40a0001e,1/1/1 ->3fddb16e and500/100/300 ->
4413eb31. Zero is handled directly in the port; the observed DLL also returns0.
This verifies these math references on the tested environment; it is not a full
x87 arithmetic or native Windows gameplay equivalence claim.
## Implemented boundary and validation
src/GamePort/Game/OriginalBodySupport.cs provides QuickMagnitude, a source-winding
Trace over supplied SupportTriangle records, and Resolve for SupportBody input.
Resolve returns root/velocity/acceleration, supported/landing flags, source hit
identity and the support anchor written via2F4. The caller owns prior/current
grounded phase, geometry-registration masks, landing callback and hit bookkeeping.
Trace scans linearly instead of260x260 grid traversal; tie identities can differ.
Double/single arithmetic does not reproduce every x87 temporary rounding boundary.
This is a separate root-support component, not a replacement feet capsule.
Run source scripts/env.sh then dotnet run --project tests/GamePort.SupportTests.
All13 groups pass: original-DLL math bit references; source winding/two-sided
override; strict endpoint/start; nearest/tie identity; root/velocity/acceleration;
height guard independent of velocity;0.1 factor boundary; crossed-geometry query
lift; disabled geometry; invalid input; ten-second gravity stability/jump; actual
2869 raw lab triangles including invisible proxies and predicted root76.448635.
That standalone raw-array support test does not apply registration masks; the
integrated OriginalScenePhysics now omits NC shapes before support/wall queries.
tools/binary/collision_mode2_probe.c builds with local i686-w64-mingw32-gcc and
runs only via tools/recon/reference_capture.py --asset-probe --probe-executable
artifacts/binary/collision_mode2_probe.exe in a copied installation. Original and
network paths are absent from that namespace. Artifacts/binary/mode2-jimstop.log
records successful conversion:426 points, matching raw bounds, one sequence/two
frames and zero offsets. An initial probe-reader error treated sequence pointers
as frames; the corrected bounded vector-of-sequences/list-of-frames traversal
was verified against100203C0/10020870. No original assets were written.
The follow-up jimjump animation-only conversion also succeeds after allowing its
legitimate empty base shape: one sequence, three frames of426 points, all offsets
zero. See artifacts/binary/mode2-jimjump.log. Empty base center/bounds are not
initialized geometry and must not be interpreted as a transform. The final probe
suppresses that center output when the base is empty.
Full horizontal/ceiling narrow-phase sliding, dynamic collider activation/boxes,
exact body/render pivot and original gameplay/native Windows comparison remain.