How to ACTUALLY Load Levels in Unreal and Make Loading Screens

2024 ж. 15 Мам.
25 861 Рет қаралды

Loading levels is one of the most basic requirements for almost any game. And while Uneal engine provides you with some options, I see most people just using the simple " Open level" node, which is not that great. so today, let's talk about the proper way to do this!
Get the project on Patreon : / 94995004
or as a youtube Member : • Post
Join this channel to get access to perks:
/ @thegamedevcave
Join the discord for any help you need! : / discord
support the channel and development over on patreon : / thegamingcaves

Пікірлер
  • BTW if you don't want to use level streaming you can also: 1) async load Asset (using the level reference) 2) Display loading screen 3) When loading is completed use open level node This removes most of the screen freeze incurred during the loading process.

    @TheEarlsRenegade@TheEarlsRenegade4 ай бұрын
    • that also works out great! I like using level streaming because it allows me to keep my player object around without having to reload all kinda of stuff like HP/ weapon loadout/ level/XP/ etc. But if Level streaming isn't an option for whatever reason (there could be loads of reasons i'm sure!) this seems like a good alternative!

      @thegamedevcave@thegamedevcave4 ай бұрын
    • Most helpful comment ever - thank you! 👍

      @FTChristmas@FTChristmas3 ай бұрын
    • @@FTChristmas no prob 🙂

      @TheEarlsRenegade@TheEarlsRenegade3 ай бұрын
    • I'm making a multiplayer game, and the level streaming part of it was making my head hurt - this helps so much! EDIT: For the open level node, would you say to open it by name or by reference?

      @dudiheadz@dudiheadz2 ай бұрын
    • @@dudiheadzI think that by reference is still better and u will get an entire control on it (with variables, etc..)

      @zork0w@zork0w2 ай бұрын
  • I was looking for this, thank you!

    @BenLeskoGD@BenLeskoGD3 ай бұрын
  • Honestly this'll help me a ton with a massive project I'm working on. Thank you for supplying your knowledge :)

    @noahbrewer2476@noahbrewer2476Ай бұрын
  • Why I haven't seen this video earlier. Thanks!

    @Eroktic@Eroktic4 ай бұрын
  • Great tutorial! Thanks for making this

    @dmangamesSTUDIO@dmangamesSTUDIOАй бұрын
  • This was useful thank you. I love the fact that I finally have a solid way to actually include loading screens into my game. Because I have a feeling I am going to need them. So this was great. Thank you. I will probably replace the casting with an interface because casting isn't the preferred method but still a good tut so thank you.

    @VinoVenitas@VinoVenitasАй бұрын
    • yeah casting to check for the player character isn't great xd you can just "get player character" and use an == node instead, prevents having to do a dynamic cast. Interface is even better. But in reality, casting to the player class actually doesn't matter that much, not casting is about preventing unneeded classes to be loaded into memory but your player'[s class will always be loaded anyway, so you're not actually saving all that much by avoiding the cast

      @thegamedevcave@thegamedevcaveАй бұрын
  • Great Video, Thank you. Joined the discord

    @sum_rains7899@sum_rains78993 ай бұрын
  • This is great please make more videos like this!

    @joel-BB@joel-BB4 ай бұрын
  • Hey there. Great tutorial. For some reason I'm unable to select LEVELS under the WINDOW tab. It's not there. I've reset the editor view back to default also. Where has it gone or what do I need to do to enable it again please?

    @eddielonestar7962@eddielonestar7962Ай бұрын
  • As you mentioned on 5:10, how would you enable visiblility of a speceific loaded level via blueprint? I've been struggeling with that a week now can't find the way.

    @MsomeleShow@MsomeleShow3 ай бұрын
    • i've never really found a context where this is actually relevant but i am pretty sure you just load again, but this time with that box ticked, since it's already loaded, it will effectively just turn it visible without having to load

      @thegamedevcave@thegamedevcave3 ай бұрын
  • Thanks for the video! How do you rotate the capsule my guy is facing a wall? Rotating it normally doesn't work

    @Djackz@Djackz4 ай бұрын
    • you can do it in whatever way works best for you, the way I do it is I have a component that I copy the world rocation and location from onto my character (good to make it an arrow component or something so you can see the rotation)

      @thegamedevcave@thegamedevcave4 ай бұрын
  • bro this was pure gold omfg thank you so much this + ur level streaming tutorial answer'd so many questions of mine ! Im finally understanding how the hell I'm gonna load all these 4K assest's I have without the players PC melting lol ! Thank you so much !

    @ryanjdevlin87@ryanjdevlin874 ай бұрын
    • Glad I could help!

      @thegamedevcave@thegamedevcave4 ай бұрын
  • So you can also use this for culling?

    @nobodyimportant4778@nobodyimportant4778Ай бұрын
  • So what about multiplayer? Rn I have it so from the main menu if you click on LAN multiplayer (this game is lan only rn) It will open level by name with ?listen. From there someone can host and someone can join. Once the other players join (up to 3) The host can start the game. Im doing it rn with a seamless travel and I have a transition map and everything. However this seems so much easier to move a session to a new level. Thoughts?

    @projectgg6730@projectgg67302 ай бұрын
    • not entirely sure on multiplayer, for that I think your original method might work better still, but it's worth trying if loading asynch on the server like this works. I imagine that it would.

      @thegamedevcave@thegamedevcave2 ай бұрын
  • How did you create a World type variable? It doesn't show on my variables type list.

    @musicc267@musicc2672 ай бұрын
    • If you make a variable from that cyan dot by right clicking it’ll make one for you.

      @ghostgamer260@ghostgamer2602 ай бұрын
  • When using Load Stream Level (by object reference) to switch sublevels, is it possible to arbitrarily switch game modes, as setting a new GameMode on the NextLevel side does not seem to override it properly.

    @yorisongs9804@yorisongs98042 ай бұрын
    • sure thing! just gotta set up an event dispatcher in the widget that calls out whenever the button is hit and assign the load function to that event dispatcher

      @thegamedevcave@thegamedevcave2 ай бұрын
  • The best UE guides on whole KZhead

    @skal3802@skal38024 ай бұрын
    • Thanks! happy to help!

      @thegamedevcave@thegamedevcave4 ай бұрын
  • Does this work for waiting for nav mesh to finish generating? I am curious how to fire off an event to know when the navmesh is done generating to close the loading screen.

    @nickbakalos91@nickbakalos9120 күн бұрын
    • I think navmeshes usually dont get generated on runtime so I dont think that's something you have to worry about. navmeshes can update on runtime still, but the base navmesh should be generated beforehand and will simply get loaded in like any other asset in the level. So these events would only run after it's been loaded in I believe :)

      @thegamedevcave@thegamedevcave19 күн бұрын
  • Amazing tutorial, thanks for this ! What to do if i want to make a game when you have a hub, and when you enter a door it randomly teleports you to one of 20 levels How do you make it work ?

    @LeateqOfficial@LeateqOfficial4 ай бұрын
    • I was wondering the same thing!

      @odinzai4769@odinzai47693 ай бұрын
    • A multigate that splits into all 20, and the box marked random is checked

      @SEANandSYD@SEANandSYD2 ай бұрын
  • Hello ! i hope you're doing well ! I have a very big landscape. can this logic work with it ?

    @abdoulraoufgambo@abdoulraoufgambo14 күн бұрын
    • if you're wokring with a big landscape you should probably more so look into world partition

      @thegamedevcave@thegamedevcave13 күн бұрын
  • For my game I'm thinking of using a seamless level loading system similar to Half Life, but without any loading stutters. Do you reckon this would be viable, or should I just accept the loading screen?

    @nuttyak2taps@nuttyak2taps3 ай бұрын
    • for the most part, unreal very much is built to support games without loading screens. this method is kind of a roundabout way to emulate classic games with loading screens. what you are probably looking for is Level streaming volumes. with that, as long as the players is isnide a certain box, it will load in a streaming level (which holds all the assets of that area) and then when you leave it again, it all get's unloaded. Loading and unloading level streams is done on a separate thread , so the game won't stutter when you do it but you do need to make sure that the game has enough time to load in the streaming level (which is why a lot of modern games have things like climbing or crawling sections, those are pretty much just replacements for loading screens)

      @thegamedevcave@thegamedevcave3 ай бұрын
    • @@thegamedevcave Interesting, I recall seeing the level streaming volume and was hoping it'd be used for that purpose. Thanks for the reply!

      @nuttyak2taps@nuttyak2taps3 ай бұрын
  • just a question: if i use water system of ue5, can i do the same level streaming?

    @TheDjscrady@TheDjscradyАй бұрын
    • I don’t think that really will impact eachother to be honest. Aside of course from the fact that water won’t interact with objects until they are loaded in

      @thegamedevcave@thegamedevcaveАй бұрын
  • i don't seem to be able to get the "set actor location" thing to work right

    @EmarStudios@EmarStudios12 күн бұрын
  • But is there any downside in using level streaming? Like, for example, will lighting spill into the other level on baking?

    @user-fm9zo5le2v@user-fm9zo5le2v3 ай бұрын
    • it shouldn't. you can bake the lights in each individual level if you prefer even (every streaming level can be opened on it's own, isolated from evyerthing else as a level) but even if you do bake everything from the persistant level with everything it in, you should't have any overlapping light. you may want to test it to be sure for your usecase though but generally I dont imagine you'd have lights that are big enough to reach from 1 level into the next if you place them a little distance apart, and on top of all that, i assume your levels will have walls that prevent all that to begin with :) No single sollution is perfect though, there's up and down sides to everything but I'm fairly sure that the light situation should be fine.

      @thegamedevcave@thegamedevcave3 ай бұрын
    • @@thegamedevcave Thanks. For my case, my levels will be completely different from each other, different skybox, directional light etc. I wonder if, in that case, there will be any problems. The reason I'm using level streaming is because open level doesn't allow for data persistance very well, if at all.

      @user-fm9zo5le2v@user-fm9zo5le2v3 ай бұрын
    • You should be able to include those directional lights and sky boxes inside the streaming levels but those indeed may cause some light baking issues i can imagine so in that case i would probably just try it out in a test project first to make sure. Possibly baking the levels 1 at a time instead of baking in the persistant level is still an option. Nit ideal though. Might also be easier to simply not bake those lights if you can get away with it xd

      @thegamedevcave@thegamedevcave3 ай бұрын
    • Lights should be always in your persistent level.

      @aleca8910@aleca89103 ай бұрын
  • I have one question I can load Map?

    @roydash5657@roydash56574 ай бұрын
  • you could begin the loading BEFORE you touch the door, and open the level if it's finished loading when you touch the door. and it's still loading then you still have the loading message.

    @jlebrech@jlebrech3 ай бұрын
    • exact implementations depends heavily on your game but you could of course do that! espcially if your levels are small, it would allow you to not have any need for a loading screen in most cases. (then again, if your levels are small, it's probably not an issue either way). Worth keeping in mind that if your streaming levels are very large, having multiple of them loaded at the same time, while it may prevent loading times from getting long, it will also require a good bit more memory. so as always, it's a balancing act which heavily depends on the actual game, it's size, how it's structured and so on :)

      @thegamedevcave@thegamedevcave3 ай бұрын
    • @@thegamedevcave a lot of games have a loading screen corridor.

      @jlebrech@jlebrech3 ай бұрын
    • @@jlebrech that’s a whole separate option, I think it’s an overused and annoying technique personally, I would much rather just have a loading screen instead of mindlessly having to press forward for something that is effectively still a loading screen but now requires me to be there. Of course you can make that more engaging by loading some simple extra things into a corridor like that. Most games do not do that sadly

      @thegamedevcave@thegamedevcave3 ай бұрын
  • lol the best easiest tutorial so far for async loading !!

    @wilismatrix9847@wilismatrix98474 ай бұрын
    • Glad you think so!

      @thegamedevcave@thegamedevcave4 ай бұрын
  • I want each map to have its own volumetric fog, light and sky, this method won't work for that, right? Because from what I understand, you actually have to have the same sky setup and lighting, like they're all in the same level.

    @mobildisko579@mobildisko5793 ай бұрын
    • You shoyld be able to have seperate sky lights and fogs in each streaming level if you need. Or make a system where the color and density of those things is driven by the game mode and whenever you load a level, at the begin play of the level blueprint set the settings you need for that level. Neither is ideal so in this case you might still want to open level the other way instead of streaming levels

      @thegamedevcave@thegamedevcave3 ай бұрын
    • ​@@thegamedevcaveThank you for the answer, I tried to understand what this is and what it is not, eventually I realized that it would not work for my situation. Fortunately, I solved my separate level and save system and it wasn't too much of a problem. Maybe you were not aware of this while making this video, some things are born out of real need.

      @mobildisko579@mobildisko5793 ай бұрын
  • Cannnot find World data type 😕

    @krisnapradyana891@krisnapradyana89128 күн бұрын
    • you can add one by right clicking the load level from object node's world pin and promote to variable. for some reason it's not in the list of variable types.

      @thegamedevcave@thegamedevcave28 күн бұрын
  • I can't find a World variable type

    @alexpineda3422@alexpineda34222 ай бұрын
    • for some reason this is an issue, if you right click the wrold variable type pin on the load level node you can promote it to variable and it'll make a variable of the right type. Not sure why it has to be done in this roundabout way. I believe you can also use a level variable instead of a world though and that should still work, so that's probably why

      @thegamedevcave@thegamedevcave2 ай бұрын
    • @@thegamedevcave There is also no Level Variable

      @krisnapradyana891@krisnapradyana89128 күн бұрын
    • @@krisnapradyana891 just add a "load level by object" node and promote the world pin to a variable. I'm not sure why unreal is so annoying with not allowing users to make world or level varaibles in blueprint.

      @thegamedevcave@thegamedevcave28 күн бұрын
KZhead