Procedural generation not working as expected?

  • I followed a tutorial to create a procedural generating dungeon map. It works perfectly if I start the game on the dungeon level, but if I start on the main menu and go to the dungeon layout, it doesn't do the entire generation.

    The flow for it is that it fills the map with the 'wall' sprite, then spawns in room and hall markers, then deletes the walls that aren't trimming a room or hall, finally spawning in monsters, items and the player.

    When I start on a different layout and go to it, it gets as far as spawning the room centres (used for calculating where to put the hallways), then stops.

    This is the tutorial I used : construct.net/en/tutorials/procedural-dungeon-generation-a-roguelike-game-708

    I stripped out my variations on it and what I'm not using is a word-for-word copy of this tutorial, and this hasn't addressed the issue at all (slowly re-adding my tweaks lol)

    Can someone help me figure out what's going wrong?

    I've tried changing it from Sys>On Start of Layout to Sys>On Loader Layout Complete, but that didn't work. I also tried having a variable control whether or not to run the generator, and that also didn't work. Perhaps there's something up with the way I'm switching layouts? (I'm using Sys>Go to layout)

    Any input would be much appreciated, given this is my college assignment lol

  • Are you saying it works as expected if you load into the layout but not if you come from another layout? If that's the case then share your file or events, it is probably an easy fix. If you're saying it never works as expected then that sounds like you didn't follow the tutorial correctly and well I've got no time for going through that =D

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • drive.google.com/file/d/1jf3KQyyEeK9RizwaTI2vBxFddu4hyY1q/view

    I don't know if I did this right lol, I uploaded it to my drive. I basically isolated the procedural generation section, tested to see if it has the same issues - it does. I'm still a bit new to construct 2, this is rather complex for me lmao

  • It's using 'tickcount' logic which starts counting from when you start the game. This works fine if it's the first layout but of course if you go from another layout it has already gone beyond tickcount=2 for example. You could replace tickcount with another condition, such as a global variable that acts as a timer.

  • Ah ha! I tweaked it to use a variable to keep track of which "stage" it's at in the generation, it works perfectly now. Thank you very much :D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)