More help with game logic - MainMenu, Loading new levels, loading screens

Ok, so after tweaking a bit more of the functionality, I think I have it ready to put together my first 3 levels.
I have designed each individually in their own map. Meshes, textures, targets and all.
All 3 levels use the same GameMode, instance, pawn, playercontroller, etc.
Currently, when I load the game, in GM I load a MainMenu Widget.

  1. First, I would like to move this to its own map when the game starts. From there do I just use an OpenLevel(by name) node to open the subsequent levels when the user clicks Play???
  2. Currently, this is loaded from GM. Obviously I don’t want GM to load this on every level.
    Should I move the code that loads the widget in the MainMenu map (level-blueprint)?
  3. I would like each level to have a widget that opens first (including objectives, directions, etc specific for each level. Is this a good candidate for using the level-blueprint or is there a different way to achieve this? Is the level-blueprint ever used for anything??? lol
  4. When the user clicks Play from MainMenu, I want to load Level1. Level1 should load with its own widget (objectives/directions bla,bla…)
  5. When the user clicks “Start Level” from this widget the game starts.
  6. When the level ends… I want to display another widget that shows the stats for that level (Whether the level was completed, points etc etc).
  7. If the level is completed there’s another button to “Continue” on click this opens Level2… so on so forth
    If the level is not completed, return the user to MainMenu.
  8. Currently, in the MainMenu, I use a loading screen animation → delay it by 3 seconds and load the full widget. Is there a way to loop an animation while the level is loading?? And fully load the rest of the widget when the level is ready to be played?

What do you guys think? Any tips/ideas? Stuff to look out for/avoid?

hi,
here is a nice short tutorial about persistent levels, loading screens and splitting all up

say´s ue4 but works in 5+ too

hope this helps you :slight_smile:

p.s. this guy has a bunch of videos… they are all short and to the point…

cheers :vulcan_salute:

Thank you so much! Love that guy.
Following his tutorial, I’m having a couple of issues…

Issue #1:

I stream the levels with splash screens, load the MainMenu and on clicking “Play” I load Level1.
In Level1 I would like to be able to load my Warehouse level.

Think about the following structure:

Level1 (has targets, lighting, ppv, etc)
*Warehouse (should load when Level1 loads)

Level2 (has targets, lighting, ppv, etc)
*Warehouse (should load when Level2 loads)

…
so on

For each level (Level1,2,3) Under Levels window I added Warehouse as an additional level. (Changed it’s streaming method to “Always Loaded”)

Back in the MainLevel, when I start the game The Warehouse never gets loaded.
If I switch from “Always Loaded” → “Blueprint” and call “Load Stream Level” (Warehouse) it loads, but because it loads from Level1 all the props that are contained in Level1 start falling, because there’s no ground to hold them. Lol. Once Warehouse is loaded it’s catching some of them.

Issue #2
After MainLevel, streams everything, SplashScreen, MainMenu, when I click “Play” from MainMenu, my PlayerStart is ignored and the player spawns at (0,0,0).
My PlayerStart is inside each level (Level1,2,3) in case I want to customize the starting position for each level.
How can I fix this???

hi,
will be back in ~1 hour… will look at it… but you could try to put your warehouse in a single level, then load first the warehouse and if done load level 1 or two and when all finished start game…

be back soon :vulcan_salute:

Much appreciated. Any ideas are welcomed!

Another issue that I just happened to find is… for each level I have a DataTable structure that holds the amount of bullets and targets for each level.
The problem with that is… in GM I get the current LevelName → look up in the table, and get that info. Now… the Current Level is always the MainLevel (persistent streaming level). Sigh…

1 Like

hi,
i made it so my level is made out of 2 parts… 1 is the solid mesh, all other stuff (lights, physic actors,…) is loaded in the second part…

here is a quick preview

these are all components / levels i used

i made a custom game instance



which will hold the current level name (which you can just pull for your data table) and the PropsName → which will be all other stuff that needs the level before implanting ^^

persistent level (level bp)

splash screen (level bp)

main menu (level bp) which has a simple interface, the same as the widget main menu


widget main menu


here you could pull the names out of an struct array which holds them both or have a better idea than that :slight_smile:

loading screen (level bp)

this is the level base (meshes and colliders)

and here is the second part… level props is everything that depends on the level and it´s colliders… i also packed all the lights in here

finally the interface for the main menu, very simple

i hope this helps you :slight_smile:

cheers :vulcan_salute:

That’s because the first level you load should have the collision for the level. You may have to build your own for the level. Collision should always be loaded, so that can be set to Persistent/Always Loaded.

With that said AustrianMunzter seems to have it figured out.

@AustrianMunzter

Fantastic! Thank you so much for all the detailed info. It works beautifully.
Thank you! Thank you! Thank you!

@AustrianMunzter

One quick question though… for the moment I moved the PlayerStart actor in the MainLevel.
It works fine and for the first 3 levels I haven’t even thought about moving the starting position.
But, if I do decide later on that the position should be different for each level… how would I go about that??? It seems that it only works if PlayerStart is in the MainLevel (persistent lvl). Otherwise it spawns the pawn at (0,0,0)

hi,
you could spawn the character by yourself not through default pawn or have a different game mode for the loading screens and the level (last loaded, props in this case) would have the normal game mode and the player start… i removed the default pawn and if all is loaded i spawn my actor with an event to some Vector3 location.

hope this helps you :slight_smile:

cheers :vulcan_salute:

One more thing if you don’t mind…
After each level is played, at the end, when the user runs out of ammo, I end the level with a widget (EndLevel). In the widget, I connect to the GameInstance and check to see if all the targets were destroyed.
If Yes → means level is completed. → Load Next Level (Level Name)
If NO → level is not and can be restarted.

I am using this widget for the ending of every level (Level1, Level2…)
How can I make a generic code so that I can set the next level to be loaded in the GI?
I always know the current level, but I need to be able to setup a variable for the next Level Name. Level1->Level2->Level3. Either a concatenation, or some sort of keeping track.
I.E.after Level2 which is the next to load… since I’m using the same widget at the end of each level.
Hope I’m not making it too confusing

Sort of like…
if current level is L1 - Level Name = L2
if current level is L2 - Level Name = L3
…
so on

Nvm, I figured it out… in my DataTable I just added another column for each level for the NextLevel.
L1->L2
L2->L3
…
That way if the level is completed, I look in the datatable, check which lvl this was and what is its corresponding NextLevel.
Thank you so much guys for all your help.
I’m sure I’ll be back soon with more questions :smiley:

1 Like

could u help with my post?? Need help with my swipe controlls.