Scene switching noob question

Hi,

I installed Defold today, checked out the sample projects, completed the War battles tutorial, made more changes, played it on the browser with my xbox controller after deploying it to a local web server, it was easier than I thought, I’m so exited about this engine.

Anyway, I need to understand the basic concepts of scene transition similar to the ones that take place in the Colorslide tutorial (which revolves around collection proxies).

My problem is… I think I attempted this tutorial too soon, because even if I manage to get it to work (the back button currently doesn’t work), I still don’t think I’d understand what is really going on because I was too busy coding animations, creating gui files, gui scripts, changing other scripts, deleting code that I thought was needed… all of it as part of this particular tutorial, during my first day of working with Defold…

My question is, are there any other tutorials or any other samples that show me the basics of scene transition?
I don’t mind if each scene just has a label and a button.

Sorry I don’t want to criticize, I appreciate the effort taken for preparing these tutorials, it’s just that it’s late here in Australia and this is probably a sign for me to head to bed and try again tomorrow.

Thanks in advance for any help.

Cheers!

1 Like

Welcome!
I had the same problem undestanding the messages to load, enable and unload a collection. But it’s super simple! First read the Defold Collection proxy manual: https://defold.com/manuals/collection-proxy/
then you can check an example (called “Menu and Game”) on Britzl’s public examples

Have a nice one!

4 Likes

Brilliant!!
Thank you very much Alex

1 Like

Welcome @jdavid82!

Just like @Dat_Indie correctly points out screen/scene transitions are usually handled by loading and unloading collections via collection proxies. The screens/scenes could also be spawned and removed using collection factories, but I think it is most common to load/unload using collection proxies.

There are assets which can help you with this. One example is Monarch.

1 Like

Thank you @britzl.

I’m planning to make a top-down Facebook “instant” game.

I’m currently investigating two things, first if it’s possible to launch the game just with the initial menu screen, then once the player is ready and taps “start match” then download the chosen game scene and unload the previous world (basically avoid loading the whole game at once).

That’s on the network bandwidth side of things, the second thing is regarding the RAM/memory side of things, if I understand correctly it appears that memory could be freed once you unload a scene/world and move on to the next, which is great (I’m still investigating though but I hope that’s the case).

If the Monarch plugin and/or collection proxies are okay for this, or if there are any gotchas for what I’m trying to do, please let me know.

Cheers

Yes, this is possible using what we call LiveUpdate where you exclude the content of collection proxies and download and cache those as they are needed.

LiveUpdate: Live update content in Defold
LiveUpdate for Instant Games: GitHub - defold/extension-fbinstant: Facebook Instant Games extension for the Defold game engine

I would recommend that you first create the game without the LiveUpdate feature as that makes the workflow simpler (don’t take on too much at once when learning a lot of new things!)

Yes, all resources are reference counted and when you unload a collection via a collection proxy all referenced resources with a ref count of 0 will be removed from memory. You can also control this on a per factory level through the Load Dynamically checkbox on the factory component.

1 Like

That’s awesome, thank you for the explanation @britzl, hope you have a great day

:+1:

Going to bed soon! But thanks! And to you too!