World Composition for Space Games (UE4 Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Hey, everyone!

Our game, Grimmstar, relies on very large, open-world type sandboxes for our solar systems that we treat as the “level” for progression (each level is a different solar system containing many points of interest). We wanted seamless transitions from location to location, without using fake loading screens (“hey, look! I’m warping, but I’m really not… I’m just loading the next area”).

While practicing my Google-Fu to exhaustion, I came upon a lot of information about Unreal Engine’s World Composition and how it is used for very large levels within Unreal. This seemed like the solution for us, but everything I found on it focused on using World Composition for landscapes and “on-world” locations. While bits and pieces were helpful, there was nothing I could find that was catered for space games like Grimmstar.

As part of the focus of our YouTube channel is to include some tutorial videos for anyone interested in some of the nitty gritty of game development, I decided to do a quick tutorial on how we utilized Unreal’s World Composition tools to achieve our goal.

In this video, I go through initial setup, creating levels for individual celestial bodies like the sun and planets, and how to use Unreal’s “Layers” within World Composition to load/unload levels based on your distance to them. I also do some basic setup to help simulate light emitting from a star in every direction.

I hope this helps anyone looking to create a space game for themselves. I’m happy to answer any questions and I’d be enthralled if anyone knows of any better/more efficient practices than what I show.

Thanks!

👍︎︎ 7 👤︎︎ u/The_Almighty_Foo 📅︎︎ Feb 27 2019 🗫︎ replies

This is really cool, loving the space theme as well :) Definitely not much out there for aerial games with UE4 sadly. Also, where is your game?

👍︎︎ 3 👤︎︎ u/NebulaGames 📅︎︎ Feb 28 2019 🗫︎ replies

Very nice! I like the warp effect. How I handled this problem was to have a point light that was on a channel for just planets, and a directional light that follows the player like you have.

👍︎︎ 2 👤︎︎ u/lowpoly_nomad 📅︎︎ Feb 28 2019 🗫︎ replies

Omg this is exactly what I needed

👍︎︎ 2 👤︎︎ u/FredlyDaMoose 📅︎︎ Feb 28 2019 🗫︎ replies
Captions
hey everybody it's Alex from astronaut e games here recently we posted a video that showcased our open-world sandbox solar system allowing you the travel enormous distances without any load screens now this took a lot of research and trial and error on my end to try and get this implemented and during the process I found out that nothing out there was related to unreal 2 world composition and space games so I thought hey maybe I'll post a video to help out any aspiring game developers as well so let's go ahead and get that started I'm gonna start with a blank slate here I don't want to start in the map that I'm already using so I'm gonna create a new folder to place a new level in just gonna name that tutorial and we'll do a new level I'm gonna call this one Charlie persistence let's go ahead up and lo Charlie decided that Charlie's going to be the name of our star so we have loaded Charlie persistent here there's nothing in this level it is a blank slate which is great what I'm gonna do and this is just gonna be for me not necessarily for you I have a couple things I want to place in here first of all our star generator which is gonna create a star field so I can tell when I'm rotating and moving around and then I also want to place a directional light so we have some basic lighting in here and lastly I'm going to place our player fighter in here so we have something to actually play with and go ahead and change this so everything's gonna work correctly for me and I'm gonna save this project you go ahead and play our star field is there ships there everything's great alright let's go ahead and save that what I'm gonna do to get world composition going is I'm simply just going to enable world composition it's under the world settings tab here and click that we now have world composition enables what that is going to allow us to do is to place sub levels that are going to be parented to the persistent level here that will load in and load out based on our distance from that level so to get that started let's go ahead and just create a level real quick what I'm going to do is create a level for each celestial body so I'm gonna have a level for a start we'll be building two planets and then we'll be nesting another sub level inside one of those planets that's gonna contain our asteroid refinery that we have shown off before let's get started with our star in the levels tab here which you can find if you don't have this by going to window levels it may open a window I just dragged my number here and dock it to the world outliner tab I'm gonna go to levels create new we're gonna call this one Charlie Starr because I'm gonna place my star on this level now Shelley Starr is there but nothing's going on with it yet we haven't activated it we haven't loaded it we haven't made it current right now persistent level is blue and that is our current level we can right-click on Charlie star and click load and that allows it to load all the assets inside shall a star which again is empty we haven't placed anything in there yet so let's go ahead right click and make currents by the way you can always just right click and make current right away without loading first so now Charlie star is our current level what I'm going to do is start up here is just bring in a sphere I'm gonna move that to zero zero zero so it's right in the middle and I'm going to increase its scale by quite a bit you want they somewhat of a large star let me go ahead and give that guy material this is a simple emissive material with a multiplier 400 or something like that so we have our basic star there it is in all of its glory good old Charlie I'm gonna go back to the world outlining here because I want to start instilling some good habits for organization what I'm gonna do just to start off with is create folders for each level in this so we go through Charlie start and persist it so now my player fighter star generator and my directional light are going to persistent this level bounce and the sphere going on Charlie star now level bounds is the size of your level by default it has auto update bounds and nabel's and what this does is it makes the size of the level the size of all of your assets furthest away from the XY and z axes now if you change let's let's go ahead and change the size of our star make it smaller we'll go back to level bounce you see it auto update it so it's just containing the star if we wanted to make things on its own size you can't do that yet nothing happens you have to disable this box and then you can change the size individually if you want for now we're just gonna leave it we're not gonna do anything else with our sphere here let's leave this at 400 in the mean time I do want to drag all of these guys out so they are no longer in the star let's go ahead and save and we'll play real quick as I turn around you should be able to see the star blinding me with all its glory so there it is we have our star let's go ahead and start making our second level here and we're gonna make this one I'll plan it so let's just back up that up here a little ways keep going keep going alright we'll place it right here I'm gonna go back to the level step I'm gonna create new I'm gonna name this one planet X Planet X needs a planet but first we're gonna make it current so that as we place assets in here it's gonna go to Planet X as an example I can turn off charlie star I can turn it back on if I want so I have a little planet generator blueprint here I'm just going to utilize it's there that's a little close to the star there so let's let's move that guy out and those our planet pretty simple it's a little high up right now so let's go ahead and move you down basic blueprint there that's our level one of the other things that we can do to move things around in it so if I go to the levels tab and go through someone's world composition this little button right here I can click on that and you get this basically it's an overview map now it sumed way in especially for the sites that work on enforcer I'm gonna zoom way out so there's a lot of information on here that we have to pay attention to first of all this cursor is our camera this is our star level and this is our planet level this orange box that you see is the recommended maximum size for on Rails alt composition now obviously our planet is outside of that we'll get into that in just a second this green and red intersecting lines the intersect is the world origin now because unreal is a 32-bits engine as you go far enough out the values of the math gets so large that the engine actually your computer starts giving calculation errors so as you go outside of that things start breaking which is why this recommended size is here now if I want to move an entire level and everything in it I can simply move it on here you can see how it updates accordingly which is pretty cool let's go ahead and just save it this way oh you'll see a lady needs to be rebuilt I'm gonna go to world settings and go under light mass if you haven't exposed this already go ahead and expose it and just check this box for snow precomputed lighting that way our lights are dynamic all right so we're pretty good to go here you should be able to see the planet but we can't it's not there so where did it go well the problem that we're running into right now is the planet is so far away that it's not being loaded so if we go back to our old composition overlay here I scroll back out up here we have something called uncharacterized what that is is that actually is a default layer and layers are what both composition uses to load and unload levels based upon view distances that you set now we have a streaming distance of 50,000 on real units which really is not very many at all let's go ahead and create a new layer I'm gonna name this one celestial bodies all my planets of my stars are gonna be in it I'm gonna add three zeros here just because I want something enormous because these bodies I want always loaded now I just shift click get both of these I'm gonna right click assign to layer celestial bodies so they are now on celestial bodies if I were to click and categorized they go away because I've known that layer for you go to celestial bodies they appear let's go ahead and save I'll play those our planet it's visible pretty cool huh that's a very basic outline of that let's get into a little bit more some stuff that you may come across we have a handy-dandy a little more point blueprint here that I'm going to use I'm gonna place one back in Charlie's star I'm gonna make that current so that as I place it if I decide to move Charlie star or points gonna move with it so there's our point or point over there let's go ahead and save I'm gonna play and if I worked through this point see what happens it broke now I know exactly why it broke the reason is it has to do with that 32-bit precision that I keep talking about so we are warping outside the range of this box and as we go out more and more errors occur and because especially since we're warping and moving so fast it's occurring back rather quickly and it just breaks the game just not very fun how do we go around that you might ask well it's really quite simple let me actually move this guy even further out so I can better show this what unreal has built in to counteract this is a little button at the top of the world settings go down a little bit and you see enable world origin rebasing we're gonna go ahead and check that box what that is going to do is as our camera moves this origin where the green and red lines intersect is actually going to move and update with us so as we move along we shouldn't have to run into any calculation errors because we're not going to be outside of this recommended box the box will move with us too so let me bring this up here and I'll showcase this for you now that we have it enabled we go ahead and save I'll hit play and we do the same thing we'll just warp over there watching the lower left you'll see the origin actually shifts with us and we were able to make it to our destination safely one of the things that you may run into while editing is stuff may just suddenly disappear this happens because world origin rebasing is on and I don't know exactly why that is it just is so when I'm editing I tend to just disabled world origin rebasing so that I can load and unload assets as I want I guess levels as I want and that just makes things a little bit easier for me so if you haven't run into some problems I would recommend while editing just disabling this and then before you play makes you turn it back on otherwise you're going to break things alright so we have our basic system in place let's go ahead and add a third planet I'm gonna move it out over here it's additive level we'll call this one on planet y and planet Y let's place another planets place you make you a little bit bigger that's fine I'm gonna change a couple of the colors here just so I can make sure it is distinct from the other planet there we go and let's change the Rings to there we got a blue planet and we got our brown red weird-looking planet now one of the things that I forgot to do kind of on purpose is I did not load planet why I placed this planet in Charlie star so as I unload Charlie star the planet unloads - I'm gonna make this current now you were probably going to run into this so this is why I'm showing this I'm gonna go to world outliner and I'm gonna make sure I actually create a plant-wide folder and let's do it planet next folder let's grab these guys here if you to Planet X and the level pounds go to plan Texas well this planet is going to get a planet why this war points yes charlie and then these level bounds which level balance are you oh the level bounds are here because we still haven't placed this over to the correct level so what I'm going to do is while I have this highlighted in my world outliner I'm going to right click on it go to level and then move selection to current level the shortcut for this is ctrl n so as I move that our level bounce should update and they did so that's a really easy way to just move things between levels and well we still have planet-wide current let's go ahead and create a world point here so we can work there we'll give this a quick little tests well that's kind of hard to see what the Sun in our face isn't it I wonder okay my bed let's review over oh you know what it's not loading because we forgot to place it on the right layer something to keep in mind here so let's go ahead and move you st. Claire Celeste your body's so now I should be able to load and we should all just see it fine even if we move you back and actually just for consistency's sake alright let's go ahead and play there it is so now we can warp from point to point one of the things you'll notice though is the lighting is all off okay and one of the things you'll notice is I tend to forget things origin rebasing alright one last try here there we go so yes you'll notice the lighting is way off because we have the star here but the light is not coming from the right direction how do we fix that well you could go over and find your directional light right here you could rotate it but as I rotate it it's gonna mess up the lighting of that one it's even there ya know the plants look the way that should be but that one's not and then what if my ship's over here I get all sorts of lighting issues so what we've done to fix this is we've actually created a blueprint for our Suns I'm gonna go ahead and show that to you right now let me open up BP Sun here and this is really simple really easy to make it just consists of the same thing that I made the Sun wet to begin with we have a sphere and inside we have a directional light which I just called sunlight in the event graph here what we're doing is we're taking for every tick we're going to use this function called fine look at rotation this is basically going to give us the coordinates from the Sun it's gonna create a line from the Sun to the player-character and it's going to rotate our sunlight in that direction so that no matter where the player goes it seems like the Sun is emitting lights in every direction so just as a quick overview of that we have get player character if it even to get actor location and that's gonna be our target because we want our start of the line to be the sphere which is the Skype here which is our Sun and it's world location so it's gonna draw a line from there to the player and it's going to use that value as the new rotation of this set world rotation and it's affecting the sunlight per tick so let me go to Shelley's star we do have it active I'm going to leave you a un they live back to where it was and just redo the size of it so now we have a new light that's going to update as we play and face light towards it to showcase that I can put a light well it's gonna be a little difficult now there we go you can see how this planet is not lit properly go ahead and play and if I move the ship over there see now it's lit properly because the light updated with us but the problem with this is still a consistency problem the lighting of this planet is not going to be correct actually it may be correct for right now because we have not deleted the other directional light which we don't need so how do we go about getting both planets lit to make it simulate that light is emitting in every direction from the star and so that each planet is lit the way that it should be its face towards the Stars should be lit well what we're going to do is we're going to be using unreal lighting channels for that now unreal has three different lighting channels in which you can tell each asset inside what it wants to be affected by channel 0 channel 1 or channel 2 so I open my blueprint and I go to the actual individual meshes here I can scroll down to lighting and if you haven't exposed this already lighting small you expose that and then you can expose lighting channels I'm gonna turn this off and go to channel 1 and I'm gonna do this for every single mesh that I have in this and then for this guy I'm going to go plant and I'm gonna make this purse or this planet go to channel 2 now our planets are dark which is not exactly what we want but what we can do so I go to Planet why I make it current just disappeared on me so this is what I'm saying with the enable world origin rebasing you'll notice that these other ones just undid themselves and things can get a little weird so I just disable it and then you can make current all of these and you'll be able to see them just fine all right so let's get a light into this scene will do directional light and with the directional light we want to go to the details of that and we want to make sure that under its light settings expand those properties we're gonna set you to channel 2 and only channel 2 we're gonna rotate it first it needs to be rotated 45 degrees I guess that's 90 whatever needs to be rotated like that and then we want to rotate it so that it's actually facing the Sun now yes I do have some graphical glitches I'm not gonna worry about those right now I'm gonna go over here and do the same thing to Planet X make it current dragging a directional light I'm gonna make sure it is only doing channel 1 and it is almost facing the right direction already 45 go south there we go now we have both lit the way that they should be lit from the star and let's do the last part of this just to kind of show this off I'm going to create a sublevel inside of Planet X and we're gonna place a refinery in there so this is gonna show up how you can do different viewing distances within the levels that are nested in a hierarchy to another level so we'll call this refinery and I know my refinery blueprint is way too large so we're gonna sighs that down quite a bit there it is and again we did not place it into the right place current binary level move to current level now what spend the time doing more folder stuff but I'm not going to worry about that for the purpose of this video and what we have here is this guy we're going to nest this level into our Planet X level so if I bring up old composition overview again you got a scroll way out sorry and if I move this level Planet X the refinery is gonna move with it wherever it went that's right over there now as a last little bit here I'm gonna show you so I move this warp point however there should be okay again WorldCom our origin rebasing not turned on go save fullscreen that you can see that you can't see the asteroid map the refinery is not there because it's on the default layer remember so if I warp and get close enough I may need the fast-forward this to show you bear with me here and there it is you can see how it just loaded in because we were within 50,000 unreal units from it so yep that's the basic overview of volt composition for a space game and how we have things set up we're gonna be doing a little more trickery because obviously with only three lighting channels you need a primary for most of your assets you need one for this planet one for this planet but what if you have more than two planets there's some other things that go into that but this should at least give you a basic setup for how to create a space game using world composition that has very long distances for you to travel without any load times if there's any other tutorials you'd like to see in the future please make sure to leave a comment down below and of course if you have any questions we'd be more than happy to answer that thanks for watching guys we'll see you in the near future
Info
Channel: Grimmstar
Views: 44,243
Rating: undefined out of 5
Keywords: Grimmstar, Space, Unreal Engine, Star Citizen, Rebel Galaxy, Indie Game, Game Development, World Comp, world compilation, unreal 4, dynamic lighting, space game, how to create space game, how to make space game, World Composition, world composition tutorial, tutorial, guide, how to
Id: XI9EsCuHHn0
Channel Id: undefined
Length: 24min 59sec (1499 seconds)
Published: Wed Feb 27 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.