What are the most common causes of lag and slow downs?

Discussion and feedback on Construct 2

Post » Mon Feb 06, 2017 8:52 pm

I'd like to know what the most leading causes of lag are. Any info would be appreciated. Also when i preview a game through nw.js, the loading times are tremendously long. i can feel my self losing a lot of patience while i wait. Do slow downs have anything to do with the computer's graphical capabilities? I just got a new computer with a Geforce GTX 850m and was hoping the lag i was experiencing with my last computer would be gone. This isn't the case though :/
B
9
S
3
Posts: 8
Reputation: 691

Post » Mon Feb 06, 2017 9:49 pm

Try adjusting these to test:

Too many effects
Too many objects/collisions
Too high resolution

If all else fails:

Your hardware device
Your logic
Image
B
30
S
9
G
3
Posts: 171
Reputation: 3,329

Post » Tue Feb 07, 2017 7:08 am

3 Important reasons:

1- Too many objects which contain JSON data, each JSON data may have a lot of properties such as X, Y, Size, Frames, Layer, Instance Variables, Behavior, etc. the system cannot handle a lot of data in memory to run with 60 fps.

2- Misuse of loop and effects, sometimes they cause setting values in chaos way may affect CPU and GPU usage that leads the slowdown due to proccesing capabilities.

3- Resolution and Fill-rate, as GPU is often limited by fill-rate, even every pixel can be seen as a cost. When framebuffer is filled with pixels to be drawn, you might see that the game runs faster at lower resolutions. However, screen resolutions typically tend to go hand-in-hand with the capabilities offered by GPU. Typically, one of the common source of performance problems is coming from too intensive pixel writing.
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Tue Feb 07, 2017 9:13 am

Mistakes were made.
B
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

Post » Wed Feb 08, 2017 1:22 pm

I am not expert and I have not released any games

But from my own tests I have found that for-loops that move sets of sprites are the biggest slow down.

The profile debugger tab (I think it is profile?) is good for seeing where the cpu load is going.
pure logic for-loops are fast and moving individual sprites is fast

but something like

for each of (20 sprite instances) move to (calculate move to point) etc etc
seems to take a big chunk of CPU and can cause slow down (on mobile at least).

However, whatever I do on whatever platform, on whatever game, I still always get jank during the first 30 seconds after launching though it does go away after .....(if anyone has any ideas on eliminating this I am all ears...)
...
B
46
S
24
G
7
Posts: 320
Reputation: 8,203

Post » Fri Feb 10, 2017 12:21 am

im started to use C2 and follow justtt a bitttt of super mario bros tutorial on youtube. I successfully setting my character(one) and one ground. Its fairly quick to setup in C2 but when previewing in browser its lag a lot, pause when moving, pause during jumping.

My machine is Amd X4 860k, Nvidia 550Ti,16GB on Windows 10.I do have other i7 machine but not worth trying since its only two sprite.
Do i need tweaking at this stage?

Thanks
B
5
S
1
Posts: 3
Reputation: 331

Post » Fri Feb 10, 2017 3:12 am

Sprites and music files that are large will slow down load times.

After you finish a project go back and remove any sprites and sound/music files that you did not use.

Keep images and music files as small as possible.

I am having to crunch my Platform Builder and remove some stuff now to get it to upload to the arcade. I always have lots of sound effects, music and sprites I did not use in the project I can clean out before compressing.

Your game may start playing before the engine has fully loaded and processed everything so if it gets hung up on a big sprite or music file it can cause lags. Sprites with lots of animations also cause lag.

ADDED: I had 10 long play background music files. Download was over 84MB. I cut that down to just 3 shorter music files and got rid of unused sprites and trimmed out a layout and that cut the download to 35MB. Those music files really add to the MB of a game and slow down your load times.
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,825

Post » Fri Feb 10, 2017 11:58 am

Try not to get confused between download size and runtime performance. The two do not directly affect each other. For example a large music track will increase the download size, but should have no impact at runtime at all.
Scirra Founder
B
399
S
236
G
89
Posts: 24,530
Reputation: 195,402

Post » Fri Feb 10, 2017 2:09 pm

Ashley wrote:Try not to get confused between download size and runtime performance. The two do not directly affect each other. For example a large music track will increase the download size, but should have no impact at runtime at all.



Well, I have a sand box game that had 10 large background music files. The game would load and start but lag terribly and sprites would stop moving for a few seconds when ever I started the game even with no music playing. I took out those music files and sprites stopped lagging.

So there must be some processing of music files going on either in the engine or browser that was causing the lag?

I add in a pause on games with music files now to let them fully load and process before the game screen starts to avoid the user seeing the lag.

If there is some other cause I would be interested in knowing what it is?
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,825

Post » Fri Feb 10, 2017 4:00 pm

lamar wrote:Well, I have a sand box game that had 10 large background music files. The game would load and start but lag terribly and sprites would stop moving for a few seconds when ever I started the game even with no music playing. I took out those music files and sprites stopped lagging.

There's no technical reason for that, because the engine doesn't touch music files unless you tell it to preload/play them. I'd be interested to see an example of that if you can make one. I would assume the problem was really caused by something else though.
Scirra Founder
B
399
S
236
G
89
Posts: 24,530
Reputation: 195,402

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 15 guests