• Register

The game you are trying to view has ceased development and consequently been archived. If you are a member of this game, can demonstrate that it is being actively developed and will be able to keep this profile up to date with the latest news, images, videos and downloads, please contact us with all details and we will consider its re-activation.

Fight back the reapers and lead the young country of Lotte to victory! Kaepe is a story driven tower defense game featuring dynamic path finding, an expansive universe, rich story line, and plenty of achievements. The final version will also include a level editor and access to community built levels.

Post news Report RSS Javascript Collisions and Optimization

This week I spent a lot of time adding features and optimizing the game framework I created for Kaepe. The main new feature I have added is rotated hitboxes using the separating axis theorem.

Posted by on

This week I spent a lot of time adding features and optimizing the game framework I created for Kaepe. The main new feature I have added is rotated hitboxes using the separating axis theorem. I have uploaded the code at jsdo.it if you would like to take a look. The only important function is the is_colliding(obj1, obj2) function. which returns either true (if a collision has occurred) or false if they are not touching. I have found that on my computer, with my browser, each collision takes less than a millisecond. I have conservatively estimated it takes about .01 of a millisecond on average. That means I could have roughly 3000 checks per second if my game was running at 30 ticks a second.

1s/30ticks = 33.33 ms a tick
33.3/.01=3330 collision checks a second

jsdo.it source code

If you would like to test it I would love to hear the averages your computer pulls! I am still actively working to speed the entire engine up.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: