Lag with many objects.

For questions about using Classic.

Post » Sun Jan 13, 2008 7:39 pm

Well I am making a game where holding down the mouse button creates objects. These obj have physics but because may are being created there is much lag. How could I reduce this lag?
B
21
S
14
G
5
Posts: 106
Reputation: 3,416

Post » Sun Jan 13, 2008 8:28 pm

How can you reduce lag?

1) Buy new computer.
2) Spawn less objects.
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Sun Jan 13, 2008 8:55 pm

[quote="SuperV":11rv8g56]How can you reduce lag?

1) Buy new computer.
2) Spawn less objects.[/quote:11rv8g56]

Well thats extremely helpful. :roll:
B
21
S
14
G
5
Posts: 106
Reputation: 3,416

Post » Sun Jan 13, 2008 9:51 pm

Or you could code an implementation of a speedier physics engine.

Sarcasm not really intended. Those are the only three options.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sun Jan 13, 2008 10:00 pm

... it is, actually. One thing you can try is destroying the objects after a set period of time, or capping the number of objects spawned in at once. It's difficult to tell what is going on, because your description is vague. Hence SuperV's answers.
B
4
S
2
G
6
Posts: 161
Reputation: 2,597

Post » Sun Jan 13, 2008 10:10 pm

They're right. Physics objects take up a lot more processing power than non-physics objects. You can't just put a gabillion physics objects on the screen and expect it to run smooth.

So pretty much your three solutions are as already stated.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Jan 14, 2008 12:21 pm

Make sure your physics objects are using the fastest options: World Solver should be Linear (fastest), and World Friction should be Adaptive (also fastest). Using exact is much slower.

Apart from that, physics involves some pretty complex calculations, so it will slow down. You should design your game to use a handful of large objects as opposed to trying to do particles with physics on them, which would be extremely slow.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests