0
\$\begingroup\$

In the game Limbo for example, the whole 2-3 hours of gameplay takes place in one continuous world. The player navigates from one area to another seamlessly, with no obvious loading or transitions.

It looks like the whole game world (ie. all the ground sprites and every puzzle) is always active on and off camera. Is that feasible?

How can I make a large world like this without overwhelming the player's device with all the content that needs to be loaded?

\$\endgroup\$
  • \$\begingroup\$ Welcome to Game Development! There are several issues with this question. 1) Not all of us have played Limbo, so if you need to reference something specific in a game, please either add a link to a YouTube video at the exact time, showing what you need, an animated gif, or an image. 2) We don't have a clue about how it's been made, only the developers have this knowledge. 3) If what you want is to reproduce what they have done, then please, ask that: show the desired output, and include what you have tried so far and why it did not work as expected. \$\endgroup\$ – Vaillancourt Jun 22 at 15:58
  • \$\begingroup\$ I've tried to edit your question to ask about the issue I think you're struggling with, using Limbo as an example. As Vaillancourt says, we can't necessarily tell you how Limbo specifically works, but we can help you solve problems in your own game. Please feel free to edit the question if I've missed the mark of what you wanted information about. It sounds though like what you want help with is "level streaming" - where content that's off-screen but about to become visible is loaded "just in time", and invisible content is unloaded to make room. \$\endgroup\$ – DMGregory Jun 22 at 16:01
  • \$\begingroup\$ Thank you @DMGregory you exactly got my point. I didn't know what it was called. I think I should do a bit research on this "level streaming" first and if I get Stuck I will ask for help. Thank you Again. \$\endgroup\$ – Homo Sapiens Jun 23 at 3:41
1
\$\begingroup\$

Well, basic setup of desired configuration can be achieved quite easily in Unity.

SceneManager class has nice methods: LoadSceneAsync and UnloadSceneAsync. They are loading/unloading scenes in the background and provide convenient callbacks when scene loading is complete; you can initialize more than one scene like this:

 SceneManager.LoadSceneAsync("DesiredSceneName", LoadSceneMode.Additive);

This way already loaded scene stays untouched and the second scene is loaded in additive mode. If there are more than one scene initialized, all GameObjects from all scenes are displayed. You have options to Merge Scenes or to Move GameObject from one Scene to another. DontDestroyOnLoad is also nice for objects continuously traveling between scenes.

So the game world is split into different scenes, which are loaded in background and seamlessly linked together. How to arrange scenes loading/unloading is up to you:

  • You can set up triggers near scene borders, which start loading adjacent scenes when entered.
  • You can automatically load neighboring scenes when player crosses scene borders and unload all others so at any time you would have 3 scenes loaded: current, previous and next.

Another important note is that additive scenes might overlap each other, so you'll need to offset objects on each scene or write a script which places scene gameobjects in required location.

(For example, there is popular trick: move all UI to separate scene in additive mode to keep other scenes as clean as possible; UI must not be destroyed when scene is changed after all)

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Modern hardware is powerful and platformers are often pretty lightweight, so keeping the whole game world for a 2-3 hour game in one single scene might not be as infeasible as it might seem. So I would recommend you to just start building your game in one scene until you actually notice problems with low framerate or excessive RAM use... or if you have multiple level designers and need to enable them to work on different parts of the game world in parallel.

When you actually do have the problem, then there are a couple things you can do:

  • Deactivate objects which are more than a couple screens away from the camera and activate them when the player comes into range (usually doesn't do much for RAM but can conserve some CPU and GPU instructions).
  • Convert your game into sections which you load and unload dynamically when the player comes into range. Those sections can be represented by prefabs or by scenes you load with LoadSceneMode.Additive (as in the answer by Xamtouo)
  • Use scene transitions, but hide them well. Place your scene transitions in relatively "boring" areas with no moving objects. Duplicate these sections exactly in both scenes. When the player moves from one scene to another, make sure their position and state get accurately transferred to the next scene. If you do it well, you can hide any indication that there was a scene switch.
| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.