Add live spatial weight tuning

This commit is contained in:
2026-06-26 21:34:17 -05:00
parent c525c1edf9
commit 9966cf8272
4 changed files with 218 additions and 8 deletions
+9
View File
@@ -71,6 +71,15 @@ Current date/time context: 2026-06-26, local timezone America/Chicago.
`toolbox run -c 2077 tools/build_red4ext_shim.sh`.
- The resulting DLL remains uninstalled. Game install still has only
`EdgeWeightGPS.dll.disabled`, not an active plugin DLL.
- Follow-up live-tuning support adds
`red4ext/plugins/EdgeWeightGPS/spatial_weights.bin`: five little-endian
float32 values in highway, road, GPSOnly, pavement, unknown order. The plugin
polls this file on route-producer entry, so changing it and replotting a route
applies new weights without rebuild/relaunch.
- `tools/write_spatial_weights.py` can write the active file or generate
presets. Generated presets live in `work/spatial-weights/`:
`vanilla.bin`, `current.bin`, `highway-free.bin`,
`highway-expensive.bin`, and `surface-extreme.bin`.
Important caveat:
+9
View File
@@ -81,6 +81,15 @@ Active build note:
`GPSEdgeCost` (`0x44f838`), samples a generated traffic-lane spatial grid
using the search-state coordinates, and applies highway/road/pavement
multipliers to returned edge costs.
- When the spatial patch is enabled, the plugin hot-reloads
`spatial_weights.bin` from the same directory as the DLL. The file is exactly
five little-endian float32 values in this order:
`highway`, `road`, `GPSOnly`, `pavement`, `unknown`.
- `tools/write_spatial_weights.py` writes that file directly, or can generate
named preset files under `work/spatial-weights/` for live copy-over testing.
The prepared presets are:
`vanilla`, `current`, `highway-free`, `highway-expensive`, and
`surface-extreme`.
- The old verbose local-search probe is still available behind
`kEnableGpsLocalSearchHooks`. It hooks `GPSSearch` (`0x44f054`),
`GPSResolveHandle` (`0x44e1a8`), `GPSEdgeCost` (`0x44f838`), and the two