Saturday, January 17, 2015

[MMc] Solar Golfing - improved minimap, refactored code

I just used prototype inheritance in Javascript. I feel very dirty, like I should hand in my functional programming badge and gun.

New round minimap in the top left and stroke counts in the top right.
David Bau's seedrandom.js just saved me a lot of time; it is a (minified) single line of code that you can drop into a Javascript program to make Math.random work with a specific seed.

I've come to appreciate a lot of Desert Golfing's procedural generator tricks, and have reached a sort of a truce with the weird Emscripten-compiled Box2D.js where I don't try to use the full API and it no longer crashes mysteriously. I also added some minor fading tweaks to the title sequence and HUD appearance for smooth transitions. Some elegant graphics things are really easy in Javascript. I'm impressed with how fast the renderer is--I haven't bothered trying to optimize anything for performance yet because the brute force graphics function takes less than 1ms on a desktop and even runs fine on iPod.

I started adding the code for procedural planet generation (including 3000 strings for use in composing planet names!), but need to go back to implementing rockets now since they're a core feature.

The base solar system will be highly scripted, as a tutorial. In the future, I'd like to randomly generate new solar systems. That future may be after the jam ends.

No comments:

Post a Comment