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 content 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 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

You are not logged in, your comment will be anonymous unless you join the community. Or sign in with your social account:

Icon
Kaepe
Developer & Publisher
The Indie Accord
Engine
Apricot.js
Contact
Send Message
Release date
Game watch
Start tracking
News
Browse
News
New
Post news
Share
Related Games
Kaepe
Kaepe Real Time Strategy
Related Engines
Apricot.js
Apricot.js MIT
Related Groups
The Indie Accord
The Indie Accord Developer & Publisher