[Solved] Game lagging severely!

Phonegap/cordova ist what is used by autobuild. If it is slow you’ll have to optimize. Keep in mind that smartphones are way less powerful than PCs.

1 Like

Indeed and that’s why the optimization is VERY important on mobile.
When an PC have a graphic card with vram and ram, the mobile have just a little bit of ram…

You can read this page about optimization,it’s a draft but it can help you.

1 Like

Hi there, thanks a lot for help, so no point in exporting via phone gap or other such apps ,as auto build already do it???

I will optimize and run profiler, I guess I have lots of stuff but not any over 2k

I have heavy particles too ,okay will update again

I just can say you would try your game on mobile WITH and WITHOUT particules. You’ll see a great difference!
Particule is very time consuming.

1 Like

here is my profiler result!!!

can anybody tell what is issue

In first view, all seems correct!
I see you have removed particules effects.
Can you do the same analize but with particules on your objects?

1 Like

In my experience with mobile, the simplest and most effective way of maintaining performance is to use resolutions less than 1280x720. I use 960x540 most of the time with sprites multiplied by 2. ( I do not experience reduce in quality of image when using 960x540 resolution.)

2 Likes

Exact. The resolution is one important thing but the number of objects, behaviors and effects applicated on them count a lot also .

1 Like

I have tried it with removing all particles, bit good but lags painfully on mobiles below and around 2GB of ram,…

so I m now thinking is Gdevelop even compatible for mobile games???

What is point in removing everything I mean particles etc , my resolution is around 1280-720 , removed particles and it’s Very basic game,I wonder if its a little complex game ,would it even run on any mobile I wonder???

I have even reduced min fps to 10

What more I can do???del everything :grinning:

1 Like

Not sure what your code looks like but make sure your using the trigger once command so that the game isn’t creating objects over and over slowing the game down. I know this is a common problem. Hope you figure it out.

1 Like

Hi can u Have been reading a lot This, but never get it completely,

I will share you screen shots of all code,

I hv a timer in my game too , like complete game in 41 seconds

U don’t have new objects creating at any point rather they del when collide by platformer object

For now can u share few examples where add to trigger , I have added triggers where I can

My game logic is simple

Get 8 juices in 41 seconds , while killing some monsters

All elements are preloaded,

I have video logo in in my game which is 1.3mb is that doing some issues???

I can share complete game folder if any one like, I need to know my problem at least for future projects too

The problem is often one of those:

  1. Too many objects on the scene; every instance if an I next has to be rendered, take more ram than anything else and take extra steps In The game loop (object specific ones and behavior ones). Try to limit the number of I stances if possible.

  2. Abusive usage of for each object event; When using that event, the time used by each condition is multiplied by the number of objects. Only use it if you really need it and only for the event you need it for.

  3. Abusive usage of conditions; Checking a condition is a time consuming process as it also affects object selection. Sub events allow to limit the number of conditions. Example:

If player is moving and right is pressed change animation to right
If player is moving and left is pressed change animation to left

Could be optimized into

If player is moving {
    If right is pressed change animation to right
    If left is pressed change animation to left
}
  1. Usage of very graphical features; those often need complicated and long computation. Example: layer effects, particles, tweens etc.

Deleting is not the way to go. Optimizing is. Try to also use lower resolution assets (every additional pixel take some more time to draw) and compressing them (for faster loading), change your code to be more efficient, and limit visual effects

Yes it is but mobile games need lots of optimization as they are way more limited in performance. GDevelop itself currently is more focused on portability and stability by using the Javascript programming language over c++ which is faster, so it needs more optimizing than other platforms, but if we were still using c++ you would maybe not even be able to port your game to phones.

3 Likes

The video logo might be doing something, especially if the video hasn’t stopped and it’s still playing (or looping) in the background when the game is being played. That would be a resource hog.

Another guess… if you have large image files that are being scaled down, I believe GD does the scaling calculations for every frame of the game. So a large (for example 1 megabyte, 1280 x 720) image file that is scaled into a small sprite (say 100 x 100) on the game screen, you could resize the image in a paint program first and then import it back into GD. The file size could go down to like 100k and GD won’t have to do such large scaling calculations.

Did you upload the game folder somewhere?

3 Likes

Thanks a lot everyone for such support its incredible , i am uploading my game folder ,anyone if want to test it,can test it out , i have made few more adjustments,there is gdevelop file inside of it ,i would like to know more of my errors so i wont repeat them in future!!!Its merely 18 mb zip

https://drive.google.com/file/d/1-_yEixnl8xOIJm1r4iDkgVgqxlU6yybX/view?usp=sharing

Again thanks a lot

I put a post above that you didn’t read.
Because when I open the project I see lot of image of 1080px in an animation, it’s just huge for mobile, no wonder your game malfunctioning.

1 Like

Great!! what is maximum i can shrink it too???

The smaller the better. See Performance nightmare ... a small but helpful story (you can share yours too) :)

2 Likes

As mentioned above it looks like some of the images should be reduced in size. Especially the ones over a megabyte, but probably other ones too. And I’m not sure if this would improve the mobile performance but you could also try to delete the intro before the game starts in case it’s taking up ram…

1 Like

Thanks a lot everyone, hope this would help me, my game is small so not much to change except some 80 odd elements

I was shocked to see some of my buttons PNG are 3000 pixel

I hv reduced mostly images to 256 by 256

And few video to few kbs and size done under 700

Let m test how much would it help me

Also screen resolution to 960 t0 640

Anyone recommend lowering min fps to 10???

so i have every thing down under 1 mb

the whole game is 6mb!!!

still it plays slow on my other mobile which is 2gb ram

works brilliantly over my 4GB ram phone ,

here is game uploaded again

https://drive.google.com/file/d/12xQg8LaULZzQc1ImkIl0NVPrhrtbLbad/view?usp=sharing

i m not sure what now is messing it up???

I have rechked all events I found them good in working order ,

The game so perfectly over 4gb phone’s 3Gb also

But plays like slow motion on 2GB,

Although first of all it almost unplayable but now at least play able

1 Like

So atlast game worked good on every phone!!!
so smooth like on PC!!!
i reduced everything to under 1 mb, most of images to under 50 kb USING tinypng.com ,so that so that complete game was 5 mb

image this also helped ,del things before moving on to next scenes

corrected events a bit, removed repetitions , and also compresses video and audios to below 1 mb ,some to below even 200kb

i also reduced my screen resolution which i shouldnt have ,but still lot a learn with first game ,whole next level of optimization for mobile. Also i was afraid that Gdevelop is not for mobile game, but it is ,just need careful planning with code and assets and lot of optimization

thanks for everyone ,for helping me out , I will share my game here once published on google play!! thanks again…

i dont know to change this thread to solved but if any body can do it!!!11

10 Likes