Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escalating Game Performance Woes: From Laggy Moves to Complete Freezes #70530

Closed
Radonchnk opened this issue Dec 30, 2023 · 12 comments
Closed

Escalating Game Performance Woes: From Laggy Moves to Complete Freezes #70530

Radonchnk opened this issue Dec 30, 2023 · 12 comments
Labels
Code: Performance Performance boosting code (CPU, memory, etc.) (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@Radonchnk
Copy link

Describe the bug

Recently, the game's performance has noticeably declined, with occasional delays of a few seconds for moves to process. However, the current situation is more severe, as the game freezes for 30 seconds or more after each input.

Attach save file

Peach Lake-trimmed.tar.gz

Steps to reproduce

Press any move button

Expected behavior

The game is expected to operate seamlessly, yet it consistently experiences freezing issues.

Screenshots

No response

Versions and configuration

os - Linux Mint 21.1 x86_6
Kernel: 5.15.0-89-generic
Shell: bash 5.1.16
DE: Xfce 4.16
WM: Xfwm4
CPU: 11th Gen Intel i3-1115G4 (4) @
GPU: Intel Device 9a78
Memory: 4665MiB / 15734MiB

version - f94a31e
tileset, mods - standard

Additional context

No response

@Radonchnk Radonchnk added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Dec 30, 2023
@BrettDong BrettDong added the Code: Performance Performance boosting code (CPU, memory, etc.) label Dec 31, 2023
@Maleclypse
Copy link
Member

Had you recently read several maps?

@Radonchnk
Copy link
Author

Sorry, but i do not understand the question

@Maleclypse
Copy link
Member

#70540 is this your problem? Or if you spawn a clairvoyance artifact are you over a slime pit?

@akrieger
Copy link
Member

akrieger commented Jan 1, 2024

NPC crafting is going haywire somehow. This was over a minute of tracing for a single step that I didn't even let complete.
image

@akrieger
Copy link
Member

akrieger commented Jan 1, 2024

Spending all its time creating a crafting inventory? Twice?

image
image

@akrieger
Copy link
Member

akrieger commented Jan 1, 2024

#70423 would help with this some because it just makes item stuff 'faster' but it doesn't fix the underlying algorithmic issue. I can't tell if there's a bug here causing a potentially infinite loop or just an inefficient process your save is exposing.

@akrieger
Copy link
Member

akrieger commented Jan 1, 2024

image

Maybe there's a large backlog that's not doing backoff correctly.

@harakka
Copy link
Member

harakka commented Jan 2, 2024

/confirm

@github-actions github-actions bot added (S2 - Confirmed) Bug that's been confirmed to exist and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels Jan 2, 2024
@akrieger
Copy link
Member

akrieger commented Jan 2, 2024

What seems to be happening is an NPC is trying to do a multi craft but has a computed crafting speed of zero. This causes it to burn all of its moves (nearly 1000) one at a time trying and failing to do a craft, which is very, very expensive.

image

@akrieger
Copy link
Member

akrieger commented Jan 2, 2024

The crafting speed is reduced to zero by a manipulation limb score modifier which ends up with a negative modifier which zeroes everything out.

image

@akrieger
Copy link
Member

akrieger commented Jan 2, 2024

Then even though it is cancelled, it gets pushed into the backlog and automatically retried.

image

@akrieger
Copy link
Member

akrieger commented Jan 2, 2024

This seems to fix the issue by not having the npc loop and fail constantly at crafting.

if( crafting_speed <= 0.0f ) {
crafter.cancel_activity();
return;
}

diff --git a/src/activity_actor.cpp b/src/activity_actor.cpp
--- a/src/activity_actor.cpp
+++ b/src/activity_actor.cpp
@@ -3380,6 +3380,7 @@
     const int assistants = crafter.available_assistant_count( craft.get_making() );

     if( crafting_speed <= 0.0f ) {
+        crafter.set_moves( 0 );
         crafter.cancel_activity();
         return;
     }

but I don't know how to validate it for side effects.

Procyonae pushed a commit to Procyonae/Cataclysm-DDA that referenced this issue May 18, 2024
…Raven#70530) (CleverRaven#73820)

* Near-infinite loop fix for when crafter cannot continue.

* Update src/activity_actor.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/activity_actor.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: Draper, Daniel <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code: Performance Performance boosting code (CPU, memory, etc.) (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

No branches or pull requests

5 participants