Procedural game design (C++ only'ish)

Hi,

I’m looking to generate random maps for my game using C++ mostly, and my gut feeling drew me to trying to use generated instances of ULevels stored in an array in some MapManager class. However, I have run into some problems. For instance, it seem the UCLASS(minimalapi) disallows (as far as I understand) that I use the ULevel class. I want to generate maps when needed throughout the game, each linked with gateways/portals.

As it is a top-down 2D tile based game, with movement limited to tiles as well, I’m going for a pretty simple/minimalist pathing methods, collision detection as well as directional unit vision. Thus my idea was to simply write it all in C++ as I’m very familiar with that and have a lot code stored from previous work.

Question:
How should I best structure the C++ code for storing and loading and unloading maps? Should I for instance, drop the minimalapi to use the ULevel for levels or are there better methods?

Generate maps/levels on runtime and save them to current game while playing. Generation during level changes for instance or maybe in a background thread if I decide to get fancy, but that’s not important now.

You want to random generate them in editor you want game to autogenerate them and save on runtime?

Then you looking in wrong direction, ULevel is asset class (same as UTexture or UStaticMesh) to hold premade levels as assets. where real class that manages state of the world is UWorld and i think what editor does is transfer UWorld state of level in editor in to ULevel.

As for storage, depending what you use to structure your level, they should be stored together with game save file as entire world state is saved (or else something is marked to not be saved with Transient specifier). Problem might be with storeing BSP data if you plan to use that (if oyu use meshes there should not be a problem). Alternaticly you can make you generator seed predictable, tore the seed and reconstruct the level anytime.

Thank you, that cleared up a few things. I was of the impression that UWorld used ULevels to switch between maps. Thanks for the hint of using a seed. I did not think of that. I suppose UWorld would be fine with me loading and unloading a maps on runtime?

Hmm there might be better functions somewhere else to load level from ULevel asset there also level streaming you might be interested, but UWorld allow you to restructure the level whatever you like even make it complitly diffrent