Download

Endless runner game on Android: Short lag when spawning a new tile with blueprints

Hi everyone!

I’ve successfully followed the Unreal Engine tutorial to create an endless runner game.

The tutorial: Endless Runner: Spawning the Course | 02 | v4.7 Tutorial Series | Unreal Engine - YouTube

Now I’m trying to do the same thing as a Side Scroller Game, and my character is automatically running on the Y Axis with an Event Tick.

But each time my character is crossing the EndTrigger which generate a new random tile (I’ve actually created a set of 5 tiles and the game pick a random tile) I have a short lag on my Android phone. (Oneplus X) The Endtrigger is just before the short space between the tiles on the screenshot.

I’ve tried several thing, like loading all of my tiles by hiding them somewhere from the camera, or to put all the tiles at the beginning on the game, but it seems like everytime the game is adding a tile, even an already generated one, I have a short lag…

Do I have too many mesh on my tiles? The old tiles are destroyed after 4 seconds.

If someone have any idea why I’ve these lags it would be great :smiley:

I’ve attached a screenshot of the game and the tiles.

Many thanks !

Emeric

38258eca329ca0da213e821893cdf7a456fc6605.jpeg

I had similar problem with spawning asteroids on mobiles.

Things you can try:

  • make single texture (even 2048x2048) use atlas way of mapping and applying texture to meshes that are in sections. google for “unreal atlas texture” there are pictures that show what i mean. This way when you spawn sections unreal will never need to load new textures.
  • split section into separate meshes. Make it *** blueprint. On begin play of that section spawn some meshes, then each next frame spawn one mesh. You can make this by putting all meshes and their transformations into array (or two), then picking one by one element and spawning single meshes. You can make more than single section ahead, and from player speed and width (or length) of section you can anticipate time you need that section to be ready. So rather than spawning bunch of objects at once spawn them bit further ahead but in tiny amounts.

Hey thanks!

I’ll try these two options and come back with good results I hope :wink: