Hello Folks!
I’m working on a mobile game aimed to have around 200 levels. Since I still am still a beginner, I dont know what this means concerning storage usage / size after build. My question is now, what is in your opinion the best way to store this levels? Following are my ideas:
-
One Level, one Scene:
Pretty simple, just create every level in Unity. But at what costs? Is a game with aroun 200 scenes a good result? It seems pretty messy to me… or am I wrong? What do you think?
-
Store the Levels in XML files.
I thought about a Level generator scene which creates levels depending on which xml file would be loaded.
The XML files would simply contain the names of the prefabs and where they should be positioned and other stuff. What I am concerned about here is just the security… The Levels written in XML are readable like an open book… Of course it can be encrypted and stuff but how secure is this?
So what do you guys think? Is there even a other, better solution? Is there another place where I can store data like this securely in the project?
I would be very thankful for any kind of input…
Thank you very much
Hi!
I’m my opinion and experience the first option is not so bad BUT you’ve to worry about scene loading time! I’ve found in the past (for example) that in some cases iOs is WAY much faster then android loading scenes! If you want to do that, remember to test it well on different devices!
About your second option (that’s what I’m doing for a game I’m developing), why dont you have different prefabs (with the whole level in them) and just Instantiate when you need them? I’ve a “Levels Script” in my scene with an array of prefabs that are the different levels. When the player get to the new level, one is destroyed and the new one is Instantiated, and it’s faster then loading a new scene!
Now… which one is better? It depends on your project I would say… if you need to lightmap your levels, then the second is not an option. If the levels are complex maybe I would take the first option only for keep everything in order, in other cases, having a unique scene will speed up the loading time between levels (and other bonus like you could have an unique pool of object generated in the first level and used also in the 200th!) at the cost of remember to reset every level-related variable everytime!
I hope I was clear and had given you some valuable infos!