Managing large worlds

Hello friends :slight_smile:

I’m currently very frustrated with managing large worlds. My current setup is a bunch of scenes called cells, which are gridded and are automatically loaded and unloaded depending on the distance from the player.

This works great in game, but not so much in editor.

It’s not uncommon to have many cells open at once, making it not exactly easy to have manipulate objects around and such: I drag a prefab to the scene, which adds it to the “master scene”. I then have to figure out which cell the object should be in, so I can drag it correctly. It may sound dumb, but doing this a lot adds up to a lot of time. Perhaps I’m being nitpicky, if so don’t be afraid to tell me. :slight_smile:

I plan on adding more layers (groups of cells that overlap), so one layer may be terrain and another may be objects. This would mean I have finer control over what is loaded at what distance, but only multiplies my current problem.

One idea that I’ll probably end up using is simply having a button where you can select what layer you want the selected object to be moved to, and on press it automatically figures out which cell to move to. I just happened to think of this idea as I’m typing this post, no idea why I never thought about that before :')

I’ve looked into world streamer, which while it certainly looks extremely powerful, it also looks even clunkier than my system.

I’ve considered creating a builder of sorts that would go through a “layer scene” and basically detect which objects should go in what cell scene, and basically automatically generate it. My worries with this is that this could result in never quite knowing where things could end up, especially with children objects being removed from their parent when they shouldn’t be.

Are there any examples of open world/large world games made in unity that have explanations on how they did this sort of thing? It’s incredibly hard to find any info on open worlds in Unity.

Quite honestly any tips or thoughts about large worlds or open worlds would be very appreciated! For me and anyone else who happens to find this thread. Thank you!

-Josh

Honestly this is part of the overhead you get with managing a large game world.

It sounds like you are looking for a “black magic” system that will abstract away all the fiddling, thing is any systems that do exist as such will take away control from you, limit the scope of what you can do and in general will make you dependent on them.

All successful games that have large worlds deal with this and unfortunately you will have to as well. Yes world streamer is okay but I always opt to use my own systems for this stuff.

If your struggling with scene editing, write yourself some nice scene editing tools by looking at
http://catlikecoding.com/unity/tutorials/ to get familiar with editor scripting. That way you can make it easier to control what your dragging to, clicking on etc based on what you need.

If your struggling with inspector editing, write yourself a nice custom inspector to make this easier.

If your struggling with prefab creation, write an editor window wizard to make creating them easier.

Essentially whatever the problem, tools are your answer! I always make my own rather than use someone elses as its harder at first but easier in the long run - less headaches working out other peoples code.

Important Things to look into for large worlds:

  • Floating Precision
    **- Floating origin (**move the entire world and recentre around player when they move X from origin to ensure floating precision.
    -Async Loading
    - Threading - threadpool, threads, Async tasks, mixing coroutines with threads, tasks, taskfactory, etc
    - Compute shaders - can use the GPU to do a lot of the overhead if there are any values having operations done on them
    - Gizmos - Allows you to draw special scene bound objects to help build useful scene editing tools
    - Handles - Gizmos that you can interact with and get feedback from. Combine this with all the above to create a glorious scene editing tool
1 Like

Ah thank you friend. I know about most of these things, I currently have a custom editor that let’s me load in cells in editor and such, with nice little gizmos and such. I’m hoping I don’t end up needing to fix floating precision, my world isn’t going to be that big, I know that Skyrim actually never needed to solve for it, but of course they have different units. However I did not know of compute shaders, that looks extremely interesting!

Some of those tutorials look awesome too, thanks!

1 Like