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.

Report article RSS Feed 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 iamscissors on Sep 20th, 2011

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
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
Kaepe
Developer & Publisher
The Accord
Engine
Apricot.js
Contact
Send Message
Official Page
Theindieaccord.com
Release Date
TBD
Game Watch
Track this game
News
Browse
News
Report Abuse
Report article
Related Games
Kaepe
Kaepe Indie Single Player Real Time Strategy
Related Engines
Custom Built
Custom Built Commercial Released Sep 1, 2007
Related Groups
The Accord
The Accord Developer & Publisher with 3 members