-
assigned issue to
Having large numbers of items in your inventory leads to world map travel lag
This is actually unrelated to the other sources of world map lag from zones remaining loaded or having a large number of ticking objects. It seems that MinEvent
propagation/cascade checks via WantEvent(Event E)
causes lag on the world map that scales with the number of items in the player inventory, though I’d assume it’s probably more accurately scaling with the total number of nodes in the ‘tree’ of the Player GameObject, including all its sub-objects, parts, etc. This can be trivially tested by using the allbox
wish and grabbing a large number of unique items, or by simply getting a large number of distinct items through normal gameplay.
When traveling on the world map:
- One event is fired per segment (
EndSegmentEvent
, which has aCascadeLevel
ofCASCADE_ALL
.) - Four events are fired per turn (
BeforeBeginTakeActionEvent
,BeginTakeActionEvent
,CommandTakeActionEvent
, andEndTurnEvent
, which all have aCascadeLevel
ofCASCADE_ALL
.)
This means that for travelling 1000 segments (100 turns), 1400 events are fired on the player and must propagate to and fire on every child object and part on the player; one of the easiest ways to increase this is by filling your inventory with non-stacked objects, since that guarantees each has a separate GameObject
which the Inventory
part will propagate to. For a higher count of 6000 or 9000 segments, that’s 8400 to 12,600 events, which must all propagate to each level.
Only MinEvent
s seem to have this issue, however, as HasRegisteredEvent
isn’t recursive.
A simple stopgap solution would be refusing to propagate these events to inventory contents while on the world map, but I’m unsure what side effects that could have, and it doesn’t address the root issue either. Cacheing for WantEvent, even if it’s just on the level of parts, could be another potential solution.
Comments (2)
-
repo owner -
repo owner - changed status to resolved
- Log in to comment