5
\$\begingroup\$

This question pertains to a type of platform/maze game (made with Unity 5) for typical smartphones (iOS/Android).

This game has following characteristics: 1. an upper limit (about 100) on the amount of rooms 2. 3-5 different "levels", each with a different amount of rooms 3. the shape and type of the "ground" in each room is dynamically generated 4. each room has some items that are dynamically placed in the room but are generated from a prefab

A rough idea on the rooms in this game is given in below screen shot.

enter image description here

In that image only the platforms (black and white tiles) and the ground (light brown) would be shaped by an algorithm. The other objects shown in the image are prefabs that would be located somewhere in the room by an algorithm.

But considering that this game would not exactly be an infinite runner, and since it should run on smart phones, would it be better from performance perspective, to create 100 hard coded rooms instead?

\$\endgroup\$
1
\$\begingroup\$

It wouldn't be that much of a performance drag. The user would have to wait in order for the level to generate, but other than that it should perform the same as a pre-made level.

100 custom made levels on the other hand would load faster but would take up more storage.

\$\endgroup\$
  • \$\begingroup\$ thanks @Daniel. When you say that the 100 custom levels would "take up more memory", do you mean storage memory (as opposed to RAM)? I am asking because would it not be possible to have the game load the rooms as it needs them (or keep only the rooms that are around the players current location in RAM)? \$\endgroup\$ – coderworks Sep 27 '15 at 12:29
  • \$\begingroup\$ Both methods would use the same RAM. The custom 100 levels would take more storage memory. \$\endgroup\$ – Daniel Sep 27 '15 at 12:33
  • 1
    \$\begingroup\$ We call it "storage" not "storage memory." The amount of space, honestly, would be trivial (kilobytes to megabytes). \$\endgroup\$ – ashes999 Oct 28 '15 at 1:48
0
\$\begingroup\$

What I would do in these situations with the new Unity 5.3.3 patch with the new Scene Management is to create a level editor and save the rooms as scenes. It is fairly easy to create editor functions, you can learn here.

If you are worried with storage, you can make a level editor that converts and store the levels as a .txt file but that would be as asshes999 say, trivial. But I would say the scene approach is better.

Other advantages of making a level editor, is you can extend the level editor functions and make unit tests.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.