Offscreen stuff causing lag

For questions about using Classic.

Post » Tue Sep 15, 2009 5:32 am

I don't think a whole lot can be done about it. Construct doesn't know what will be colliding with an object or where it will collide at, so it has to check for a collision with each possible object. Collision checking is already one of the most expensive processes, and doing it 5000+ times every frame is going to take a lot of CPU power.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Tue Sep 15, 2009 8:41 pm

Can you change the collision type of the ground objects at runtime to 'off'?
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Tue Sep 15, 2009 10:45 pm

yes you can, and it would probably increase performance.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Wed Sep 16, 2009 7:02 am

[quote:2v2wzyi8]Can you change the collision type of the ground objects at runtime to 'off'?[/quote:2v2wzyi8]

DID NOT THINK OF THAT, god im so damn retarded. Thanks a bunch you guys, once I did this the game sped up ALOT
B
2
S
2
G
4
Posts: 239
Reputation: 1,928

Post » Sat Sep 26, 2009 5:56 am

still, you shouldn't have your whole game world (if its big) simulated at once. It's ovekill.
Not even NES games did it.

Of course, unless you design really depends on it.... but most don't. Metroid/Megaman/Castlevania doors are a great example of breaking up the world, but if you don't want pauses you could get away with "streaming" the way GTA does it, just load blocks as you're within appropiate distance.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Sep 27, 2009 12:42 pm

I must say i'm a bit surprised that this game lagged. Even if there are many objects, I've allways thought that construct could take really much as long as it wasn't things like effects, physics, etc. This kinda scares me... but i guess there's ways to solve it.
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Sun Sep 27, 2009 2:17 pm

Per-pixel collision detection is a pretty intense thing. Once you have thousands of objects to test, it can take a lot of time to check every pixel.

Don't worry about it, though - in practice it's not often you'll encounter problems with it, and as you said there are ways around it. I have a demo of a shooter where there were about 500 objects on screen and collision checks between almost all of them and it ran fine on a pentium 3.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sun Sep 27, 2009 11:43 pm

So it depends on the amount of objects? Not the area for testing. So when i make my level i should resize the collision masks as much as possible instead of placing out 32*32's on a grid?
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Mon Sep 28, 2009 2:35 am

No, it is the area for testing, I meant the more objects you have the more pixels there are to check. As far as I know, using 1 big sprite that has the same surface area as multiple little sprites will take the same amount of time to check.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests