Research GPS lane connection weighting
This commit is contained in:
@@ -6,38 +6,52 @@ Experimental Cyberpunk 2077 GPS route-weighting mod tooling.
|
||||
|
||||
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:
|
||||
useful surfaces are generated traffic resources:
|
||||
|
||||
- `worldTrafficPersistentResource.data.lanes`
|
||||
- `worldTrafficLanePersistent.length`
|
||||
- `worldTrafficLanePersistent.maxSpeed`
|
||||
- `worldTrafficLanePersistent.flags`
|
||||
- `worldTrafficLanePersistent.playerGPSInfo`
|
||||
- `worldTrafficPersistentLaneConnectionsResource.data`
|
||||
- `worldTrafficConnectivityOutLane.exitProbabilityCompressed`
|
||||
- `worldTrafficConnectivityOutLane.isSharpAngle`
|
||||
- `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.
|
||||
The in-game GPS path is computed natively over generated traffic graph data. A
|
||||
full replacement planner would require native hooks or patching the game
|
||||
executable. A feasible REDmod-style mod has to patch generated graph resources
|
||||
and test which fields the native planner actually consumes.
|
||||
|
||||
## Current Implementation
|
||||
|
||||
This repo currently contains a WolvenKit-export patcher:
|
||||
This repo currently contains WolvenKit-export patchers:
|
||||
|
||||
```bash
|
||||
python3 tools/patch_traffic_lanes.py exported-json-dir patched-json-dir
|
||||
python3 tools/patch_lane_connections.py all.traffic_persistent.json all.lane_connections.json patched.lane_connections.json
|
||||
```
|
||||
|
||||
The patcher recursively scans WolvenKit JSON exports for `lanes` arrays that look
|
||||
like `worldTrafficLanePersistent` data and applies configurable speed weighting:
|
||||
`patch_traffic_lanes.py` 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
|
||||
|
||||
In-game testing disproved `maxSpeed` as the main GPS routing lever: even highway
|
||||
speed `120` did not change GPS routes, although freeway traffic visibly moved
|
||||
faster. Treat speed patches as traffic simulation experiments, not route
|
||||
weighting.
|
||||
|
||||
`patch_lane_connections.py` patches `all.lane_connections` by raising
|
||||
highway-enter/stay edge probabilities and lowering competing non-highway exits.
|
||||
That candidate is staged as an experimental archive but has not yet been proven
|
||||
to affect GPS routing.
|
||||
|
||||
After patching, deserialize the JSON back into CR2W and pack the resulting
|
||||
resources into an archive.
|
||||
|
||||
@@ -53,12 +67,13 @@ detailed feasibility and traffic graph notes.
|
||||
|
||||
## Status
|
||||
|
||||
A test archive was built from the local Flatpak Steam Phantom Liberty install and
|
||||
installed to:
|
||||
A conservative speed archive, an aggressive speed archive, and a connection
|
||||
probability archive were built from the local Flatpak Steam Phantom Liberty
|
||||
install. All `zz_edge` archives are currently disabled in the game folder.
|
||||
|
||||
```text
|
||||
Cyberpunk 2077/archive/pc/mod/zz_edge_weight_gps.archive
|
||||
Cyberpunk 2077/archive/pc/mod/zz_edge_weight_gps_highway_probability.archive.disabled
|
||||
```
|
||||
|
||||
Build outputs are ignored by git. The installed archive should be treated as
|
||||
experimental until route behavior is checked in game.
|
||||
Build outputs are ignored by git. Experimental archives should be enabled one at
|
||||
a time and tested from a cold boot.
|
||||
|
||||
Reference in New Issue
Block a user