How do I test processing speed of collions?

0 favourites
  • 2 posts
From the Asset Store
Match the cards with the same image on them with each other and clear the levels!
  • I have a situation where I want bullets to hit a shield around a spaceship but since there might be lots of bullets and lots of spaceships, this will be a lot of collision tests. I was thinking about pre-optimising this since it's likely to be a bit heavy on processing but I'm not sure how I'd work out how fast C3 is with calculating collisions versus doing a distance calculation.

    I don't know if I'm doing my tests right, but I'm setting a huge number of objects (5000 of each) and with C3 collisions I get about 12 fps. With distance calculation I get about 2 fps, so it might be best to allow C3 to calculate this, if I'm doing my tests correctly.

    So my two methods would be.

    a) Create an invisible circular sprite that's attached to the spaceship, to act as the shield. Test for collisions between the bullets and the shield sprites.

    b) Take each bullet and find the nearest spaceship. Test if the distance between the two is < a certain distance.

    Obviously it would be insane to expect it to cope with 5,000 bullets and 5,000 spaceships, I was just stress-testing. But I wonder if anyone could confirm that C3's collision checks would be preferable in this case or if there's a better method?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Might try the Line of Sight behavior.

    All of it.

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