Gameplay suddenly gets very slow

Bug #1522290 reported by xxx-deleted
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
High
Unassigned

Bug Description

After 05:20h on a big map with 8 players the game suddenly slows down to approximatly 1FPS. The UI and mouse movement lags. I cannot identify a specific event causing the slowdown.

However, around 10 of my soldiers got into a deadlock during an attack. They are just standing around. They are neither attacking nor returning to their own buildings. This happend already some time before the sudden slowdown, so this has probably nothing to do with the issue.

Steps to reproduce:
1. Load the attached savegame
2. Play a few minutes --> The slowdown shoud happen

Tags: performance

Related branches

Revision history for this message
xxx-deleted (janosch-peters-deactivatedaccount) wrote :
Revision history for this message
xxx-deleted (janosch-peters-deactivatedaccount) wrote :

Attached logfile

Revision history for this message
kaputtnik (franku) wrote :

Thanks for your bugreport :-)

We will look at this... currently all developers are a bit busy. So this is just a comment to say that your bugreport was noticed ;)

Revision history for this message
TiborB (tiborb95) wrote :

Main reason for slowdown is gamesave. Did you run it in windowed mode to see in real time what is being printed into terminal?

I usually, pause the game, wait til fps gets back and then increase speed back...

Revision history for this message
GunChleoc (gunchleoc) wrote :

I get a significant drop around 5h 22min in the attached savegame, so this is confirmed. Thanks for reporting :)

Changed in widelands:
status: New → Confirmed
importance: Undecided → High
milestone: none → build19-rc1
tags: added: performance
Revision history for this message
xxx-deleted (janosch-peters-deactivatedaccount) wrote :

@TiborB: I attached the logfile. I do not see anything suspicious in there.

@all: I could "fix" the slowdown by fixing the aforementioned problem where the soldiers got stuck and wouldn't move. This issue (and how to resolve it) is described in #1395238. I ran in to the same problem a few hours later, this time with a lot more soldiers. The game slowed down to around 0.25FPS. I believe that the slowdown is connected to the "soldiers stuck" situation. It looks like the slowdown is proportional to the amount of soldiers being blocked.

Revision history for this message
GunChleoc (gunchleoc) wrote :

We have a bug about soldiers getting stuck somewhere - these bugs are hard to reproduce. Are there stuck soldiers in the savegame that you attached? Could you give a bit of a description / a screenshot so we can find the sport on the map easily?

Soldiers getting stuck bugs:

https://bugs.launchpad.net/widelands/+bug/1395238 (recent)

https://bugs.launchpad.net/widelands/+bug/730070 (this one is pretty old)

https://bugs.launchpad.net/widelands/+bug/1251914 (might be fixed)

Revision history for this message
TiborB (tiborb95) wrote :

Can a problem be this?

MO(8557,road): splitting road: first part:
MO(8557,road): * (43, 101)
MO(8557,road): * (44, 100)
MO(8557,road): * (45, 100)
MO(8557,road): second part:
MO(8557,road): * (45, 100)
MO(8557,road): * (46, 100)
MO(8557,road): * (47, 100)
MO(8557,road): * (47, 101)
MO(8557,road): * (48, 101)
MO(8557,road): * (49, 101)

I tested the savegame few times, but everytime I would say it happened shortly after this. Can anybody confirm?

Revision history for this message
TiborB (tiborb95) wrote :

'splitting road' probably will not be a culprit at the end..

Revision history for this message
xxx-deleted (janosch-peters-deactivatedaccount) wrote :

I think we should focus on solving #1395238 because I am quite sure those two problems are related. If soldiers do not get stuck, the game does not slow down.

However, even if there is a bug causing soldiers to get stuck, the game should not slow down. The goal of this bugfix should be to make the codebase more robust even in pathological situations like this one.

Revision history for this message
xxx-deleted (janosch-peters-deactivatedaccount) wrote :

I just did some testing and recognized some important aspects:

* The game speed does not slow down but the framerate decreases
* Its only noticable if you accelerate the gamespeed (try 3x or 4x)
* One core of my CPU is at 100% when the situation ocurs (game speed: 3x)
* The slowdown starts when the opponents returned from the battlefield to their buildings (shot005). As long as they are on the battlefield, their is no slowdown (shot004)

Revision history for this message
xxx-deleted (janosch-peters-deactivatedaccount) wrote :

Added shot005.png. This is the situation where the slowdown occurs.

Revision history for this message
xxx-deleted (janosch-peters-deactivatedaccount) wrote :

I am pretty sure that the problem are the repeating calls to start_task_movepath. I created a patch which requires attacking soldiers to find an unblocked path to do so. If they do not find one, they retreat.

I posted the patch on Bug #1395238:

https://bugs.launchpad.net/widelands/+bug/1395238/comments/6

Revision history for this message
TiborB (tiborb95) wrote :

Are not they already on their way home? Generally I dont like additional flag only_unblocked, I think algorithm should be common for all bobs. Of course animals usually are not so crowded.

Revision history for this message
TiborB (tiborb95) wrote :

Oh, I looked better, indeed this is about attacking not heading home...

Revision history for this message
xxx-deleted (janosch-peters-deactivatedaccount) wrote : Re: [Bug 1522290] Re: Gameplay suddenly gets very slow

My solution is rubbish. Please ignore the patch. If I start an attack
with +10 soldiers, only half of them make it to the enemy lines. The
others return to their building before they even started an attack.

I am currently trying to implement GunChleocs idea [1] of random
destinations to break up the deadlock.

[1] https://bugs.launchpad.net/widelands/+bug/1395238/comments/8

Am 08.12.2015 um 13:43 schrieb TiborB:
> Oh, I looked better, indeed this is about attacking not heading home...
>

--
--------------------------
Janosch Peters
Südmährenstraße 78
85586 Poing

<email address hidden>
0151 40 25 25 69

Changed in widelands:
assignee: nobody → Janosch Peters (janosch-peters)
Revision history for this message
SirVer (sirver) wrote :

Fixed in r7687.

Changed in widelands:
status: Confirmed → Fix Committed
GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.