- Home /
How do I load in different rooms (Metroid Prime style)
Hey everyone. I have been thinking of different ideas and techniques to streamline a level/room loading system.
I have been looking at the way the Metroid Prime series loads it's worlds. The rooms, surrounding the room you are in, are being loaded as you do stuff in the room you are already in. When a player opens a door to exit the room, the door doesn't open until the room on the other side of the door is fully loaded.
What would be the best way to replicate this level/room loading system in Unity? I just need a push in the right direction. Any ideas will greatly help!
Answer by CodeMasterMike · Dec 20, 2012 at 06:45 AM
If I really needed to have this kind of system, I would use the LoadLevelAdditiveAsync/LoadLevelAdditive function to load the new room or scene. So, I would do something like this:
Option 1 (requires Unity Pro):
Player comes to a door and tries to open it. But the room (or scene) behind the door needs to be loaded before the player can enter.
I load the new scene with the Application.LoadLevelAdditiveAsync function.
When the above function is done and the scene is added to the game.
The scene is loaded and ready, so I open the door and the player can enter.
Link to LoadLevelAdditiveAsync documentation
Option 2 (doesn't require Unity Pro):
Player comes to a door and tries to open it. But the room (or scene) behind the door needs to be loaded before the player can enter.
I load the new scene with the Application.LoadLevelAdditive function.
Now I have to have some kind of check from the new scene, that lets me know its done loading and is running as normal. So I wait until this check lets me know its done.
The new scene check lets me know its ready, so I open the door and the player can enter.
Link to LoadLevelAdditive documentation.
I hope this gives you an idea how you can do it.
To add to the little discussion why you would need a system like this:
I see there is a use for it, if you want to re-use a room, or if you want to split up the world into smaller pieces which may be easier to handle. Just my two euros.
Good luck!
Thanks for the information! I know where to look now! Thanks so much! I'm going to continue doing research about this method. I have a feeling I'm going to be asking more questions about "LoadLevelAdditiveAsync" Lol. You did give a very detailed explanation. Thanks a bunch! If I have anymore questions, I'm sure you will see it! :)
Answer by Alec Thilenius · Dec 20, 2012 at 05:10 AM
If you explain a little more why you want this, I may be able to help more. For rendering, Unity Pro supports Occlusion Areas: http://docs.unity3d.com/Documentation/Components/class-OcclusionArea.html
If you want to implement such a system to save memory, then unless you have a world that is HUGE (I'm talking World Of Warcraft huge) it is not worth loading and unload assets into memory at run time.
Let me know what your end goal is and i'll update my answer.
Thanks for the response. Our end goal is to make a massive space station that players can explore to their hearts content. Also, yep I was thinking of implementing a system similar to this to save memory. I'm ALLL ears!
I would recommend not implementing the system unless it is actually needed. Do you actually have more than a gigabyte of assets? (Compiled assets, not what is in the "Assets" folder). Remember that the actual level itself takes up almost no space. It is only the assets that the level uses that take up memory space (Textures, meshes, sounds...)
This can be done with Unity Pro, using Asset Bundles: http://docs.unity3d.com/Documentation/ScriptReference/AssetBundle.html
Answer by tw1st3d · Dec 20, 2012 at 06:32 AM
You could just have a camera at specific spots, and when you go through a door, the camera jolts to the left/right.
Your answer
Follow this Question
Related Questions
saving the game in position 1 Answer
Creating endless room for endless falling game 0 Answers
Render Extremely Far off Objects 1 Answer
Problem Saving game progress 1 Answer
Save game and load 2 Answers