Tween object pre event gets continuiously increases

I have a game in which I use scene timers to increase performance.

Under those timers are some tween events. This has been working fine for a long time (six months). But since the recent update of Gdevelop (two weeks or so?), this is causing a steady increase in the object tween pre-event while the game is idle. After about 1hr, the tween pre-event is eating up so much processing power that the game becomes unresponsive. I have tested it with a simple test project (here), and the problem is replicated. These are the conditions in the test versions (nothing like my game conditions, but they replicate the issue).

I thought maybe the timer was causing the tween to repeat repeatedly/exponentially, but this issue doesn’t happen in older published versions with exactly the same code. I can remove the timer, and the error disappears, but that will involve a large amount of code adjustment for me and a loss of performance. I’ve tested the versions I exported before the latest update (with the problematic events unchanged), and I don’t get the same error. This is what makes me think it’s a recent change causing it.

Here are a couple of screengrab examples:
Old published version (same conditions as the current version) after 30min idle.

Newly published version after 30 min idle: scripting increased from 599 to 2393

And using Gdevelop profiler: Initial pre-event tween time.

30 seconds later:

30 seconds later:

You get the idea - this value just keeps going up until the game becomes unresponsive. Any ideas?

I’m not sure if this will help at all - if a tween gets set repeatedly I’ll add a delete tween before I create the tween.

I don’t know how the new tween mechanism handles the same tween being repeatedly created without the old ones being cleared out, but the suggestion is worth a crack.

2 Likes

From a performance perspective I probably would ensure your tweens aren’t activating if the scale isn’t already their destination. (No reason to activate the tween scale to 1.2 if the scale is already 1.2)

But as far as the other impact that seems like an issue, yes.

1 Like

Many thanks for the suggestions. I like the idea of checking the size first, although this is just a quick example scene to show the issue. I’m not doing this in the game. I’m being forced to use a number of tweens for text entry objects because there is no way I can find to resize them other than with a tween, and the other conditions surrounding these tween events require the timer… So, I am a bit stuck.

Hi @pro-quack,
This seems a bit weird indeed.
Could you send a zipped project that recreates the issue?
It will be faster for us to have a look.

Sure! here you go.
https://wordcracking.xyz/games/tests/tween-test.zip

This issue has been resolved with Fix a memory and CPU leak when a finished tween is replaced by D8H · Pull Request #5917 · 4ian/GDevelop · GitHub
It will be available in the next release!
Thanks for spotting it

1 Like

Many thanks - that’s such a relief. I’m very grateful to you for everything you do.