Lots of sprites

For questions about using Classic.

Post » Fri Sep 03, 2010 9:01 pm

i created a playfield with lots of instances of the same sprite. sprite is a 32x32 one color square for now, and it is created on start of layout 300x50 times. i thought this should be no problem, it takes 0.01mb vram, but spikes processor use up to 100% and it's not enough, cos game gets choppy framerate (there's a 1x1 car behavior sprite on the playfield, but I can swear it's not its fault ;)

anyway, tried making sprites invisible when off screen, but it didn't change the processor usage nor framerate. also i'd like to have my playfield bigger than that, say 1000x200 32x32 sprites.

dear constructors, what do? i believe the problem is that construct checks all the events against every single instance of the sprite, if it's possible and this is the problem, how too disable events for sprites that are off screen?
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Fri Sep 03, 2010 9:13 pm

Some things you can do:

- Turn off collisions for sprites that are off-screen
- Find some way to whittle down the objects, such as check for objects that are on screen before doing other checks/actions
- Delete faraway objects at start of layout, create when getting close to them (harder)

Try collisions first.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Fri Sep 03, 2010 9:13 pm

What is your CPU speed?.The most i ever got by using Construct was 30 to 50% cpu usage.I have a intel I7 Cpu.And take a look at your gfx card as well is it nvidia or ati?.Also make sure that construct do not run on the highest priority on the process list.
B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Fri Sep 03, 2010 9:21 pm

[quote="DravenX":zgio6nq4]What is your CPU speed?.The most i ever got by using Construct was 30 to 50% cpu usage.I have a intel I7 Cpu.And take a look at your gfx card as well is it nvidia or ati?.Also make sure that construct do not run on the highest priority on the process list.[/quote:zgio6nq4]

i have athlon 64 x2 5600+ and geforce 9600gtm but come on, the game is not for me but for the players, so what I have has nothing to do, game has (lots) of extremely simple sprites, shouldn't have some extreme requirements. meanwhile trying arima's suggestions... :)
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Fri Sep 03, 2010 9:34 pm

[quote="Arima":3os6ftio]Some things you can do:
- Turn off collisions for sprites that are off-screen
Try collisions first.[/quote:3os6ftio]

ok, so setting the collision mode to off doesn't change anything in case of speed, but removing the "solid" attribute does. so is there any way of removing attributes through events, i bet making only the sprites that are on screen solid and the off screen ones non solid would fix this.
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Fri Sep 03, 2010 9:50 pm

Not as far as I know. You can also try to disable code selectively to watch what it does to the CPU use.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Fri Sep 03, 2010 9:59 pm

[quote="Arima":3rbdpnm0]Not as far as I know. You can also try to disable code selectively to watch what it does to the CPU use.[/quote:3rbdpnm0]

well I managed to do sprite replacing. used a 1x1 container with solid attribute unchecked and replaced it by the 32x32 solid sprite when on screen and again replaced with "unsolid" container when ooff screen, worked like a charm. thanks, this strange thread-beacon-fairy can close this one. or maybe some more exprerienced contructor has a different maybe better solution?
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sun Sep 05, 2010 9:37 am

Maybe something in your code is constantly checking these thousands of objects against collisions?
B
5
S
2
G
3
Posts: 234
Reputation: 1,818

Post » Sun Sep 05, 2010 8:18 pm

[quote="konjak":4kb36hkm]Maybe something in your code is constantly checking these thousands of objects against collisions?[/quote:4kb36hkm]

well, yeah :) you should read previous posts :) thanks for input though :)
B
81
S
50
G
10
Posts: 555
Reputation: 13,009


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests