What is the best way to load "level" data from a file?

I am working on a brick breaker type game, where each level is a different layout of bricks to destroy.

example
This is an example of what I am talking about, not mine.

Since each level is just a different layout, in my thinking, the best way to handle this is have a data file that holds the layout information and the game would just read in whatever level is needed as the game progresses.

I have considered how to setup a level as a Struct array, or maybe just a Vector array.

My question is would that be the best way to handle this and if so what is the best way to write out that data to a file I can then read back in? While I haven’t made it yet, I have thought through how to create a “level builder” that I would use to create the levels that need to be saved.

I would love to stay just with BluePrints to solve this, however if needed going to C++ wouldn’t be the end of the world.

There’s a base building tutorial (itsmebro channel youtube) series, that maybe has something similar to what you want? He stores the transform and “class type” of each object to be built in the level, adds it to an array, stores it in a SaveGame and then in onbeginplay in your level, or wherever you load a level from, reads the SaveGame file and just loops over and recreates the objects of that class type dynamically at the correct location, rotation etc…
Might not be entirely what you’re after! :o)

I will definitely check this out.

1 Like

yer it’s a little complex to follow, but seems to work fine (altho I did work thru the whole 17 videos lol)!