Random Map Generator Crash

Having trouble with the game? Report issues and get help here. Read this first!

Moderator: Forum Moderators

Forum rules
Before reporting issues in this section, you must read the following topic:
Post Reply
Mabuse
Posts: 2395
Joined: November 6th, 2007, 1:38 pm

Random Map Generator Crash

Post by Mabuse »

Random Map Generator Crash

When i use Random Maps, sometimes it crashes on Maps creation.
It happens with default map generator, on very big maps, especially when setting mountain very high and clicking often on "create new map".

But more often with custom Maps Genrator, as well more likely on big Maps and repeated generation.
Any Idea why that is? I feel like it should not happen.

May PC is pretty solid, so it should not be hardware related like too low on memory or something.
Is it long known and just dealt with?
The best bet is your own, good Taste.
dwarftough
Posts: 622
Joined: August 4th, 2019, 5:27 pm
Contact:

Re: Random Map Generator Crash

Post by dwarftough »

Does it crash the whole game or just shows an error? More information on how you get the result and what you see would be nice
Co-founder and current maintainer of IsarFoundation, Afterlife Rated and overall Wesnoth Autohost Project
MP versions of classical mainline campaigns: UtBS, TRoW, SotA
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
Biased RNG in MP
gnombat
Posts: 975
Joined: June 10th, 2010, 8:49 pm

Re: Random Map Generator Crash

Post by gnombat »

I tried it myself just moving the sliders for "Width", "Height", "Number of Hills", and "Max Hill Size" all the way to the right, and when I clicked "Close" it crashed immediately.

It didn't display any message, but there is this message in the log:

Code: Select all

error mapgen: No castle location found, for 2 players aborting.
Mabuse
Posts: 2395
Joined: November 6th, 2007, 1:38 pm

Re: Random Map Generator Crash

Post by Mabuse »

dwarftough wrote: September 4th, 2025, 5:34 pm Does it crash the whole game or just shows an error? More information on how you get the result and what you see would be nice
crash the whole game to desktop, like it cannot handle too much of height iterations or whatever, causing an overflow
gnombat wrote: September 4th, 2025, 6:28 pm I tried it myself just moving the sliders for "Width", "Height", "Number of Hills", and "Max Hill Size" all the way to the right, and when I clicked "Close" it crashed immediately.

It didn't display any message, but there is this message in the log:

Code: Select all

error mapgen: No castle location found, for 2 players aborting.
the error massage i didnt check so far, but yes, crashes immediatly, sometimes after clicking a bit generating another map.

now i would have thought that this is something well known, as it happened also in 1.16 version (and most likely earlier, but i didnt care too much about random map genration before), i just decided to ask why it is, because it kinda annoys me, to crash to desktop every time (as said especially it happens also with well known random map generators like URM, and even more then). big maps, big mountains seem to crash generator.

and i also once tried generating maps for SXRPG (quite some years ago) but got to a point where it crashed all the time, and i didnt know what the exact reason was, maybe code, maybe generator, so i gave up on this one.
The best bet is your own, good Taste.
gnombat
Posts: 975
Joined: June 10th, 2010, 8:49 pm

Re: Random Map Generator Crash

Post by gnombat »

It seems like this is issue #1415 although that is marked as "Closed". :?
Soliton
Site Administrator
Posts: 1755
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: Random Map Generator Crash

Post by Soliton »

Cannot reproduce a crash with the method mentioned by gnombat. I do get the mapgen error in the log but wesnoth does not crash and shows no map instead.

Would be good to get a backtrace from someone that can reproduce the issue.
"If gameplay requires it, they can be made to live on Venus." -- scott
gnombat
Posts: 975
Joined: June 10th, 2010, 8:49 pm

Re: Random Map Generator Crash

Post by gnombat »

Soliton wrote: September 12th, 2025, 2:48 pm Cannot reproduce a crash with the method mentioned by gnombat. I do get the mapgen error in the log but wesnoth does not crash and shows no map instead.
Try this:

Code: Select all

ulimit -s 512
It will almost certainly crash after that.
Attachments
backtrace.txt
A (truncated) backtrace from version 1.18.5.
(15.63 KiB) Downloaded 21 times
Soliton
Site Administrator
Posts: 1755
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: Random Map Generator Crash

Post by Soliton »

Ok, so generate_river_internal recurses a bit too much so you can run out of stack space. Looks like it recurses for every river hex. We should rewrite that to tail call recursion or really no recursion.
"If gameplay requires it, they can be made to live on Venus." -- scott
Post Reply