Trying to use instances for my endless runner game

Hey guys,
I’m struggling a bit with the whole instancing system, there’s not much documentation regarding instanced static meshes or actors.
So, my problem is the following: I’m building this endless runner game where you have random objects coming at a rising speed. After they reach a certain point they are destroyed. Some of these objects are powerups, some are deadly, and others are just scenery.
I’m guessing that I should use instanced actors or static meshes for some of these objects (such as scenery) to save memory, am I right? I tried using the construction script on an actor blueprint, or the level blueprint but I never quite got it to work.
Can someone point me in the right direction? I can’t find any tutorials on how to make instances. Should I even make instances for this case?
Thank you

First question are you making mobile or desktop game?

Some tips i learned while making endless asteroids shooter for mobiles:

  • you should create and destroy actors dynamically. For that you need some manager. Split your game map into sections (for eg each one 1000 units). Then make section blueprint that creates all objects in it. Every time player changes section you fire up dispatcher that has index of section to be destroyed. Because you created all actors from section blueprint, killing it should also kill all things it spawned.
  • for mobiles avoid spawning bunch of objects at once (second task of section blueprints). We made them to spawn all actors slowly, at begin play they created list of objects to spawn and their relative locations. Then each 20ms they spawned 2% of total number, so it took them about second to spawn them all. You can spawn one actor per event tick or so, this also should work.
  • blueprintable components are your friend here. Back when I coded that shooter game components were immature yet, but now they work great. You can make most of things as components.

Do not worry with instances for your game. Hardware instanced meshes for mobiles it is very new feature (some older devices probably not support it), and desktop does not need instanced meshes for runner game.

I’m making desktop, but with mobile in mind. I’m trying to program in a way that’s easy to port if I want to in the future.

  • Actually, there is no game map, I’m making a way of faking movement by just spawning moving objects towards the player. I believe Flappy Bird is the same concept if I’m not mistaken.
  • Good tip, I’m gonna keep that in mind. Most of the objects are spawned separately in time anyway :slight_smile:
  • I’m still a newbie when it comes to programming so I’m not sure if I can use components in an effective way. I’ll check it out anyway. What do you mean by “blueprintable components are your friend here.”?

Components are very easy to use, just watch tutorial.
Really before you start watch something about blueprint communication and then components.

Try the spawn actor from class node yet? You can make entire chunks of scenery this way, but if youre programming for mobile, youd probably want to stagger the spawn triggers or something.

Then make a collision volume somewhere behind the player that destroys actors it overlaps with.