Forum rules - please read before posting.

[Request] Tracking the progress of loading a game, similar to loading a level

edited October 2019 in Engine development

Hi there!

I'm trying to achieve the smoothest experience possible in my game and, in some ways, loading a game is similar to loading a level. But, unless I skipped or missed something the docs (which is definitely possible), there's currently no way in loading a game asynchronously (for instance, during a camera fadeout), and to activate the loaded game, just in the same way we do for loaded levels.

For instance, when opening a door, I start loading the scene as soon as the open door animation starts, and all the way until the camera fadeout is completed, in parallel.
When both the fadeout and loading is complete, I can activate the new scene and fade it in. Typically the loading takes less than the fadein/out time.

I'd love to be able to do the same when loading a game. That is, instead of having a fadeout and a wait, or the screen freezing and a wait, having the game loaded during the fadeout.

Tracking the scene loading progress from 0 to 90% (callback, events) in the meanwhile would be a boon, with the ability to switch scene/data manually (last 10% as per Unity decision) (the actual data would be applied contextually to scene activation) or automatically.

I also noticed that savegames are bound to build order index. That is, if I change the order of the scenes, the savegame may get... unusable (I have not tested this).

In my experience I had to remove a few scenes from the build to speed up testing, but doing so the loadgame feature failed, since the index of the scene it was looking for was not present in the build anymore. But, actually, it was.
Maybe... we can refer to savegame levels via string, or, probably even better with an unique ID, using the same ID system used for other assets?

I understand this may have... a lot of consequences and it would definitely take some time to test, but I'd love a similar feature to be implemented.

Comments

  • Save data loading can't be "manually activated" in the same way that scene loads can be, but the OnBeforeLoading and OnFinishLoading events can be hooked into to run additional code during this time.

    The Always reload scene when loading a save file? option in the Settings Manager can be used to to asyncronously reload the scene when loading a save file set in the same scene.

    Tracking the scene loading progress from 0 to 90% (callback, events) in the meanwhile would be a boon, with the ability to switch scene/data manually (last 10% as per Unity decision) (the actual data would be applied contextually to scene activation) or automatically.

    The OnBeforeChangeScene event is called before the scene-switching process begins, and you can get the current loading progress with:

    AC.KickStarter.sceneChanger.GetLoadingProgress ();
    

    Scene switching occurs at 90% automatically, but v1.70 will allow for this to be completed via a separate function once an event hook at 90% has been fired.

    Maybe... we can refer to savegame levels via string, or, probably even better with an unique ID, using the same ID system used for other assets?

    Mapping to scene names would be problematic due to them not having to be unique, and the ID system applies to GameObjects - not assets. I appreciate the issue here, but I feel this is more a limitation of the way Unity currently handles scene management.

  • edited October 2019

    Thanks! :)

    Mapping to scene names would be problematic due to them not having to be unique, and the ID system applies to GameObjects - not assets. I appreciate the issue here, but I feel this is more a limitation of the way Unity currently handles scene management.

    Yet, you overcame a bigger Unity object-reference problem with inter-scene references by introducing IDs in a very clever way.

    I know it's a Unity limitation, but, maybe, we could have a Scene Lookup Table, in a similar way you implemented the Music and Ambience List, and allow us to assign Unique symbolic references by linking ID (or string pseudo) to scene name/scene Asset?

    Especially for newbies, having to pick the target level from a popup list created from such table would avoid problems when moving around scenes in the build orded, or renaming them.

    If such table existed, the savegames could preserve their validity even when changing build order or renaming the scenes, since they would look for a specific asset ID (which is definitely less prone to changing), or, a lookup table such the one I suggested (which means, you could even change the asset ID, but everything the save system cares about is the internal symbolic name/ID).

    I believe that would be 100% robust, unless I'm unconsciously ignoring something else.

    Of course, this is a feature request, I'm fully aware that it requires some work to implement, and that it may not be compatible with your design choices. :)

  • The Music/Ambience lists etc are possible because runtime code is able to reference their asset files.

    The ultimate issue here is that Unity requires that scenes be referenced by number/name in runtime code - with asset file references only being available in the Editor. This means that there's still a reliance on scenes being correctly set in the Build Settings for it all to work.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.