Streamline GPS momentum plugin

This commit is contained in:
2026-06-27 04:36:28 -05:00
parent 83cf10495e
commit 78520ee48f
8 changed files with 176 additions and 6184 deletions
+25 -47
View File
@@ -1,40 +1,41 @@
# EdgeWeightGPS
# MomentumGPS
Cyberpunk 2077 RED4ext plugin that improves player GPS routing by penalizing
short-segment churn in the native GPS solver. The current validated default
pushes the GPS toward smoother, higher-momentum driving corridors without
globally forcing every route onto highways.
short-segment churn in the native GPS solver. The validated default pushes the
GPS toward smoother, higher-momentum driving corridors without globally forcing
every route onto highways.
## Current Status
Working prototype, validated in-game.
Working RED4ext plugin, validated in-game.
- Route scoring patch: enabled.
- Live tuning file: enabled.
- Current default fixed-edge penalty: `80.0`.
- Highway multiplier: neutral `1.0`; the earlier highway-speed/class
experiments are not part of the playable default.
- Current fixed ordinary-edge penalty: `80.0`.
- Live tuning: removed from the release build.
- Highway multiplier/class weighting experiments: not part of the playable
default.
The active package is a RED4ext plugin only:
```text
red4ext/plugins/EdgeWeightGPS/EdgeWeightGPS.dll
red4ext/plugins/EdgeWeightGPS/momentum_weights.bin
red4ext/plugins/EdgeWeightGPS/solver_weights.bin
red4ext/plugins/MomentumGPS/MomentumGPS.dll
red4ext/plugins/MomentumGPS/README.txt
```
## What It Patches
Reverse engineering found the player GPS route search loop around the native
solver relaxation cluster. The useful patch surface is not the script-facing
`RunGPSQuery`/`UpdateGPSQuery` helpers and not the generated traffic
`maxSpeed` fields. The playable hook patches the two ordinary adjacency
expansion sites feeding the native relax/update routine at `0x40ba58`.
`RunGPSQuery`/`UpdateGPSQuery` helpers and not generated traffic `maxSpeed`
fields. The playable hook patches the two ordinary adjacency expansion sites
feeding the native relax/update routine at `0x40ba58`.
The plugin adds a nonnegative fixed cost to ordinary edge expansion. In
practice, this makes many tiny street segments and repeated 90-degree
stair-steps less attractive, while still allowing local roads when they are the
right path.
The plugin adds a fixed cost to ordinary edge expansion. In practice, this makes
many tiny street segments and repeated 90-degree stair-steps less attractive,
while still allowing local roads when they are the right path.
This is an inline native patch against tested Cyberpunk 2077 executable RVAs. A
future game update may require fresh verification.
## Validation Summary
@@ -69,7 +70,7 @@ toolbox run -c 2077 ./tools/build_red4ext_shim.sh
This writes:
```text
build/red4ext/EdgeWeightGPS-mingw64/EdgeWeightGPS.dll
build/red4ext/MomentumGPS-mingw64/MomentumGPS.dll
```
## Install Locally
@@ -80,13 +81,9 @@ Only install while the game is cold.
toolbox run -c 2077 ./tools/install_red4ext_shim.sh
```
The install script builds the DLL, installs it into the Flatpak Steam Cyberpunk
2077 folder, and writes the validated defaults:
- `momentum_weights.bin = 80.0`
- `solver_weights.bin = 1.0`
Override the game directory with `CYBERPUNK2077_GAME_DIR` if needed.
The install script builds the DLL and installs it into the Flatpak Steam
Cyberpunk 2077 folder. Override the game directory with
`CYBERPUNK2077_GAME_DIR` if needed.
## Package
@@ -99,26 +96,6 @@ toolbox run -c 2077 ./tools/package_red4ext_mod.sh
The package is written under `dist/` and contains the `red4ext/` folder layout
expected by the game.
## Live Tuning
`momentum_weights.bin` is a single little-endian float32 and is hot-reloaded
every 500 ms while the game is running.
Useful presets:
```bash
python3 tools/write_momentum_weights.py vanilla # 0.0
python3 tools/write_momentum_weights.py default # 80.0
python3 tools/write_momentum_weights.py overstrong # 160.0, known too high
```
`solver_weights.bin` is still present for older highway multiplier experiments,
but the playable default keeps it neutral:
```bash
python3 tools/write_solver_weights.py vanilla # 1.0
```
## Repository Notes
This repository also contains older experiments and reverse-engineering tools:
@@ -127,6 +104,7 @@ This repository also contains older experiments and reverse-engineering tools:
- Traffic lane and connection probability patchers.
- Static disassembly helpers.
- RED4ext logging probes.
- Earlier live-tuning helpers and presets.
Those tools are retained because they explain the route-finding system and
document failed approaches, but they are not part of the current playable