Game Stuck When Changing Map - Bug?

11 replies [Last post]
Firework
User offline. Last seen 22 weeks 6 days ago. Offline
Joined: 2013-01-11
Posts: 32

Hi,

I have recently updated to 0.9.23 on Windows and started to have this problem:

When setting up a new game to play and clicking on the image below "Map preview:", sometimes HW "gets stuck" showing just the timer symbol and never displays a new map. At this point HW either won't let me start a game (clicking Start does nothing) or the game "hangs" when it starts to load. It is worth pointing out that this happens only sporadically - sometimes it might happen after clicking the map once or twice, at other times it might be possible to click many tens of times before this issue kicks in.

I never experienced this problem with previous versions and haven't made any other changes to my system other than installing the latest HW. However, it is now happening quite frequently and is in particular making online play difficult, as when it happens I need to close HW (sometimes via Task Manager).

Has anyone else noticed this? Just wondering why this happens and could it be fixed?

Many Thanks.

TheRipper
User offline. Last seen 41 weeks 1 day ago. Offline
Joined: 2014-03-31
Posts: 5

Hi,

I have the same problem with new version. I also tried to update display drivers, but it didn't help. I'm interested to know what features are changed in "Map preview" window?

TheRipper

nemo
nemo's picture
User offline. Last seen 2 hours 34 min ago. Offline
Joined: 2009-01-28
Posts: 1642

Nothing should have been changed in map preview. I've encountered this periodically for a long time though. I'd assumed it was due to restrictions on multiple hwengine processes that had been put in long ago.

Could you perhaps share a preview0.log next time this happens?

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

TheRipper
User offline. Last seen 41 weeks 1 day ago. Offline
Joined: 2014-03-31
Posts: 5

Hi,

Thanks for your comments. I removed all the log files before testing. Here is one example of the preview0.log when it hangs:

0: [Con] Init SDL_Net...
0: [Con] ok
0: [Con] Establishing IPC connection to tcp 127.0.0.1:49503
0: [Con] ok
0: [Cmd] seed {8affd533-b396-4b81-8067-86ef4f99a29f}
0: [Cmd] $template_filter 0
0: [Cmd] $mapgen 0
0: [Cmd] $feature_size 12
0: Ping? Pong!
0: [Con] Generating preview...
0: [Con] Selected template #37 using filter #5
0: [Con] Sending preview...
0: [Con] Preview sent, disconnect
halt at 0 ticks. TurnTimeLeft = 0

I can't see any significant changes in this file when preview works or when it hangs.

Firework
User offline. Last seen 22 weeks 6 days ago. Offline
Joined: 2013-01-11
Posts: 32

Thanks for your replies. At the moment I have changed the "Map Type" to "Image map" to work around the bug. The image maps are nice, however, I miss using the "Randomly generated" maps, which I had previously been using.

Firework
User offline. Last seen 22 weeks 6 days ago. Offline
Joined: 2013-01-11
Posts: 32

I tried temporarily disabling my anti-virus (Avast Free) but the issue still persists.

TheRipper
User offline. Last seen 41 weeks 1 day ago. Offline
Joined: 2014-03-31
Posts: 5

Workaround to this problem

I changed the Hedgewars process to use only single CPU / core. After the change everything worked fine without hangs. Setting the affinity mask it's possible to force the Windows to only use the CPU / cores selected. When the Hedgewars process is set to use only single core only one thread is running at a time. Because of this feature I think the problem is somehow related to the multi-threading, synchronization etc.

Please correct if I'm wrong or you have a better ideas...

How to change the affinity:
-Launch Hedgewars
-Open Task Manager
-Select Processes tab
-Find hedgewars.exe process
-From pop-up menu, select "Set Affinity"
-From the CPU list, select only CPU 0

Change the affinity automatically by creating a new shortcut:
-Create a copy of Hedgewars shortcut
-Select shortcut -> Properties
-Copy the following line to the Target (make sure the directories are correct):
C:\Windows\System32\cmd.exe /C start "Hedgewars" /affinity 1 "C:\Program Files (x86)\Hedgewars 0.9.23\hedgewars.exe"
-Click OK

Firework
User offline. Last seen 22 weeks 6 days ago. Offline
Joined: 2013-01-11
Posts: 32

Thanks for your workaround! Smile

I used Task Manager to set Hedgewars.exe to use only CPU 0 and could no longer reproduce the issue.

I tried the shortcut method but could not get it to work. When opening the shortcut the console opens briefly and closes again - but Hedgewars never launches. The path looks okay - but I changed Program Files (x86) to just Program Files. This is because I am using an older Windows XP PC and Windows XP does not have separate folders for 32-bit and 64-bit programmes. Also, my processor has 2 cores.

TheRipper
User offline. Last seen 41 weeks 1 day ago. Offline
Joined: 2014-03-31
Posts: 5

Unfortunately WinXP Start-command doesn't support affinity-parameter.

You can copy PsTool package from Microsoft:
https://docs.microsoft.com/en-us/sysinternals/downloads/pstools

Unzip package and copy psexec.exe-file to your windows folder.
Copy the shortcut as I explained earlier and set the following line to the Target:
psexec -a 0 -d "C:\Program Files (x86)\Hedgewars 0.9.23\hedgewars.exe"

-> edit directory as needed

nemo
nemo's picture
User offline. Last seen 2 hours 34 min ago. Offline
Joined: 2009-01-28
Posts: 1642

Good news for you guys...
https://hg.hedgewars.org/hedgewars/rev/7caa4ec513bd

unc0rr made a build of hedgewars.exe only, here, which you guys can try.
https://hedgewars.org/download/releases/Hedgewars-0.9.23-frontendfix.zip

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

TheRipper
User offline. Last seen 41 weeks 1 day ago. Offline
Joined: 2014-03-31
Posts: 5

Great work nemo & unc0rr. It seems that new exe-version works perfectly. I tested a new version to generate preview picture more than 100 times without hang.

Thanks a lot!

Firework
User offline. Last seen 22 weeks 6 days ago. Offline
Joined: 2013-01-11
Posts: 32

I tested the new build of hedgewars.exe and it works perfectly for me. It never hangs no matter how many times I choose a random map.

Many thanks for your help. Smile

Copyright © 2004-2017 Hedgewars Project. All rights reserved. [ contact ]