Files
2077-gps-mod/README.md
T

65 lines
2.3 KiB
Markdown

# 2077 Edge Weight Mod
Experimental Cyberpunk 2077 GPS route-weighting mod tooling.
## Feasibility
Cyberpunk exposes a native `gamegpsGPSSystem`, but the current public RTTI dump does
not expose script-callable methods for replacing or overriding the GPS planner. The
useful surface is the traffic lane resource data:
- `worldTrafficPersistentResource.data.lanes`
- `worldTrafficLanePersistent.length`
- `worldTrafficLanePersistent.maxSpeed`
- `worldTrafficLanePersistent.flags`
- `worldTrafficLanePersistent.playerGPSInfo`
- `worldTrafficLanePersistentFlags.Highway`
- `worldTrafficLanePersistentFlags.GPSOnly`
That strongly suggests the in-game GPS path is computed natively over the traffic
lane graph, using lane metadata as edge cost inputs. A full replacement planner
would require native hooks or patching the game executable. A feasible REDmod-style
mod is to patch lane resources so highways and major roads have better effective
costs than side streets.
## Current Implementation
This repo currently contains a WolvenKit-export patcher:
```bash
python3 tools/patch_traffic_lanes.py exported-json-dir patched-json-dir
```
The patcher recursively scans WolvenKit JSON exports for `lanes` arrays that look
like `worldTrafficLanePersistent` data and applies configurable speed weighting:
- highways get boosted toward a preferred GPS speed in the game's lane scale
- regular roads keep a moderate speed floor
- pavement, crosswalk, and disabled traffic lanes are left alone
- optional non-highway speed caps can make highways more attractive
After patching, deserialize the JSON back into CR2W and pack the resulting
resources into an archive.
The toolbox now has WolvenKit CLI installed:
```bash
toolbox run --container 2077 bash -lc '$HOME/.dotnet/tools/cp77tools --help'
```
See [docs/tooling.md](docs/tooling.md) for the end-to-end archive build flow.
See [docs/traffic-system-debrief.md](docs/traffic-system-debrief.md) for the
detailed feasibility and traffic graph notes.
## Status
A test archive was built from the local Flatpak Steam Phantom Liberty install and
installed to:
```text
Cyberpunk 2077/archive/pc/mod/zz_edge_weight_gps.archive
```
Build outputs are ignored by git. The installed archive should be treated as
experimental until route behavior is checked in game.