### Refactored bucket code.

Before: A shot would calculate its collision approximation rectangle. A shot would then determine if the player could be hit (invulnerable, friends etc). A shot would then determine if the player origin was inside a circle, centered on the shot start position with a radius of the shot movement delta + shot radius + player radius. A shot would then determine if the player was inside the approximation rectangle. After: A shot would determine if a player could be hit (invulnerable, friends etc). A shot would determine which player origins were inside a circle, centered between the shot start and end positions with a radius of the shot movement delta / 2 + shot radius + player radius. If any players were inside the circle, the shot would then calculate its collision approximation rectangle. A shot would then determine if any circle players were inside the approximation rectangle. Goal: By centering the shot nearness circle inbetween the shot start position and shot end position the area of that circle is greatly reduced. By rearranging the order of operations many of those operations are no longer performed for every shot every frame.

Showing

Please register or sign in to comment