1

Do I need to spawn the world by making prefabs or just make a very long platform?

Sorry, I'm a complete beginner and tried making a long platform because if I do a random spawn it wouldn't be like Mario Run or Geometry Dash where when they die they re-spawn and the world is the same, not random all the time (of course my game will be completely different, I just want it to be like a side scrolling game where all you do is tap like those for an example).

The problem with creating a long platform is when you run it on the simulator it lags very bad I'm guessing because of the CPU & frame rate.

Any tips or advice will help so much! Thanks guys!

Brainles71
  • 77
  • 13

2 Answers2

2

Well here are a few things to help you get started.

  1. Object pooling. Create modular pieces of platform and pool them. Then you can show just the objects needed to create the part of the platform the player is currently on. This will improve performance immensely.

  2. Once you have created your modular pieces, you can design extremely long platforms using a sort of level creator logic. For example, assign a straight flat piece of platform the value 1. Assign an uphill piece the value 2. Assign a downhill piece the value 3. Then you can define the level, even in a simple text file if you wish. 1,1,1,2,2,1,1,3,3,1,1,1 That is a flat stretch, and a small hill with a flat top. Hopefully that makes sense. That way your not pulling pieces from your pooling at random, and the level will be the same each time you show it. (Procedural versus Random)

  3. If your just getting started into this and you are more into designing a game rather than programming it, I recommend getting the Platformer PRO package from JNA Mobile. This is an absolutely fantastic package that will give you a great headstart.

Allen
  • 567
  • 2
  • 9
1

The world in game make from objects. I think you can check to remove objects to optimize performance. If character pass object, and object is out of screen, so you must remove object.

This beginner tutorial 2D game: https://unity3d.com/learn/tutorials/topics/2d-game-creation

Dong Nguyen
  • 134
  • 1