Lots of sprites

This forum is currently in read-only mode.
From the Asset Store
2d mushroom sprite 2d game character enmy sprite game art
  • 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?

  • 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.

  • 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.

  • 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.

    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... :)

  • Some things you can do:

    - Turn off collisions for sprites that are off-screen

    Try collisions first.

    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.

  • Not as far as I know. You can also try to disable code selectively to watch what it does to the CPU use.

  • Not as far as I know. You can also try to disable code selectively to watch what it does to the CPU use.

    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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Maybe something in your code is constantly checking these thousands of objects against collisions?

  • Maybe something in your code is constantly checking these thousands of objects against collisions?

    well, yeah :) you should read previous posts :) thanks for input though :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)