Culling?

This forum is currently in read-only mode.
  • Is it possible to do some sort of manual offscreen culling for sprites? I've tried a bunch of things and it's not really working.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Construct already does that automatically. Why would you want to do it manually?

  • Well It didn't seem like it had culling to me because I have a game with 50000+ sprites in the area, I added a machine gun, and whenever I shoot it it starts to lag. I flew out so that there were no objects on the screen and it didn't help. So I wasn't sure whether there's culling or not. When I made it so there were only around 10000 objects in the area it was fine.

  • 50,000 sprites is a lot. Seriously, a lot. My computer can only manage 100,000 invisible or offscreen sprites total without any code or behaviors at all before it dips below vsync. It isn't your GPU getting slammed, it's the CPU. An instance of an object requires some CPU time, even with no code. If you do any sort of checking on that many sprites, your game's framerate is going to take a massive nosedive.

    If you want tons of objects about (like bullet casings or tiles or something) I suggest instead saving their locations and any relevant info to an array and deleting them when they're offscreen, then recreating them when they would be onscreen again.

    More info in this thread:

    Edit: You're probably doing collision checks - if you set the offscreen sprites' collision mode to 'none' that might help somewhat, but it's still a lot of checking to do.

  • I agree. My CPU usage goes up to about 50% when I'm running the game. I was surprised it even worked with that many. I could easily use half as many/twice as big sprites I wanted to make the terrain destroyable when a bullet hits one of the sprites. And that's exactly what I meant in my first post with deleting objects offscreen and re-creating them and things like that. Thanks, and another thanks for the quick reply. I'll try this out.

  • What is slowing you down is not graphics, it's collision detection.

    Each bullet gets tested aganist each object.

    Culling won't help you there... try disabling collision and see if it goes faster (remove solid attributes from both objects, if that's what you're using).

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