Vehicle lamp lights: same lamp colours on every run #445
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/holdmysocks--SixNG!445
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-445"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@holdmysocks on GitHub · 2026-11-27 03:05 UTC · original
holdmysocks:fix/lamp-lights-deterministic→master· +9 −3 · 1 files · 1 commits · merged 2026-11-27 04:36 UTCTwo runs of the same build gave different
vehicles[].lights.lamp_lightsinvehicles/vehicles.jsonfor about 5 lamps (for example, boned418625ecame outffb626in one run andebff8cin another).Cause
Index::for_vehicle(crates/sixng-core/src/vehlights.rs) walks a light pack's lamp sets withp.lamp_sets.values(), andlamp_setsis aHashMap, so its order changes from one process to the next.lamp_lightsandarchetypesuseentry(..).or_insert_with(..), so when a bone is in more than one of a pack's lamp sets, whichever set came up first won. That set changed between runs.Fix
lamp_lightsand forarchetypes. None of the sets has a better claim than the others, so this rule only makes the choice stable. It does not judge which colour is right. The rest of the order is unchanged: the vehicle's light packs in index order come first, then the lamp sets its parts link, in part order.light_tablepicks the first levels resource that holds a wanted light archetype withfind_map_firstinstead offind_map_any. Without a cache,find_map_anycould pick a different resource each time. With a cachedvehicle_light_archetypes.json(the normal case), this change has no effect.Checked
cargo test -p sixng-core --lib: 340 passed, 0 failed, 1 ignored.sixng vehicles packs --out <dir>runs of this build gave byte-identicalvehicles.jsonfiles (same SHA-256).