FPS getting lower overtime, possibly tied to event tick

Hi,
I’m working on a 2D endless runner type mobile game. Much of the movements I have in the game are tied to an event tick, which I have come to realize may have a large impact on performance. In the editor, I get 60 fps, but I have a pretty beefy PC, but with a cooked build on android it starts at 60 and continuously drops (as low as 25-30 frames). My game consists of only sprites, using the Paper 2D plugin.

This is the setup I currently have for most of the movements in my game (using tick).

So, I was wondering what I can do to move my blueprints off of being tick dependent? Also, much of my character blueprint is dependent on tick at the moment, due to needing to check for certain events continuously.

Also I’ve already tried this method, it seemed to be very twitchy rather than being smooth like before on tick.

Thanks so much in advance!

-Tyler

Have you verified that is indeed the issue by removing everything from tick temporarily?

Well, no, as so much of the game (I probably should have thought this through at the beginning of development, this is my first major project though) is tied to tick, that the game just breaks when not using it. I’ve looked around at some other questions on answer hub about low fps, and many answers have talked about how lots of event ticks take up cpu usage, but none so far have suggested an alternative to tick.

If the framerate starts out OK on the target platform, but then gradually degrades over time, that would suggest that something is piling up somewhere in the background.

I don’t know the architecture of what you’re making, but for example: are the tiles properly deleted once they go offscreen, or do they hang around indefinitely somewhere?

How many tiles are displayed on screen at once, and do they all tick individually?

Tiles? As I have the game set up, the character, ground, background, and senery are moving through space in the X direction with a fixed speed (with the movement solution I blueprint using tick I posted above) and enemies are procederaly spawned in front (to the right) of the character offscreen. I have a large box to the left offscreen that is following the rest of the scene, and destroys all actors that touch it. So I have my whole scene moving through empty space, with all actors that move outside of a certain distance behind the player being destroyed. Does this sound like it would still take up lots of memory or processing? Thanks for the reply as well :smiley:

Ah well, tiles, ground bits, whatchamacallits. The mere mention of 2D always makes me think of tiles for some reason :slight_smile:

Anyway, doesn’t sound like it should hog a lot of memory with that “killbox” thing offscreen doing its thing.

I would maybe verify somehow that the actors really do get destroyed as intended. Other than that… no useful suggestions.

It just seems tick wouldn’t make it worse over time. I could see if you are spawning things and not cleaning them up or creating too many objects or such.

I agree that you should verify actors are actually getting destroyed.

Also, you could use a vinterp node to smoothly move objects over a set time. This might create more work in the background but should provide a more accurate experience.

I have verified that all actors are being properly deleted/destroyed when hitting the killbox a certain distance behind the player. Also, I only have one “tile” sort of thing, just a big rectangle encompassing the whole bottom part of the screen, but I have a material with the stone tile sprite being tiled based on world position, giving the illusion the player is moving past it, while it is actually move to the right with the player. Thanks though for the input :slight_smile:

And @Distful , is there any reason that moving the entire scene through space quickly would take up memory/drag down performance, even though the space is all empty? Or does it only matter what how many objects/actors there are? I could rework the game to have the player/scene static in position and the rest of the objects move left past the player. However, I’d want to know that this would actually help performance before I go back and change a lot.

Also, do you think the vinterp node would be less performance intensive than tick?

Thanks again :smiley:

Check to make sure items are getting destroyed and, if possible, move some of the actors you have acting on tick on Timer instead. Timers will move some of your functionality off of a frame dependent state while still allowing you to determine how frequently their actions fire.

One of the largest CPU/GPU killers is actually drawing to the screen. So in theory the more you have drawn, and the larger they are the more resources you will use. However, if your scene runs smoothly at the beginning and you aren’t really adding more things to it as you go, and assuming everything is being destroyed properly – your performance should not drop.

Vinterp will likely eat more resources than a tick. They would both be called every tick but the vinterp would perform additional calculations to ensure a smooth movement. But on any modern machine you shouldn’t notice any difference what-so-ever.

Not sure what could be causing the issue you’re having. I’m assuming you aren’t using that much screen space since you destroy the actors once they’re off screen. Are you 100% sure they’re being destroyed? Play your game through the Level Viewer and watch the actors count in the World Outliner.

Hi,
I just looked at the actual count of actors in the game (I was looking at the world outliner before, but I was checking to see if it said the specific actors I was looking at were being destroyed). The actor count starts out around 60 and climbs to roughly 85 once the game gets into its swing of things (about 30 seconds to a minute in), and fluctuates from 80-90 for the next 5 minutes I was watching it. When testing in the editor on my PC, it stays solid 120 fps the entire time. However on Android (target platform) it starts dropping frames from starting at 60 well before one minute in, and continues to drop when actor count in pretty much constant around 80-90 for the rest of the time you play the game. So I don’t think, from what I’m seeing, that the actor count is the cause of dropping frames.

I’ll add that I’ve turned mobile HDR off, and set the lowest settings for my mobile game. I’m also testing on an LG G4.

Thanks for the reply,

I was thinking that I may have to move from tick events to a timer, but I wanted to make sure (or at least sort of sure) that tick is causing frame drops and taking too many resources, as I would have to change a lot of my tick logic over to delays.

So, just to get something super-basic out of the way - is the android device overheating? Would explain the continuous drop…

No, I was just playing for about 10 minutes and the phone still felt cold. Not even warm to the touch.

Frame Rate still dropping though.