AnswerBun.com

How to render a large, seamless platforming world without scene transitions?

Game Development Asked by Homo Sapiens on December 29, 2021

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?

2 Answers

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.

Answered by Philipp on December 29, 2021

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)

Answered by Xamtos on December 29, 2021

Add your own answers!

Related Questions

Server Side Movement Box2D LibGDX

2  Asked on August 24, 2020 by doggodonger

     

websockets authentication security

2  Asked on August 3, 2020 by franmcod

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir