How to ACTUALLY Load Levels in Unreal and Make Loading Screens

Поделиться
HTML-код
  • Опубликовано: 26 сен 2024

Комментарии • 112

  • @IWillYeah
    @IWillYeah 9 месяцев назад +83

    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.

    • @thegamedevcave
      @thegamedevcave  9 месяцев назад +16

      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!

    • @FTChristmas
      @FTChristmas 8 месяцев назад +6

      Most helpful comment ever - thank you! 👍

    • @IWillYeah
      @IWillYeah 8 месяцев назад +4

      @@FTChristmas no prob 🙂

    • @dudiheadz
      @dudiheadz 6 месяцев назад

      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?

    • @zork0w
      @zork0w 6 месяцев назад

      @@dudiheadzI think that by reference is still better and u will get an entire control on it (with variables, etc..)

  • @noahbrewer2476
    @noahbrewer2476 6 месяцев назад +1

    Honestly this'll help me a ton with a massive project I'm working on. Thank you for supplying your knowledge :)

  • @VinoVenitas
    @VinoVenitas 6 месяцев назад +1

    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.

    • @thegamedevcave
      @thegamedevcave  6 месяцев назад +1

      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

  • @devinbrasher6752
    @devinbrasher6752 3 месяца назад +4

    You skipped promoting the LevelToLoad to a variable.

    • @Arengan
      @Arengan 3 месяца назад

      @ghostgamer260 replied this in the comments with "If you make a variable from that cyan dot by right clicking it’ll make one for you." and iit works. He refers to the cyan dot at the load Stream Level node

  • @Eroktic
    @Eroktic 8 месяцев назад +3

    Why I haven't seen this video earlier. Thanks!

  • @Dan-codes
    @Dan-codes 14 дней назад

    Could you cover multiplayer level streaming/loading setups please?

  • @ryanjdevlin87
    @ryanjdevlin87 8 месяцев назад +3

    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 !

  • @skal3802
    @skal3802 9 месяцев назад +2

    The best UE guides on whole RUclips

  • @BenLeskoGD
    @BenLeskoGD 8 месяцев назад +1

    I was looking for this, thank you!

  • @Skyrim973
    @Skyrim973 22 дня назад

    I would like to text word partition myself, they say it doesn't work but I want to try it.

  • @Flowerpot2905
    @Flowerpot2905 3 месяца назад

    Great content. Just what I was looking for.

  • @IN-terestShorts
    @IN-terestShorts Месяц назад

    Open level By Name is not working properly in Multiplayer. please show how to do this in Multiplayer

  • @artist_art_sol
    @artist_art_sol 2 месяца назад +2

    How to specify in a variable the same type "world" as you have specified for levels? I can't find it in the name dropdown when I assign a variable type?

    • @thegamedevcave
      @thegamedevcave  2 месяца назад +2

      yeah for some reason it's not in the dropdown, if you just right click on the load level node's input and promote to variable it'll work though.

    • @ART_SOL_GAMES
      @ART_SOL_GAMES 2 месяца назад

      @@thegamedevcave I understood it. How can I indicate such a link in the structure or input/output of some interface? no way?

    • @thegamedevcave
      @thegamedevcave  2 месяца назад

      @@ART_SOL_GAMES yeah i dont think so sadly. if you want to setup an interface to load your levels you can do it with a string, as there also is a load level by name node you can use. I personally don't like it because it's easy to make a typo but if you have to use it in an interface, it's probably in only real option you have in blueprint.

    • @ART_SOL_GAMES
      @ART_SOL_GAMES 2 месяца назад

      @@thegamedevcave Thanks a lot! You helped me a lot. This is what I do using names.

    • @johnrex7108
      @johnrex7108 17 дней назад

      @@ART_SOL_GAMES Actually I found this out myself. The 'World' type variable that Unreal's levels use is listed within a struct variable called 'Soft World Reference', just set that into any function/interface's input/output variable and then BREAK it. That will give you access to 'World' type and you should see the same kind of list of levels as you do when using Unreal's Open Level function.

  • @Skyrim973
    @Skyrim973 21 день назад

    Some people say in youtube that Level Streaming dont work very well and them say that is bether persistent levels and use a save system for this. And what about word partition? It work?

    • @thegamedevcave
      @thegamedevcave  20 дней назад

      I’m using this way to load in and out about 25 levels at the moment, with plans to scale up to over 100. Have never had issues. Of course, don’t load all at the same time while working on things but there’s really non-issue that I’ve ever seen. Anyway, world partition really is something else, more for loading chunks of a bigger level instead of loading smaller levels or more specific sections of a level. It’s aimed at open world like games.
      Carrying persistent data with save object…. Is a thing you can do but I don’t love that either honestly

  • @4rzky536
    @4rzky536 3 месяца назад

    finally i found what i was looking for, but i still haven't found it, just a few actually, like how to combine it with a progress bar or percentage, so in the loading screen we can see how much longer

    • @thegamedevcave
      @thegamedevcave  3 месяца назад

      about 99% of progress bars you see in games are actually straight up fake, just showing an estimation of how long the dev thinks you'll take to load a certain scene. (which is also the reason that a lot of games will often hang at 99% loading, because the computer is slower than what the devs expected).
      there is a function called "GetAsyncLoadPercentage" in c++ which you could use to display true loading times (more or less) but it's a slow operation which will make the loading take even longer, but if you do it on something like a 0.2 second timer or something, you might be fine to use it. As far as i know, with just blueprint you wont be able to do this, and that is most likely because rarely would you actually make a proper accurate loading bar.
      as with so many things in game dev, games often straight up lie to people to make them feel better.

    • @4rzky536
      @4rzky536 3 месяца назад

      ​@@thegamedevcave I didn't expect you to give such a detailed explanation, but yeah, so far I've never found an explanation on how to display the level loading time in percentage form, most suggest adding a delay, say 2 seconds, but I think this is unfair, if the user is using a high end PC this is a very long time, but if they are using a mid or even low end PC, 2 seconds is a very, very short time, they will even arrive when all the levels have not finished loading, I find this very often especially in indie games, the level is already open but is still in the loading stage, such as textures, lights, even static mesh, thank you for taking the time to explain this in detail😊

  • @dmangamesSTUDIO
    @dmangamesSTUDIO 5 месяцев назад

    Great tutorial! Thanks for making this

  • @DJDCRYPTER
    @DJDCRYPTER Месяц назад

    Just stumbled upon your channel and got to say there is some amazing content which is helping me a ton. But for some reason with this tutorial the first level loads fine but when I hit the part where it should switch to level 2 it just get stuck on the loading screen and does not progress further. Any idea why? (i'm using 5.4).

  • @chris-xi7uo
    @chris-xi7uo Месяц назад

    hi so i have maps that when loaded occupies the same space and when loaded they overlap how can i move them so they dont overlap each other

  • @FPChris
    @FPChris Месяц назад

    If I'm currently in Level 1 and I load a save game that is Level 3 it dumps the save game when Level 3 is loaded and you have to load it again to continue parsing data. Seems wrong to load the save game data twice? Are people doing it a different way because I don't see a why around it.

  • @belekass
    @belekass Месяц назад

    What should i do if my level is too big. What I mean is the character is in floore or sometimes under it

  • @jlebrech
    @jlebrech 7 месяцев назад

    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.

    • @thegamedevcave
      @thegamedevcave  7 месяцев назад

      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 :)

    • @jlebrech
      @jlebrech 7 месяцев назад

      @@thegamedevcave a lot of games have a loading screen corridor.

    • @thegamedevcave
      @thegamedevcave  7 месяцев назад

      @@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

  • @roydash5657
    @roydash5657 8 месяцев назад +6

    I have one question I can load Map?

  • @sum_rains7899
    @sum_rains7899 7 месяцев назад

    Great Video, Thank you. Joined the discord

  • @MsomeleShow
    @MsomeleShow 7 месяцев назад +1

    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.

    • @thegamedevcave
      @thegamedevcave  7 месяцев назад

      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

  • @EmarStudios
    @EmarStudios 4 месяца назад

    i don't seem to be able to get the "set actor location" thing to work right

  • @joel-BB
    @joel-BB 8 месяцев назад

    This is great please make more videos like this!

  • @eddielonestar7962
    @eddielonestar7962 6 месяцев назад

    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?

  • @bakaabsolute1253
    @bakaabsolute1253 4 месяца назад

    do you know how we can restart sublevel ?
    for example, u spawned 10 new actors in sub level A, you load sub level B then unload sublevel A, but yours 10 actors spawned dynamically will still be in the game

    • @thegamedevcave
      @thegamedevcave  4 месяца назад

      So the issue here is that spawning actors spawns them into the persostant level, not into the same sub level that the spawner exists in (which is really annoying) in c++ you can give it a level to spawn in, as far as i know, blueprint doesnt let you do that so a workaround is to keep an array of actor references on the spawner and when the spawner is destroyed, it loops through that array and destroys all those other actors too. Not an ideal sollution but it'll work

  • @crunchycoconuts6917
    @crunchycoconuts6917 Месяц назад

    You forgot to link your video in the card up top.

    • @thegamedevcave
      @thegamedevcave  Месяц назад

      i'm kind of surprised nobody mentioned that before this moment. I added it now :)

  • @COACH_KARSTEN_OPPINIONS-xs3xn
    @COACH_KARSTEN_OPPINIONS-xs3xn 2 месяца назад

    Does this mean, that if my player picks up a weapon, and then goes to the next level, the weapon will not be there, because the weapon belonged to a different instance?

    • @thegamedevcave
      @thegamedevcave  2 месяца назад +1

      if the weapon is just an actor that you place on your player yeah. so either weapon spawns will need to be in the persistent level or picking up a weapon should not just move the existing object to the player's hand but instead set a child actor component on the player to turn into that weapon's class, and then you can copy over any needed data from the weapon in the level into the child actor component on the player.

    • @COACH_KARSTEN_OPPINIONS-xs3xn
      @COACH_KARSTEN_OPPINIONS-xs3xn 2 месяца назад

      @@thegamedevcave thanks so much 🙂
      I will try to accomplish that. I only learned few days ago how to move back and forth between levels, so I have a LONG way ahead. I have SOME background in the OO-universe, which made me think in "instance variables" and .self and all that, and thought this may pose a challenge.

  • @musicc267
    @musicc267 7 месяцев назад +3

    How did you create a World type variable? It doesn't show on my variables type list.

    • @ghostgamer260
      @ghostgamer260 7 месяцев назад +3

      If you make a variable from that cyan dot by right clicking it’ll make one for you.

  • @nobodyimportant4778
    @nobodyimportant4778 5 месяцев назад

    So you can also use this for culling?

  • @RV-bc9yi
    @RV-bc9yi 3 месяца назад

    Hum, hum Thanks for this video! My character keeps falling. Should the BP be in the persistent or in their levels?

    • @thegamedevcave
      @thegamedevcave  3 месяца назад +1

      player character probably best to be persistent

    • @RV-bc9yi
      @RV-bc9yi 3 месяца назад

      @@thegamedevcave Ok, ok it's my bad, i forgot check "Make Visible After Load" in BP Level !

  • @nickbakalos91
    @nickbakalos91 5 месяцев назад

    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.

    • @thegamedevcave
      @thegamedevcave  5 месяцев назад

      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 :)

  • @yorisongs9804
    @yorisongs9804 7 месяцев назад

    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.

    • @thegamedevcave
      @thegamedevcave  7 месяцев назад

      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

  • @projectgg6730
    @projectgg6730 7 месяцев назад

    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?

    • @thegamedevcave
      @thegamedevcave  7 месяцев назад

      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.

  • @wilismatrix9847
    @wilismatrix9847 9 месяцев назад

    lol the best easiest tutorial so far for async loading !!

  • @LeateqOfficial
    @LeateqOfficial 8 месяцев назад

    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 ?

    • @odinzai4769
      @odinzai4769 7 месяцев назад

      I was wondering the same thing!

    • @SEANandSYD
      @SEANandSYD 6 месяцев назад

      A multigate that splits into all 20, and the box marked random is checked

    • @Tommyboi7566
      @Tommyboi7566 19 дней назад

      Random int in range then do a Switch on int node add pins based on the ammount of rooms you want then on pin one load level 1 pin 2 level 2 ec

  • @TheDjscrady
    @TheDjscrady 6 месяцев назад

    just a question: if i use water system of ue5, can i do the same level streaming?

    • @thegamedevcave
      @thegamedevcave  6 месяцев назад +1

      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

  • @mobildisko579
    @mobildisko579 8 месяцев назад

    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.

    • @thegamedevcave
      @thegamedevcave  8 месяцев назад

      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

    • @mobildisko579
      @mobildisko579 8 месяцев назад

      ​@@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.

  • @nuttyak2taps
    @nuttyak2taps 8 месяцев назад

    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?

    • @thegamedevcave
      @thegamedevcave  8 месяцев назад +3

      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)

    • @nuttyak2taps
      @nuttyak2taps 8 месяцев назад

      @@thegamedevcave Interesting, I recall seeing the level streaming volume and was hoping it'd be used for that purpose. Thanks for the reply!

  • @BubuRuzu
    @BubuRuzu 8 месяцев назад

    But is there any downside in using level streaming? Like, for example, will lighting spill into the other level on baking?

    • @thegamedevcave
      @thegamedevcave  8 месяцев назад

      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.

    • @BubuRuzu
      @BubuRuzu 8 месяцев назад

      @@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.

    • @thegamedevcave
      @thegamedevcave  8 месяцев назад +1

      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

    • @aleca8910
      @aleca8910 7 месяцев назад

      Lights should be always in your persistent level.

  • @abdoulraoufgambo
    @abdoulraoufgambo 4 месяца назад

    Hello ! i hope you're doing well !
    I have a very big landscape. can this logic work with it ?

    • @thegamedevcave
      @thegamedevcave  4 месяца назад

      if you're wokring with a big landscape you should probably more so look into world partition

  • @alexpineda3422
    @alexpineda3422 7 месяцев назад

    I can't find a World variable type

    • @thegamedevcave
      @thegamedevcave  7 месяцев назад

      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

    • @krisnapradyana891
      @krisnapradyana891 5 месяцев назад

      @@thegamedevcave There is also no Level Variable

    • @thegamedevcave
      @thegamedevcave  5 месяцев назад

      @@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.

  • @krisnapradyana891
    @krisnapradyana891 5 месяцев назад

    Cannnot find World data type 😕

    • @thegamedevcave
      @thegamedevcave  5 месяцев назад

      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.

  • @rifat.ahammed
    @rifat.ahammed Месяц назад

    One of the best video about async level load

  • @Djackz
    @Djackz 8 месяцев назад

    Thanks for the video! How do you rotate the capsule my guy is facing a wall? Rotating it normally doesn't work

    • @thegamedevcave
      @thegamedevcave  8 месяцев назад +1

      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)