Chaosforge Forum

  • December 15, 2017, 10:35
  • Welcome, Guest
Please login or register.



Login with username, password and session length
Pages: [1]

Author Topic: Help w/ level generation crashes  (Read 184 times)

Uranium

  • Greater Elder
  • Second Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 196
  • Heavier Than A Death In The Family
    • View Profile
Help w/ level generation crashes
« on: October 16, 2017, 13:15 »

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: [Select]
function hospital.OnGenerate()
generator.reset()
generator.generate_tiled()
end
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!
« Last Edit: October 16, 2017, 13:23 by Uranium »
Logged
Use power for power.

scotherns

  • Elder
  • Sergeant
  • *
  • *
  • Offline Offline
  • Posts: 78
  • Lost Sole
    • View Profile
Re: Help w/ level generation crashes
« Reply #1 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.


Logged
[26|26|22|15|7|0]
Arch-Vile Marshal

32/43 Medals

Uranium

  • Greater Elder
  • Second Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 196
  • Heavier Than A Death In The Family
    • View Profile
Re: Help w/ level generation crashes
« Reply #2 on: October 17, 2017, 02:43 »

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.

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...
Logged
Use power for power.

Tavana

  • Elder Chaos Guard
  • Brigadier General
  • *
  • *
  • Offline Offline
  • Posts: 659
    • View Profile
Re: Help w/ level generation crashes
« Reply #3 on: October 17, 2017, 04:00 »

Try this:

Code: [Select]
function hospital.OnGenerate()
generator.reset()
generator.run( generators.gen_tiled )
end
Logged
Common words do not mean common understanding. Language is mercurial. Meanings are never constant.

Uranium

  • Greater Elder
  • Second Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 196
  • Heavier Than A Death In The Family
    • View Profile
Re: Help w/ level generation crashes
« Reply #4 on: October 17, 2017, 07:10 »

Ah, thanks very much Tavana! Works great!
Logged
Use power for power.

Tavana

  • Elder Chaos Guard
  • Brigadier General
  • *
  • *
  • Offline Offline
  • Posts: 659
    • View Profile
Re: Help w/ level generation crashes
« Reply #5 on: October 17, 2017, 22:19 »

Glad that helped! :)
Logged
Common words do not mean common understanding. Language is mercurial. Meanings are never constant.
Pages: [1]