This article is copied from my personal blog.
I spent a good chunk of the day trying to solve a performance problem. After approximately 100,000 bullets were fired, the framerate would drop to an excruciating 16 FPS.
I was able to figure it out by using Google Chrome’s heap profiling tool. Here’s what the heap snapshot looked like:
I found out that there was a memory leak in the game engine – every time a sprite was created it called
setInterval but it did not call
clearInterval when the sprite was deleted. Ever since I fixed the issue, FPS has stayed at a nice and smooth 60, no matter how many objects are created and destroyed.
Here are some other things I got done today:
- 9pm – Miscellanous small enhancements.
- 11pm – Fixed the performance issue.
- 12am – Added the new thruster sound that Michael gave me.
- 3am – Added Sandbox Mode.
- 4am – Added more features to Sandbox Mode.
- 6am – Added Ctrl+A to select all your ships. Also made WASD and J work the same as arrow keys and space.
- 7am – Added dogfighting mode.
- 8am – Added graphics so that ships display their targets when selected.
- 8am – Added 2 more dogfighting levels. Enhanced manual piloting of Militia ship so that you can use your melee attack.
Here’s a screenshot of Sandbox mode:
Here’s me playing through Dogfighting Mode and messing around in Sandbox Mode a bit:
I have only 2 days left to work. The last day will be primarily reserved for gameplay tweaking, bugfixes, touchups, and testing. That leaves only 1 more day to make actual progress.
These are my goals for tomorrow:
- Add a rotating turret to the flagship.
- Add a civilian to Level 1 and use that to explain the Move command vs the Engage command.
- Add a dogfighting level where there is an ongoing battle and you have to rack up a certain number of kills to win.
- Add more campaign levels. I reserve the right to ramp up the difficulty in the later levels!
- Pan sound effects and volume depending on scroll location
- Add some more ship classes and implement upgrades.
Thanks to the folks in the #7dRTS IRC channel for helping me playtest today. Specifically Zapa and Orava.
You can try the game out now.