CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.68k stars 4.19k forks source link

Super slow sleeping near the furniture #77026

Closed KHeket closed 1 month ago

KHeket commented 1 month ago

Describe the bug

If you sleep near the table/anvil and other furniture - the game will go super slow I think, its because character have lying position image And game checking every turn character

Attach save file

1-trimmed.tar.gz

Steps to reproduce

Load save Sleep in shelter, check, that speed of sleeping is fast Alt+f4 Load save again Move table right to the shelter, like at screenshot below Sleep See slow down of sleeping, and you will need to wait for few minutes

Expected behavior

Normal speed of sleep everytime

Screenshots

lags image

After I move table 1 tile away - the sleeping going by normal fast time image

Versions and configuration

Additional context

No response

osuphobia commented 1 month ago

73552 might be relevant?

PatrikLundell commented 1 month ago

/Confirmed

sparr commented 1 month ago

Loading your save does not give me the game state from your screenshots. I tried with and without your config. I see a big hollow square of pit, and can't drag the table to the left of the shelter because of the pit.

If I drag the table to the north of the shelter, I don't see any difference in sleeping speed, it seems normally fast with and without moving the table.

image

KHeket commented 1 month ago

If I drag the table to the north of the shelter, I don't see any difference in sleeping speed, it seems normally fast with and without moving the table.

I have performance issue after placing table at any tile near the character sleep place image image image

PatrikLundell commented 1 month ago

When I confirmed the issue I too failed to move the table to the west of the shelter, and ended up dragging it to the north of it instead, which was sufficient to cause the issue to appear. That was done using the master code as it stood at that time (freshly downloaded and compiled).

However, if some people see it and some don't, we might be faced with an OS/compiler issue. The original report, as well as my confirmation, was using Windows and MSVC (I assume the packaged experimentals for Windows are using MSVC, anyway).

sparr commented 1 month ago

I should have specified. I am using clang on Linux. Another user on Discord who is able to reproduce #73552 is using MSVC.

PatrikLundell commented 1 month ago

I was trying to profile it, and it seems the time is largely spent in calls to different interpretations of the template cast_horizontal_zlight_segment, in which the time largely is spent in expf, whatever that is (trying to expand that asks for an assembly file). The largest user within the template is the line last_intensity = calc( numerator, this_span->cumulative_value, dist ); which is largely due to it being in a loop over distances within a loop over distance of the outer loop. About 70% of the time was spent in the cast_zlight template (shadowcasting.cpp), which is the caller of the template interpretations above.

I don't know if anyone can draw any useful conclusions of the above, though.