So I’ve finished up with terrain for the moment; I’m pretty happy with the system and the general look that I have now. I found some pretty major optimisations today, which means that I’m now able to render the terrain with the ground clutter in less time than it took yesterday to draw just the terrain without the clutter.
(For any programmers in the audience, the key thing was to pay attention to memory access patterns; if you have an array of 65,000 vertices arranged in 256 rows of 256 vertices each, then it’s faster to draw triangles along the rows than down the columns, because the rows are organised close to each other in memory, whereas the columns are spaced widely apart)
So I’m now pretty happy with the basic terrain system and rendering. There’s still a lot of stuff I could do to tweak it, but I’m going to leave that sort of tuning until everything else is in place. I believe that the next thing I’ll work on will be “picking”.. that is, determining what object or bit of heightmap is under the cursor. This will be essential for tasks like letting the player place roads and buildings onto the undulating heightmap. The system I had in place in MMORPG Tycoon 1.x only worked in 2D, and the picking I wrote for Lord was an ugly hack that wouldn’t scale to the size of worlds I’m using here — you could fit about 500 of the “Lord” maps into the screenshots which I’ve been showing; Lord’s game world was only 60 x 60 vertices in size, after all.
Once picking is working, then I’ll start on placements; placements of buildings, and of an interface to make terrain adjustments. There’s so much stuff to implement! :)