Is there any way to get data from an unloaded map?

We’re planning to add a dev start point system to our game that will allow devs to choose a map and a start point to start playing at. This would be done via an in game menu and, ideally, we would be able to set this up so it can be selected and PIE launched directly in the editor.

The issue we’re facing is that being able to reference these start points requires a lot of manual work. They need to be manually added to a separate data asset so that the debug menu can know that they exist and to which map they belong.

We would like to be able to iterate over a list of maps (or perhaps automatically process all maps in a directory), grab all of the start points in that map, and then process those start points (e.g. grab a string value from the start point to add to the debug menu).

Is something like this possible?

Hi Dbrespawn, Welcome to the Forums,

I’m not aware of any way to query data in an unloaded map.

How important is it that the devs need to select a start point and level at the same time?

I’m imagining some system where you have the debug UI to choose from a list of maps, and selecting a map from here will flip a bool like “DevMode=True” in the GameInstance class. (This is important so that the setting is retained through map changes)

And then once you’re in the map you have a system to query ‘dev start point’ (‘Get all actors of class’) and populate a list from that.

Also Editor Utility Widgets come to mind, but I think you’d still need a script to open every map to get info from it.

You can read and write save games during game play, or in editor.

If you make a simple blueprint which holds mapname, checkpoint name, location and other info, they can write themselves to the save game, when you drop them in the maps.

Then it’s easy to know which map to open and where to put the player.

Thanks for the reply. I would say it’s relatively important for it to be done at the same time. Since the start point will affect streaming, mission scripting, and a few other things, it would mean we would have to either trigger a second level load after selecting the start point or we would need to build a specialized flow that blocks a bunch of logic until the start point is selected. It would also mean that we couldn’t fall back to a default behaviour if a start point was not selected, which means the dev flow would diverge from shipping which is just asking for bugs.

Hmm, that might be something to investigate but there are a few issues with it I can think of off the top of my head.

The first is that, I imagine, save files are not created in the project directory and would not be automatically handled by source control.

The second is maintenance over time. In other words, if the data structure in the start point changes in any way, we would have to do a pass to update all the start points in every level.

Finally, I’m guessing that this would all have to be done in a single save file. That’s going to get messy over time as the game grows. I would expect a lot of conflicts.

Yes, I’m not clear if you’re in the editor or in a game.

You can write them so that when you move them or change them, they automatically update the save game.

Yes, I don’t think it’s going to work in this way. But I don’t really understand why devs aren’t just using the editor in the usual manner?

Anyway, it’s an idea… :slight_smile:

There’s basically a way to achieve your overall objective already, very basics – you can tag playerstarts, and then have the player start at the tagged point when the level loads.

Anything more intense than that, such as recreating level state, or player progress state, or whatever, you’ll have to roll your own.

To actually do what you’re asking about, I don’t know if there’s any way to do that by default from the editor, but you could fairly easily write a Commandlet that would load each of your maps, query it for some information or other, and then write it out somewhere where you can use it later.

You could probably slightly abuse the built in automated testing plugin to do the same thing from the editor, if there’s not already some way to do it (or I guess you could probably do it in a Blutility…)

There’s probably a lot of different ways you could get there, but you’re going to have to design something that takes into account whatever you need to ultimately have it do.

Authoring the start points would be done through the editor. Using them would ideally be through both the editor (an option when starting PIE, for instance) and the game (a debug menu).

Sorry, what I meant that is if the structure of the save point changes, then each save point would need to be manually saved again. This might not matter depending on what we’re putting in the save.

I’m not sure I follow you here. What is the usual manner that allows devs to select a specific start point to use when launching the game?

I think you already realize this, but just in case, this is the same as the original problem. Something somewhere still needs to associate those tags to a map so we know which start points are available in the map.

This wouldn’t be the worst solution. If there was something that we could run (especially if it can be done by the build machines) that would parse all the maps and dump that info into a file, that would be good enough. Can you point me to docs and/or an example of a commandlet that does anything close to that?

I can’t think of anything simple right off hand, but there’s GatherTextFromAssetsCommandlet over in Engine\Source\Editor\UnrealEd that might give some insights on how to do something like that. It can iterate a list of assets, including maps, and pull information from the objects in them.

Other possible ideas, you could subclass PlayerStart, and have it store information somewhere whenever it’s position or other attributes change, or you could implement CheckForErrors() in it, and have that done every time a Map Check is performed

What my project is using right now is a pretty massive library of saved state data files, and our debug menu has a button for each one of them. I hate that system, and really wish we had something better than that, but I don’t have the time to/i’m not getting paid for redesigning and rebuilding it.