I have a dungeon generating algorithm, but I would like to generate X levels, which are all connected somehow.
I have a few approaches, but all of them has problems and questions, and I wonder how i.e. Diablo II handles them so seamlessly.
1. Approach: Upon leaving a level, generate the next one on the fly.
This would be the easiest, but would result in a relatively long loading screen everytime the player enters a new level.
So generating the levels should be at the beginning of a new game, thus the next level will just have to be loaded, which is much faster. In theory not even a loading screen is necessary.
2. Approach: Generate every level at the beginning of a new game and store them.
- Okay, now levels just have to be loaded, which could be done under half a second. No loading screen is necessary, maybe just a fade out-fade in.
- How do I store them?
- Make custom files (i.e. scriptable objects) for them, or is there a simpler way?
3. Approach: Generate and load every level at the beginning.
Zero loading time, because everything is already generated and loaded into the tilemap.
But how do I guarantee that levels don't collide, and the player can't see level Y from level X if there are lots of levels?
And wouldn't it affect the performance? Because everything is loaded all the time. Yes, renderers, rigidbodies, scripts, etc can be turned off, improving the performance a lot... but still... this seems wrong.
What is the best way to solve this problem?