I’m new to Unity, have built and deployed a few very simple games based on official and Youtube tutorials, as you know is common to use SceneManager.LoadScene to load scenes based on its buildIndex.
When playing commercial AAA games I notice how at any point I can bring a complex game menu (for example a world map, an inventory or skill/level-up screen) with videos, animations or 3D models I can zoom, rotate, etc. And then transition back to gameplay instantly, also often the gameplay is loaded and paused in the background just blurred.
Question 1: Is SceneManager.LoadScene fast enough to create this quick transition (between current and “game menu” scenes) or maybe studios use another method? How is the “game progress” transferred across scenes so at any point game menu show new discovered areas on map, or the status of quests, or new items on inventory or altered appearance of main character?
Question 2: is common in AAA open world games to explore big areas without loading screens, how this functionality is being reproduced in Unity? Given that the whole world does not fit on memory and is not contained on a single scene. My guess would be physical triggers are placed on scene x such that scene Y loads but that wouldn’t allow the player to continue exploring without lag… also, assuming some way of procedural loading of sections of an open world, how games like GTA V allows you to see landmarks of very far away places? (which I guess that section is not loaded on memory yet)
I’m not working on a big project, I’m a hobbyist but after beginning on Unity I get many of this questions when playing games…I appreciate guys your time and your opinions, suggestions or any info you can provide me.
As for question 1, pretty sure it’s just fancy animations and a paused world outside of the menu. Though I personally don’t know how to do that.
For question 2, you can have separate terrain “blocks” with varying LODs (level of detail) based on their distance from the player, and with things like agents on that terrain not rendered until you’re near. So you can still see far away, but it’s not rendered in as high of detail as it would be were you near it (and thus uses less computational power).
This is kind of a weakness of Unity though, from what I understand. Other engines do this (question 2) better.
You can use additive scene loading or mark objects with “DontDestroyOnLoad()”. For stuff that’s not accessed often there’s also PlayerPrefs… but just like the name says, that’s really meant for preferences (stuff that you read occasionally and set rarely).
However… all of that stuff you mentioned is just good ol’ data. Programming is about handling data, so there’s plenty of ways to store and manage it. And something that plenty of newcomers to Unity miss is that there’s a whole Mono (.NET) system at your disposal. You do not have to stick to the Unity API for persistent data. You can read and write files, store data in non-Unity objects of your own creation, and every other option that you might consider as a programmer if you need to persist some data in an environment other than Unity. It’s all there for us.
That’s somewhat of a challenge!
There’s three issues here. The first is loading stuff in and out, as you’ve mentioned. The catch isn’t so much the loading, though, it’s the toolchain and workflow around that. Multi-scene editing makes this a heck of a lot nicer than it used to be, but still, Unity doesn’t have native tools built in to support large-world editing. You’re going to want to do something custom here.
As for the loading, keeping track of what should and shouldn’t be loaded and then using LoadSceneAdditiveAsync(…) is a good start.
The second issue is floating point precision. This only matters if your game goes far from the origin (more than a few kilometers, assuming 1 unit = 1 meter), but if you do then chances are you’re going to need to keep the current playable area somewhere around the (0, 0, 0) point of your world. Otherwise physics interactions will get less accurate and spoil stuff.
Third, you’ve got garbage collection. I’ll leave you to look up what that is and its drawbacks for games. For most games it’s not an issue as you can front-load stuff to avoid GC. In an open world game you generally need to stream stuff in as you move around, though, which makes allocation unavoidable, which in turn makes garbage collections unavoidable. Fingers crossed Unity can help out with this one as their scripting tech advances.