Where does the Lag come from?

Discussion and feedback on Construct 2

Post » Sat Apr 30, 2016 9:50 pm

Does lag in construct 2 reflect the amount of objects in a layout, or how big the layout is? is it just my computer?
I see games like "The Next Penelope" having so much animation and so many active objects on screen at once and it all appears to run super smooth. I have no where near as much detail as that game(at least I don't think so). But whenever I export my platformer game through nw.js, it always seems to lag quite a bit, making it hard to time jumps and such. I love adding pieces of art to put more depth into my game and would really hate it if I had to remove much of it. (all of the pixel art is mine and mine alone except for the occasional red spring and boost pad.) Is it the amount of layers that causes the problem? I'm fairly new using construct 2, so when I try to look up discussions on the forums regarding lag, a lot of the things I read don't make much sense to me mainly because I don't understand their terminology. Despite this I'm really trying my best and want to know if anybody has tips or knowledge to share about lag and keeping your game running smooth. I'm making a platformer with classic sonic style physics. I'm not quite comfortable giving out a .capx file yet but in the mean time I have videos I recorded with bandicam that should help demonstrate how badly it lags in my nw.exe.

[I use pixelmonkey's SonicPhysics Behavior add-on]

-My game on nw.exe: https://drive.google.com/file/d/0B-5Wjs ... sp=sharing

(^^^this video accurately shows the real-time lag when playing my nw.exe file on my computer)

-My game in MS edge on the same computer: https://drive.google.com/file/d/0B-5Wjs ... sp=sharing

(^^^Ms edge runs my game so smoothly compared to chrome and other browsers it actually pisses me off)
Last edited by ZephyrKing on Mon May 02, 2016 10:16 pm, edited 4 times in total.
B
9
S
3
Posts: 8
Reputation: 691

Post » Sat Apr 30, 2016 11:13 pm

want to share your capx?

You find some performance tips in the tutorial section

here some points
- Place objects using the same blend modes or effects on the same layer
- make sure all those objects are placed on their own layer
- Dont Changing Text objects every tick (specially large text objects)
- Avoid large areas of overlap between objects
- Avoid objects with large areas of transparency

and of course it depends on the computer - but if you play other games that run smooth, then it's your project.

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Sun May 01, 2016 4:03 am

I would spend some time using the profiler tab in debug to pinpoint where things are going wrong. My guess is it's actually caused by taxing the CPU--the profiler would confirm or deny this, of course. My guess is there are some events that are causing a lot of problems that may not really need to. See if your cpu utilization is crazy or anything before you worry about graphical overload.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Sun May 01, 2016 8:15 am

The size of the layout or the number of layers won't cause lag. The engine is well optimized to handle such things. Thre problem is either in your objects or in your code. What @C-7 suggested is a good idea. Based on your videos it's not a triggered problem, since it's happening from the beginning of your layout. Does your game lag in other browsers as well, not just with NW.js? Also, what C2 and NW.js version are you using?
B
136
S
33
G
17
Posts: 1,560
Reputation: 20,775

Post » Sun May 01, 2016 9:30 am

@ZephyrKing THX for showing a video

Ms edge runs my game so smoothly compared to chrome and other browsers it actually pisses me off


That reminds me of some performance issues I posted before.
C2 games have troubles on 2 of my 3 PC's.
Here a lot of the time Edge runs smooth and Chrome or NW.js sucks

You can try the performance test from Ashley to see how your PC tests
http://www.scirra.com/demos/c2/sbperftest/

Here it all depends on browser and the computer
My gaming rig and the i3 laptop drop around 180 frames and score worse than a MotoX mobile
The i5 laptop 0 drops
W10 i3-5010U, 4GB Laptop - has some major issues with HTML - but otherwise a great and fast Laptop
W10 i5-6500, 16GB, GTX960, SSD Workstation - has also some issues with HTML - otherwise perfect
W10 i5-5200U, 8GB, SSD Laptop - no issues at all

Still didn't figure out what is wrong with (especially on my Skylake workstation) - when I try a test like http://www.kevs3d.co.uk/dev/canvasmark/ my computers behave like they should.

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Sun May 01, 2016 10:53 pm

Just to ask, regarding all of your curved tiles:

Do you use a collision polygon with multiple points?
How many points are on a curve usually?
Roughly how many tiles are in the level that have these curved tiles?
B
51
S
20
G
10
Posts: 571
Reputation: 9,819

Post » Mon May 02, 2016 3:31 am

Which version of NWj? Because 0.11 and 0.12 are notoriously bad for smooth frame rates.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616


Return to Construct 2 General

Who is online

Users browsing this forum: wermon and 4 guests