Spent nearly all day today heads-down coding to end up back where I was some time the previous night. The game's internal infrastructure made great strides but it doesn't change the fact that it feels like treading water all day. Also, the internal stuff still needs some work before it's in shape for the real engine... but it works ok in the AI prototype for now.
Lately, I find all kinds of reasons to bypass the normal terrain generation to get large sections of raw map data instead of the little chunks. The random town stuff and road generation was kind of the last straw so I finally started incorporating this formally into the engine... which will reap a lot of benefits down the road. The biggest plus is that it means I can generate these data files once and reuse them rather than doing the expensive calculation on the fly.
This is the same kind of data used to generate the classifier info in this pic:
http://i.imgur.com/RAJMT.pngThe other thing is that previously, the data was always from the raw fractal (and it still is) and so didn't have any of the gorges or cave systems in it. Now that it's being more formalized, I can update this map-level data as the terrain is changed by that stuff... and by some user edits.
Half a dozen other planned features were sort of waiting for this data also... so in the long run it's "about time".
This came up now because when I went to bed last night, I was pretty sure that today I'd be starting to plot where towns should go... starting with the spawn point and spawn town. The problem was, even to find the proper terrain-based spawn point, I needed to do several seconds worth of calculations. I've been sort of living with these long pauses in the AI tester lately but it was starting to get ridiculous. The layer in the image above did its calculations, spawn placement was going to have to do its calculation... it was time for proper support for map classification data.
So I did finally get this in. It adds about 400k to each "node" (a 1024x1024 area) on disk... but given the ultimate utility of this information, that's small.
Later this evening, I did finally get to plotting the location of the spawn town. This is the kind of trial-and-error coding that I generally obsess over. If it took me 3 hours to get the color of fire right, you can guess how much time it takes to figure out why a town is placed in a location that seems wrong. I had a lot of that. Tweaking the algorithm, running the AI tester, scratching my head, looking at the data, and then finally copying it over to one of my Mythruna worlds to look at it in person.
Things always look different on the map. In the 3D world, you have nice sight lines, etc... a few hours of tweaking and I mostly have the spawn town selection working pretty well. The potential port sites is still a little weird. It's technically correct now but I always end up having to go look at it in the world to confirm because it looks wrong on the map... and sometimes seeing what the computer saw as a good port site is a little tricky. Fortunately, the computer will also be placing the docks someday.
As a debugging measure, at one point I ended up plotting all of the potential port sites for a good section of the map. This view was nice and it's a relatively quick calculation... I may go ahead and store this information instead of recalculating it all the time. This information would be useful even if there is no port there but an NPC ship for some reason wanted to go ashore. The places that are good for ports are also good for reversibly beaching.
Anyway, I feel like things are starting to come together a little bit. Hopefully this manifests in "something to show" soon.