The issue is simple.
It’s a 2D game where the camera follows the player and a text box is put on the side of the screen so the text box is relocated so it appears fixed on the screen. Basically I have:
1- change position of camera to x,y
2- change position of text box to x+delta , y +delta
When i do that the game bugs, lags , jitters, the FPS jumps from 60 to 30 randomly.
If i remove line 2 , it works perfectly
It’s a simple text box, no effects or behavior or special fonts.
I saw many post having similar issues with no explanation as to why it happens. So far it seems a limitation of gdevelop. In my case the graphics are fine but relocating the text box slows down the game…
It sounds like a bug although it could be a timing issue. If you want a stationary text box then you could add another layer and put the textbox on it and don’t move it’s camera.
I didn’t know we could do that. I will try! Thanks!
Using a different layer for the text does not solve the issue.
After more testing I came to the conclusion that it’s the combination of text and change position of camera that triggers the issue. The FPS drops when a text is “moving” (no matter the layer) and the camera is moving fast. Changing the position of camera slowly doesn’t cause the FPS drop.
Like @Keith_1357 mentioned, this sounds like it’s better placed on another layer where the camera doesn’t move, aka a UI layer.
Can you provide a screen snip of the events?
I can’t replicate your issue. I tried it two ways that seem the best way to go about this:
First adding SmoothCamera behaviour to the player character so the camera follows it as it moves. No lag, smooth scrolling and the text stays in place without jittering:
Without the SmoothCamera behaviour, still no lag, smooth scrolling and the text still doesn’t jitter:
First, thanks a lot for your time and interest.
My list of events is huge and many functions are called. There are several characters included the player interacting. So without the added text it is already computationally expensive. But it works. Even on a slow computer.
When I add this text, on a layer or not, then it bugs. Like this text addition plus the camera moving fast becomes too GPU-heavy. My only logical explanation is that a simple text addition suddenly uses too much ressources.
This is the best I can explain. I have done a lot of tests showing the camera speed and TimeDelta sudden jumps and there’s a correlation between the 2.
If I remove completely the text the game works fine. That’s another correlation.
Same with the camera speed. If I zoom out and the camera is fixed then the game is fine.
Maybe my computers have a GPU bottleneck. They’re both getting old…
Did you run the profiler before and after to see what’s using the most resources? Does it happen after just adding a text object or is it the updating? Try adding a text with a different name or disable the text events. Does it happen with the bbtext object. Either way. It seems like you could benefit from some changes.
Yes I ran the profiler several times but it doesn’t tell me much. I get 5ms total time when it bugs.
I’m assuming the total time is the average time of computation per frame.
The wiki page says “Note that actual rendering on the GPU is not measured here.” So it would mean TimeDelta -5ms is the GPU rendering time when it bugs. (When it doesn’t bug there must be extra time so the GPU rendering is lower than TimeDelta-5ms if I understand correctly). Still 5ms is less than a third of the one frame at 60 FPS.
“Does it happen after just adding a text object or is it the updating?” Well I have to update otherwise the text addition has no effect, right? So I have never tested just adding a text without updating.
“Try adding a text with a different name or disable the text events.” This is what I have been doing all along.
I don’t use bbtext.
I’ve also been unable to reproduce this using either of MrMen’s event setups in these scenarios, regardless of whether I place 50 text object instances manually or create them via events.
I’m kind of stumped on what this could be, unless it’s something rendering related with your system? Basic text objects use your OS’s font rendering. Depending on your system this could be impactful.
- What GPU do you have?
- Are you on a supported OS? (Windows 10 or newer?) If it’s Windows 7, I’m wondering if it could be defaulting to legacy Canvas mode instead of WebGL which would have some potential performance impacts on rendering.
- If you go to WebGL Browser Test – Check WebGL Support & GPU Info | APIVoid, does it say WebGL 1 Supported True/WebGL 2 Supported True on their respective tabs?
- Here are my GPUs screen shot when running the game:
The NVIDIA doesn’t seem to be used at all… maybe that’s the issue?
- Yes windows 10 supported.
- both True
I guess I was using the wrong GPU. I have searched a bit and changed some settings. Now it’s using my Nvidia GPU and I don’t have anymore issue with the text.
But still, it’s not normal that the text addition would give me issues. And I’m not the only one to have this issue. I have an alert when players get a lag. So now at least I can have a message saying “your GPU is too slow” (not my problem).
I leave that part of the code computing the total time the game lags, that my be useful to others.
with “count” variables to be put back to 0 at the beginning.
timedeltaexpcount is the exponential average over 1s of the number of times the game has lagged.
timedeltaexpcount2 is the total time the game has been lagging.
In fact some browsers keep changing the GPU settings. So the problem reappears constantly.
Is there a way to detect the GPU used in the game?



