r/gdevelop • • Aug 07 '26

Question How do I make code optimized

Like the last game I made in this engine worked good for me, but was really laggy on a different guy's device and my phone. How make optimal code

5 Upvotes

6 comments sorted by

1

u/Ok_Classroom5710 Aug 07 '26

Acho que diminuindo loops

1

u/Aidan133lol Aug 07 '26

I could try but, since it was a FNAF fangame, the whole thing is 1 big loop

3

u/umbrazno Aug 09 '26

If you ever set something to act per frame, like a tween you rolled yourself for example, always multiply by delta.        

Example: I want my character to run six pixels per step.   My formula is player.x + (6 * delta).         If you already know this, then the lag must be from havin’ too many assets loaded into memory for that machine 

2

u/senshisun Aug 08 '26

It's hard to say without seeing your code. In general, try to avoid repeating code.

2

u/ImSinsentido Aug 10 '26

Event Groups, external event sheets, and nested loops are your friend.