I am creating an endless runner game for iOS. At the moment I have new terrain appearing somewhere out of the screen in front of the player every few seconds so that it never runs out. My problem is, every time a new piece of terrain is instantiated, the game lags a lot.
Is there a better way to make an endless runner that won’t lag?
Are there any ways to reduce the lag besides removing models from the terrain?
Thanks in advance for your help
I would read up a bit on Object pooling and Factory design. But the basic theory is that you create an object once and just use it over and over again. I have a feeling the “slowdown” you are experiencing is the instantiation of the object.
These design patterns are not too difficult to implement and help tremendously. You would just need to also design your landscape to incorporate this, such as reusable platforms, or terrain pieces.
edit: the reason I state this is the lack of processing power on handheld devices… and im not sure about iOS because i have not released anything for it, but is there a “bad” GC in it? When I was developing for XBLIG one of the things that got most people was the garbage collector, so just asking.