Describe the bug
It takes too long time to move rags
To Reproduce
My speed is 110. Inventory is empty or has 100 rags. On ground in same tile there are 100 rags or nothing.
Expected behavior
Versions and configuration(please complete the following information):
Dropping many small items in general takes to long. For example dropping 250 cash cards at once should be way faster than dropping them individually.
25852 is the likely cause.
Without that fix, moving 10000 rags is the same as moving 1 with Advanced Inventory, which also is nonsense. Note that the fix did not affect "normal" pickup/drop with, so the reported "with [d]/[,] keys, drop/pickup 100 rags = 9m" was like this before.
I think the comprehensive fix we need for item move cost should add consistency in cost between methods (e.g. Advanced Inventory vs drop/pickup actions) and make it simulate bulk item moving:
The move costs should be consistent in the following cases (but we should probably keep that dropping is cheaper than picking up):
Indeed, "normal" pickup/drop (,
and d
) are implemented with the activities ACT_PICKUP
and ACT_DROP
(there are a few others too, like ACT_STASH
), but Advanced Inventory uses a different system that re-implements a similar logic for MOVE_VARIABLE_ITEM
and MOVE_ITEM_STACK
, but when you use "move all" then it is implemented with ACT_MOVE_ITEMS
. All of these calculate move cost in their own way. No wonder there's inconsistency!
So as has already been suggested we should make MOVE_VARIABLE_ITEM
and MOVE_ITEM_STACK
also use the ACT_MOVE_ITEMS
activity. Then we make the move costs consistent among ACT_MOVE_ITEMS
, ACT_PICKUP
and ACT_DROP
(there is some work in this direction, see activity_item_handling.cpp
's move_cost()
and Pickup::cost_to_move_item()
). I guess we want:
ACT_MOVE_ITEMS < ACT_PICKUP + ACT_DROP
since picking up actually includes organizing stuff into your inventory (it is not picking something up to your hands).
And now to actually solve this bug! Now that all item moving/picking/dropping is handled by activities, at the time the game processes them we have the full list of items to process, so we can optimize and simulate that the player does sensible bulk moving, even mixing different stacks of items. We can just go through this list and fill up "an armful" (5 liters? Larger items are dealt with one at a time) of items and calculated the move cost for that (I guess current Pickup::cost_to_move_item()
actually might be good enough), and then repeat until the list is empty.
Thoughts? If this idea looks like the way to go, I could try to have a look (it looks pretty daunting though!).
Thoughts?
SGTM. :+1:
Having consistent, reasonable behavior throughout is key.
@anonym sounds like a good solution, need to try.
I feel you there, that's why I just search for rags instead of breaking a bed tile, giving me tons of rags
Fixed by #27793
Most helpful comment
Without that fix, moving 10000 rags is the same as moving 1 with Advanced Inventory, which also is nonsense. Note that the fix did not affect "normal" pickup/drop with, so the reported "with [d]/[,] keys, drop/pickup 100 rags = 9m" was like this before.
I think the comprehensive fix we need for item move cost should add consistency in cost between methods (e.g. Advanced Inventory vs drop/pickup actions) and make it simulate bulk item moving:
Consistency
The move costs should be consistent in the following cases (but we should probably keep that dropping is cheaper than picking up):
Indeed, "normal" pickup/drop (
,
andd
) are implemented with the activitiesACT_PICKUP
andACT_DROP
(there are a few others too, likeACT_STASH
), but Advanced Inventory uses a different system that re-implements a similar logic forMOVE_VARIABLE_ITEM
andMOVE_ITEM_STACK
, but when you use "move all" then it is implemented withACT_MOVE_ITEMS
. All of these calculate move cost in their own way. No wonder there's inconsistency!So as has already been suggested we should make
MOVE_VARIABLE_ITEM
andMOVE_ITEM_STACK
also use theACT_MOVE_ITEMS
activity. Then we make the move costs consistent amongACT_MOVE_ITEMS
,ACT_PICKUP
andACT_DROP
(there is some work in this direction, seeactivity_item_handling.cpp
'smove_cost()
andPickup::cost_to_move_item()
). I guess we want:since picking up actually includes organizing stuff into your inventory (it is not picking something up to your hands).
Bulk item moving
And now to actually solve this bug! Now that all item moving/picking/dropping is handled by activities, at the time the game processes them we have the full list of items to process, so we can optimize and simulate that the player does sensible bulk moving, even mixing different stacks of items. We can just go through this list and fill up "an armful" (5 liters? Larger items are dealt with one at a time) of items and calculated the move cost for that (I guess current
Pickup::cost_to_move_item()
actually might be good enough), and then repeat until the list is empty.Thoughts? If this idea looks like the way to go, I could try to have a look (it looks pretty daunting though!).