draconisPW / PWMAngband

A free, multi-player roguelike dungeon exploration game based on Angband
35 stars 11 forks source link

new lvl gen crush #626

Open igroglaz opened 3 months ago

igroglaz commented 3 months ago

character entered the game (inside of the dungeon) and got crush https://youtu.be/hcveTNiHVgI

As it's (walls == 0) problem, maybe it's because in T we replace walls with floors sometimes to make more interesting layout... like this: ` wall:obj_grass2 f:300

wall:obj_grass2 g:300

wall:obj_grass2 h:300

igroglaz commented 3 months ago

https://github.com/igroglaz/Tangaria/commit/767c82cd398ceaf8e03163619a55571c5c0dcada

draconisPW commented 2 months ago

Above commit doesn't do anything because when walls = 0 the code already doesn't care about walls (square_num_walls_adjacent returns 0). The problem happens before: either square_isempty() always returns false, square_isvault() always returns true or square_isno_stairs() always returns true. Since the first two cases seem unlikely (level completely filled with objects or just consisting of one big vault), I suspect the issue comes from the third case: all floor features on the level prevent the generation of stairs.

Note: generate_starburst_room() and build_room_of_chambers() make floors SQUARE_NO_STAIRS, so if there is nothing more on the level than just starburst rooms or rooms of chambers, no stairs will be ever generated. This is because these type of rooms are generated with many deadly monsters and stairs inside would be a death sentence for players arriving in one. Room types like "huge" use starburst room code and can easily take the whole dungeon, leaving no other space for stair placement.

igroglaz commented 2 months ago

in T it does the job. crushes stopped :) maybe it's due differences with PWMA code stair gen code

draconisPW commented 2 months ago

Yes because you removed the "quit" line. However the commit itself does nothing, the code doesn't work and doesn't do anything to fix the problem. Instead of "quitting", the code continues normally and simply doesn't place any stair. The risk is having someone land on a level with no stairs to leave.

igroglaz commented 2 months ago

AFAIU problem appears rarely with one staircase which game fail to place. So if it placed several stairs and fail to place one - it's alright.

Anyway you are welcome to make proper fix and commit it to T repo :) Thanks for getting into this issue.

draconisPW commented 2 months ago

Commit 75126493406e4042b266b007fa9705e21792c5d0 fixes a memory leak and dumps the level for post-mortem analysis when stair placement fails. You should revert your code and use this instead to understand what truly happens so we can come with a proper fix.

See generated file: dumpedlevel.html when server quits due to failed stair placement.