Just remembered I started this blog before the holiday season and then forgot all about it. Decided I should write something. Been in an extreme introverted mode, largely oblivious to the state of the world outside my active VisualStudio solution, so nothing to write about but what I’ve been working on.
Spent most of 2010 so far with my nose buried in code. Lots of reinventing-the-wheel stuff, but it was fun, it helped refresh me on a lot of concepts I hadn’t applied in a while, and produced some reusable, if not unique or groundbreaking, code. Started with a refresher on openGL, which I hadn’t used in a long time. I built up a set of rudimentary classes for objects, textures, materials, and cameras, very crude but it does the job and helped me stretch some muscles that hadn’t been used in a while. That done, I added a feature I’d used many times but never actually implemented myself, the ability to connect objects using attach and anchor points (flexed those matrix transform muscles in the process).
So that was the first week, and I started the second week equipped with a framework to get things on screen pretty effortlessly. From there, I dug up a project I’d started playing with over a year ago, when I was playing with the idea of geodesic tile planets. (the header of this blog is a screenshot of that aborted project) I fairly quickly converted a set of routines from that project for generating and transforming geometric shapes. The planet starts off as icosahedron, which is tessellated to the desired degree and normalized (otherwise it’d still look like an icosahedron) and then run through the MakeDual() function, which builds the dual of whatever geometric solid is passed in. Viola! I have a hex map wrapped around a sphere, with 12 pentagons where the verts of the original icosahedron were. The hexes aren’t quite of uniform size, but it’s surprisingly hard to tell (as you can see looking at the header here).
Anyway, dusted that old code off, adapted it to the new framework (it was originally in C#, as I started the project while playing with XNA). The next thing the planets needed was terrain – the terrain gen I implemented originally produced terrible results (the planet in the header is the best out of a dozen seeds, and with it’s good face forward – the back of the planet is a mess!) That’s a tricky problem tho, and after a night of researching techniques I decided to put it off a bit, to give my brain time to post-process my research, and instead implemented pathfinding.
Now, I had an existing A* implementation, but it was designed to operate on map data in array form, and adapting it to this context would be non-trivial, so I decided “what the hell” and just implemented A* again from scratch. Having not even thought about pathfinding algorithms in a few years, I was quite pleased with myself when I had the pathing classes implemented and, as far as I could tell, bug-free in a day. Integrating it meant extending my Planet class quite a bit – the pathing was implemented using a pair of interfaces, IPathable and IPathNode. Good bit of code involved in generating a node map from the geometry data, but it was pretty straightforward code and in no time I was generating paths across the planet.
And that’s where I am right now. Spent the last few hours doing still-more-research on terrain generation; found some things should be useful on Amit Patel’s Stanford site, specifically his article on Polygonal Map Generation. What he was doing is radically different from what I am trying to do but several ideas will translate quite well and I hope to have some decent-looking terrain generating by the end of the weekend.