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

Sudden game slowdown #44452

Closed
ZemZamano opened this issue Sep 27, 2020 · 8 comments · Fixed by #45896
Closed

Sudden game slowdown #44452

ZemZamano opened this issue Sep 27, 2020 · 8 comments · Fixed by #45896
Labels
<Bug> This needs to be fixed Code: Performance Performance boosting code (CPU, memory, etc.) NPC / Factions NPCs, AI, Speech, Factions, Ownership (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@ZemZamano
Copy link

ZemZamano commented Sep 27, 2020

Describe the bug

The game was running smoothly until at one point, it slowed to a crawl. the usual suspects like lots of zombies or items are ruled out since its a wilderness playtrough. i'mtalking about slowdown while sleeping or crafting

Steps To Reproduce

i attached my save file. just craft a recipe that needs like an hour or so to [complete.]

Versions and configuration

  • OS: Win 10
  • Game Version: 0.E-6259-g34af6ba
  • Graphics version: Tiles. tried undead people and ultica, same result
  • Ingame language: English
  • Mods loaded: [e.g.dda, boats, hacktheplanet, StatsThroughSkills]

edit:forgot the save file here's the link: https://gofile.io/d/2SO0tQ

@ZemZamano
Copy link
Author

ZemZamano commented Sep 27, 2020

in addition things that seem weird and may be connected: my minimap is covered in a strange grid. also continuing on my chitinous armguards does not give me proficiency even though i have all requirements edit: minimap problem was not related and proficiency gain seems normal again

edit: also i just had this error message that might be related:
DEBUG : can't set ammo null in smoking rack as it is not an ammo

FUNCTION : item& item::ammo_set(const itype_id&, int)
FILE : src/item.cpp
LINE : 600

@anothersimulacrum anothersimulacrum added the Code: Performance Performance boosting code (CPU, memory, etc.) label Sep 27, 2020
@anothersimulacrum
Copy link
Member

anothersimulacrum commented Sep 27, 2020

2/3rds of the time spent in game::do_turn (which is by far where the most time is spent), is in game::overmap_npc_move. Reminds me of #30288
Specifically, in this bit:

[&]( const pf::node<point_rel_omt> &cur, const pf::node<point_rel_omt> * ) {
const tripoint_abs_omt convert_result = base + tripoint_rel_omt( cur.pos, 0 );
if( ptype.only_known_by_player && !seen( convert_result ) ) {
return pf::rejected;
}
int res = 0;
const oter_id oter = get_ter_at( cur.pos );
int travel_cost = static_cast<int>( oter->get_travel_cost() );
if( ptype.avoid_danger && is_marked_dangerous( convert_result ) ) {
return pf::rejected;
}
if( ptype.only_road && ( !is_ot_match( "road", oter, ot_match_type::type ) &&
!is_ot_match( "bridge", oter, ot_match_type::type ) &&
!is_ot_match( "road_nesw_manhole", oter, ot_match_type::type ) ) ) {
return pf::rejected;
}
if( ptype.only_water && !is_river_or_lake( oter ) ) {
return pf::rejected;
}
if( ptype.only_air && ( !is_ot_match( "open_air", oter, ot_match_type::type ) ) ) {
return pf::rejected;
}
if( is_ot_match( "empty_rock", oter, ot_match_type::type ) ) {
return pf::rejected;
} else if( is_ot_match( "open_air", oter, ot_match_type::type ) ) {
if( ptype.only_air ) {
travel_cost += 1;
} else {
return pf::rejected;
}
} else if( is_ot_match( "forest", oter, ot_match_type::type ) ) {
travel_cost = 10;
} else if( is_ot_match( "forest_water", oter, ot_match_type::type ) ) {
travel_cost = 15;
} else if( is_ot_match( "road", oter, ot_match_type::type ) ||
is_ot_match( "bridge", oter, ot_match_type::type ) ||
is_ot_match( "road_nesw_manhole", oter, ot_match_type::type ) ) {
travel_cost = 1;
} else if( is_river_or_lake( oter ) ) {
if( ptype.amphibious || ptype.only_water ) {
travel_cost = 1;
} else {
return pf::rejected;
}
}
res += travel_cost;
res += manhattan_dist( finish, cur.pos );
return res;
};

image
(See how the next most expensive this is about 1/7th of this, and is the game checking for input(actually redrawing the UI).)

@stale
Copy link

stale bot commented Oct 28, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

@stale stale bot added the stale Closed for lack of activity, but still valid. label Oct 28, 2020
@stale
Copy link

stale bot commented Nov 28, 2020

This issue has been automatically closed due to lack of activity. This does not mean that we do not value the issue. Feel free to request that it be re-opened if you are going to actively work on it

@stale stale bot closed this as completed Nov 28, 2020
@Aivean
Copy link
Contributor

Aivean commented Dec 1, 2020

@ZemZamano , if this is still valid, please re-attach the save file. You can drop files directly into the github comment window.

@Aivean Aivean removed the stale Closed for lack of activity, but still valid. label Dec 1, 2020
@ZemZamano
Copy link
Author

@Aivean
Here is a the save file in question. just start a craft that requires some time. In this particular world there is nothing around that could tank the performance other then the NPCs

slowdown.zip

@Aivean
Copy link
Contributor

Aivean commented Dec 2, 2020

Thank you.

I can reproduce it. I wouldn't call simulation speed here excessively slow, but yes, as anothersimulacrum above pointed out, game::overmap_npc_move() is taking up 81% of simulation time, which is not ideal.

image

I'll see what I can do.

@Aivean Aivean reopened this Dec 2, 2020
@Aivean
Copy link
Contributor

Aivean commented Dec 2, 2020

On my machine:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed Code: Performance Performance boosting code (CPU, memory, etc.) NPC / Factions NPCs, AI, Speech, Factions, Ownership (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants