How’s the best way to set up a defold project for managing multiple game levels when it comes to sharing assets and scripts between levels? Kindly share some experience with me…TIA
I think you can learn a lot from the games made by @benjames171:
They are beautifully simple in the way they are structured.
Yes, however, the question rises at this point…
In this example:
… and in this example:
… for each level we have a separate collection proxy.
If I will theoretically have 50 levels, I have to prepare 50 proxies.
Ben James uses parameterisation in one place:
string.format(‘#level%d’, self.loaded)
… but this is not, it seems, the main place to manage levels. So is it possible to use a single proxy to dynamically load different collections based on name/link? I feel there should be such a possibility… but is there? Because at this initial stage of my knowledge, I see that you have to attach the collection to the proxy at the GUI level in the program, statically.
If doing it at a lower level, inside the collection, e.g.
— game_proxy
— — game_collection
— — — levels 1-50
as BJ does with a simple start/credits menu, such a collection would be huge…
Yes, this is the recommended way, and yes, this part also needs improvement.
But not by changing the engine logic—just by improving the editor’s UI/UX (e.g., a way to create 50 collection proxies by selecting 50 collections).
It is important to realize that we use these links to the actual source files to know what exactly should go into the final build.
Creating one proxy for each level is a small price to pay for this.
And, even if you have 1000’s of levels, a script would help generate the correct setup etc.