Sunday, June 8, 2014

Another Week, Another Update

CityScaper has been coming along, though I spent some misdirected time. I guess to explain further, I have to talk a bit about how CityScaper works. It's not terribly complicated, but if you've never done concatenated programming before, it might be hard to put all the pieces together in one read-through. Spend some time looking through smooth voxel programming, as it's one of the most useful purposes for concatenations these days, among game design programmers at least.

So basically we have a cross formation:
   o                  o 2
o o o       16 o o o 4
   o               8 o

Running this cross formation through a noise algorithm, which we utilize the very versatile libnoise engine ported to C# in Libnoise.Net by Jason Bell, we can retrieve true and false values for each point in that cross in a coherent pattern. The total possibilities (permutations) comes out to 32. Each point represents a number, in this case ( starting from the center, then going to the top and finally clockwise all the way around ), 1, 2, 4, 8, 16. By doubling these numbers, you can then add together the ones that are true for their place in your 32 possibilities. When you reference an array of a size 32, each one of those indexes represents values for a possibility that represents a street mesh. If the center isn't true, there's no street there. If it is, we check the arrays and generate the correct piece with the correct rotation, and place and rotate buildings around it later on. That's the basics of it at least.

When trying to integrate diagonals, I had approached the permutations 6,12,18 and 24, which will be wonderful for recognizing larger curves, but represent a problem when trying to add diagonals, as they do not have a solid center, and thus can (among other things) generate two pieces for the same thing. While this can still be done with some more patter recognition, it's an unnecessary amount of time to add to the generation process IMO as the corner pieces can simply be swapped out with a variable chance for diagonals, also allowing us to smooth the city out around the edges.

So the end result looks something like this:


No comments:

Post a Comment