|
-
Style Through Simplicity
[Optimising] Bullet theory (collsion checks)
Hey guys, here I am again needing some more optimising advice. This time however, I’m being sensible and trying to optimise as I go along rather than when the game is complete and I realise it runs at 2 fps.
The game is my latest shooter 'Bullet Theory' which some of you might know I'm working on (very slowly) from the topic I made asking for help converting the name to Japanese.
Anyway, as the title has bullet in the name, you might expect there will be a lot of bullets involved and you would be correct (see screenshot), therefore I need to make sure that everything is optimised as much as possible to prevent slowdown.
My question is, when checking if enemy bullets are hitting the player, would it be faster to check if the bullet is in the same area as the player before performing a collision check, or would it be faster to simply perform collision checks on all of the bullets regardless of their position in relation to the player?
I'm already doing the area check system when checking if the players bullets are hitting an enemy because there are multiple bullets and enemies involved, however, there is only one player ship which leads me to think that doing an area check could slow the game down more than it speeds it up. I'm just using shapeflag hitTest for the collision detection (the player only gets killed if the ship is hit right in the middle).
So would doing the area check simply add un-needed code, or would it speed it up overall due to less collision checks?
Any advice would be appreciated as always 
Ali
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|