I wanted to be clear about performance. I have noticed that what most affects the performance of the games are the graphics. And for this same reason as I try to make my game look better by adding more sprites (such as trees, trees, fences) this is slowing down. I'm not sure how I should handle this but tell me something. For example if an ememy walk should do this animation with only 2 sprites? My player does an animation in which this roll, this has 11 frames, and runs at 45 fps. The question is should reduce it for example to 4 frames your animation, and 10 fps your speed? What do they tell me? I'm not clear on this.
no 11 frames opposed to 4 is no big deal..
although it depends...
make a text box on the screen showing these variables: FPS, cpuutilisation, ImageMemory, objectcount
Sorry, I meant that I had 11 sprites for the animation to roll, which run at 45 fps. (I had read that more than 10 fps was bad for performance)
I do not use physics
I only use a particle effect when collecting the coins.
I do not use WebGL effects.
The image is 75 whidth by 74 of height.
I have text to measure performance, what happens is this: the game runs most of the time from 40 to 55, 57 fps, but at times it drops to 22 or 18 fps or less and the game slows down. I do not know why. (And I thought of the player, since the one who is always in the game)
what do you have for background art? lots of big images in memory? or amount of things to draw on the screen..Draw calls is usually a culprit.
Do you load objects that are NOT in your current Layout? if you load something from another Layout there will be a considerable drop in frames while you load the new object into memory.
Run your game in the Debugger, you can get a lot of useful info there.. wait for a slow-down, and look to see what takes up all the resources.
Thanks for answering.
Ook, I'm going to review a little more about debuuger.
On the second point, already includes all the necessary objects in each layout to avoid lag.
The draw call in my game if I see it in the debugger is between 3.3 and 4.5. (that's bad?)
And in the background I have a farm background: size 1363 width and 302 height (tilebackground)
Another of height mountains: 836, widht: 371. (tilebackground)
One of clouds height: 2000, widht: 439. (tilebackground)
And the sky height: 32, widht: 32 (tilebackground)
Do you think I exaggerate in the background? Are the images too big or too large?
Or would it be better to place them all in a single large background as: 2048x2048?
Draw calls between 3.3 and 4.5 %? no, that's not a big deal. Hide those large background sprites so they aren't rendered and run the game. Does that fix the issue? I don't expect that is your issue..
You may have a leak somewhere in your code. What is the highest percentage process?
check your collisions under 'Watch' and other stats there that may be helpful determining your slow down.
Do you do things Every tick like create sprites in that are not destroyed right away?
remember to check these:
https://www.scirra.com/blog/83/optimisa ... -your-time
Ook, those two link already read several times, but the other three points that you mention, I will review them with great care, for example to check in the code the highest percentage is interesting. Thank you very much Jobel. I'll start reviewing that.
Develop games in your browser. Powerful, performant & highly capable.
Also what computer are you testing on? The specs do matter. Is it a laptop? are you using hardware acceleration or not? Try running it on different specs if you know someone with a higher end machine.
In the pc works well the performance of the game (it is an asus i7 of second generation), the problem is when I pass it in apk, and I play it on the tablet (samsumg galaxy tab 2). (I export it with cordova and compile it with cocoons for android) this almost always works ade 40 to 57.58 fps, but it does lag as I said. But I'm testing what you told me to do.
I think I already know what the problem is. Delete the background that I told you was great, and I reduced the sprites of a character from 7 to 2 frames. And the game already runs on the tablet from 55 to 60 fps. Now I'll see how to improve the background. And I think with that is ready. Thank you Jobel.