Greetings, programs!
My game levels are completely generated by a C++ class. At the end of the level, I would like to either regenerate the level with the same parameters if the player loses, or regenerate a slightly more difficult level if the player succeeds.
I’m having a hard time as far as figuring out the best way to implement this. There are several possibilities here. Ideally, I’d like every generation to be different. Right now my generation code is in the Construction Script which gives the benefit of being able to see the level in real-time as I make changes in the editor, but for true randomness, it seems to work better if I have the level generated during the OnBeginPlay event (with the cost of not being able to get an editor preview.) If I try to put the generation code in both, then I end up with two levels generated on top of each other, which doesn’t work out, obviously. Although I just got thinking that maybe I could destroy the level and regenerate it again with the OnBeginPlay event? Hmmm…
Anyway, if you have a similar situation, how have you done it? I’m trying to write this while deep in thought, so if I’m not clear on anything, just ask and I’ll be happy to clarify.
Thanks!