Download

Level selection - Storing level meta data?

Hello,

I want to make a level selection system where each level has some meta data that can be displayed when selecting a map. As an example think of an RTS where you select a level and then a small map of it comes up with spawn positions, map size etc.
I have a couple questions regarding this so here goes:

I was wondering if there is any way of storing additional data for a level which can be retrieved without loading the actual level?

In case there is no way how should I then go about creating the custom files for storing this data?
I know about reading/writing to a file but is there some unique setup/folder location to place things so they get properly packaged and working?

Any recommendations for how some custom data could be set inside the editor and saved to files? Just very simple data would be a nice start.

Thanks

I would just create a struct which contains the extra level meta data you’d like to display. The struct could contain the dimensions of the level, the name, etc. and then when you go to load a level, the struct could contain the necessary console command you’d use to travel to the level. When you create the level, the struct for that level would be created as well, and saving the level updates the struct data. You could treat this level struct as a record. Creating a list of levels would just be a matter of iterating through these structs to get the meta data and displaying it. When a player wants to load a level, the level is selected by picking one of the structs with level meta data. I imagine its pretty straight forward from here…

Indeed I was a little quick to post last night before going to sleep. I actually thought about the idea of putting the info into structs or classes. They could just be registered in the init function of the gameinstance or something similar and then be available for iteration whenever the game starts. There would also be no need to think about writing/reading from files either.

The meta data object should naturally store the name of the level it related to. Since levels can only be referenced with text there could be some mismatch between the names. This could be dealt with in the register function by iterating through all the available maps and compare it to the registered meta data object. Upon a mismatch being found you could write an error message to the log or do an assert.

This is the approach I will take since it is straightforward and simple to implement and of course cover my own needs.

Perhaps if anybody knows of some situations where this approach would not be appropriate/applicable because of the type of data needed to be stored etc they could share some insight? It could be helpful if others find the thread in the future.

Thanks for quick reply:)

Level name = the name of an entry in some data table (for constant stuff like max height, map size, etc)
Level name = the name of a savegame (of your own) slot which contains a list of flags that you then check on the level bp/on begin play to do stuff like removing some actors, unlocking doors, etc.

More stuff can be done but it depends on the game :slight_smile:

There is a great example if you look at the UT source code :slight_smile:
Would be a good place to start if you are dealing with a multiplayer project, might give you some ideas!