DoomRL > Modding
Help w/ level generation crashes
Uranium:
so, i've started to put together a module for the first time (the first version of which i *hope* to have released by halloween but ehhhh), but i'm running into issues with randomly generating levels. the first map is an entrance map, upon exiting via the stairs, the game freezes. My module.onGenerate() is simply
--- Code: ---function hospital.OnGenerate()
generator.reset()
generator.generate_tiled()
end
--- End code ---
which is exactly the same as in the doomrl source, and as far as i can ascertain, should produce no errors whatsoever. I suppose it's correct in that it doesn't actually produce an error, it just freezes the game. Any help appreciated.
cheers!
scotherns:
I don't actually have the source, but would guess that generator.generate_tiled() is causing your hospital.OnGenerate() to be called again, giving you an infinite loop.
Uranium:
--- Quote from: scotherns on October 17, 2017, 02:04 ---I don't actually have the source, but would guess that generator.generate_tiled() is causing your hospital.OnGenerate() to be called again, giving you an infinite loop.
--- End quote ---
This makes sense - i had this suspicion as I couldn't find raw code for generator.generate_tiled(). If i replace it with generator.generate_caves_dungeon() (which I can find the code for) I expected it to work, as generate_caves_dungeon() doesn't have any reference to an OnGenerate() hook and seems completely self contained, but it still seems to jam the game in an infinite loop.
I hope I'm not missing something horrendously obvious...
Tavana:
Try this:
--- Code: ---function hospital.OnGenerate()
generator.reset()
generator.run( generators.gen_tiled )
end
--- End code ---
Uranium:
Ah, thanks very much Tavana! Works great!
Navigation
[0] Message Index
[#] Next page
Go to full version