Platform Masters Title
Platform Masters - Will you be the world's next platform master?






Ronnis - designing the buildings 1


Date: Oct 29, 2011
Screenshot #191: After forming the base texture, along with setting up random number generators (essentially noise maps with certain ranges), forming the several hundred buildings is next. This screenshot shows the basics. In the image itself, you can see 10 completed buildings for the closest visible layer at a scaling of 14 (for almost exactly 1401 3/4 feet of distance (427 1/4 meters, 9557 1/3 CU)). Given the spacing of 2048 CU, 3 scaling units, the next most distant layer has a scaling of 17 followed by 20, 23, 26, and so on. The buildings stop at 128 - beyond here, they're both very small and also very short. At that point, ground decals will use this instead, done the same way as the Sentus Mountains.

What's with the grid and numbers on the left? These represents the spacing of the floors. I've marked multiples of 4 clear up to 96, the maximum allowed (the odd one at 128 requires special attention). As the buildings get more and more distant, they'll also get shorter. Adjusting the heights is done through the "height randomizer" layer. Whatever shade of gray comes out from randomly chosing a pixel is the height I use, in floors. If what I get is a floor outside the range allowed for that layer, I just retry another random number. Colors are determined in a similar way. Unlike the houses which can have any color values from 0 to 255, buildings are limited from 192 to 255. This brighter color is to cut back on the heat that often plagues today's cities due to their darker colors. The roads have an otherwise reflective surface, though this isn't possible with my ground decals system without using far more than 96 MB of memory. With the heights and colors determined, finalizing is all that remains. By having all the buildings otherwise touching instead of across gaps, I can optimize the memory usage, allowing for more buildings in a single layer. By streamlining this process, an entire layer's worth of even 32 buildings doesn't take very long to do.









Ronnis - designing the buildings 2


Date: Nov 2, 2011
Screenshot #192: Now used to the process, these screenshots show the system as it was done. The first step is sizing the building so that its width is a multiple of the scaling. That is, in this case, the scaling is 92 so the layer's width and height must both be a multiple of 92. Rounding to the next higher multiple of 92 is needed rather than the nearest so that none of the image gets cut off. Once done, I make the layer invisible and make it linked. From there I make either 15 or 31 duplicates of this layer for 16 or 32 total. This forms the base setup.

The next step, as shown in this screenshot, is to get random colors. When I previously did the buildings before this, over a year ago, I just made up random numbers in my mind, though this wasn't as motivating. The system I used for the making of these buildings is the same as that of the houses in Jeremy's House when I made those the previous time (and will be used again later when I get at redoing them). To get random colors, I use noisemaps. A noisemap is basically an image that contains random colors, though, in my case, random shades of gray. Noisemaps are used with my ground textures as well. Here, they are used to get random colors. To do that, I just select that layer, choose the color picker tool, then pick 3 spots on the image to get a random color value. I only need to memorize the first 2 values. The first one I get is the red, the second is the green, and the third is the blue. Buildings span from 192 to 255 for their color values so I've adjusted my color randomizer so that it covers that range. The video above and this screenshot demonstrates this well.

Buildings beyond the 64 are narrower as they're also considerably shorter which is why there's 32 of them. Buildings beyond 96, however, are hard enough to see to begin with so, instead of 32 like these would've been, they're only 16, with the repeat width cut in half (1/2 Kbl instead of 1 Kbl). This means that 800 total buildings are to be done this way. When the layer at 92 is done, I'd have had 592 buildings done, 74%.

While doing this, I often use my "luck points" game. The game is simple - if I get a value of 207, in this case (based on lucky 7), I gain a luck point. If, however, I get 222, I lose a luck point. A pair changes the value by 3 and a triplet is 6. If I got "207, 207, 222" for the values, I'd gain 2 luck points.




Ronnis - designing the buildings 3


Date: Nov 2, 2011
Screenshot #193: Once all buildings' colors are determined within that layer (doing all 16 or 32 in one go streamlines the process making it faster and more efficient), randomizing the heights is next. This involves the use of another noisemap as a different range is used. This noisemap is adjusted so that the lowest value used is the shortest possible for that layer. The first step already tells me what the maximum allowed is, even though the noisemap clearly goes over it.

Unlike the colors, only one value is needed per building, though I get 2 to make the process more efficient. The first one is for the building I'm currently on and the second is for the next building. If the value I get goes over the maximum allowed, I just pick another value and keep doing so until I get something within the allowed range. For example, the buildings at a scaling of 92 range from 9 to 28 floors. If I picked a 33, I'd pick another value. If that was a 57, I'd pick another. If I got a 28, then I keep it and pick another for the next building. If I got a 9 that time, I'd keep that as well and I'd start making the adjustments to randomize the height. To make the adjustment, I use another layer, the "height zoning" layer, to select the first floor that is to be deleted. Adding to the selection with all floors higher than this, with some overlap, with the rectangular select tool is next. I switch to the target layer and clear the selection, shortening the building to that height. The screenshot shows this well. You can see the contrast with the yellow building and the blue-cyan one in front that I had just did.

Because the minimum heights of buildings change between layers, I often have to readjust the range of the noisemap. This must be done before I start randomizing the heights for that layer and is is done by merely subtracting the values of each pixel by just 1 (rarely 2 should this change by 2).




Ronnis - designing the buildings 4


Date: Nov 2, 2011
Screenshot #194: Once all the heights are randomized, finalizing remains. The first step is repeatedly scaling those layers to the correct size. "CU/Scaling = Pixels" is the basic formula for that. This step is very quick compared to the others, even faster than the initial setup.




Ronnis - designing the buildings 5


Date: Nov 2, 2011
Screenshot #195: The next step is to spread out the buildings so that they are all on a single row. They have otherwise no gap between them in the image for memory optimization reasons. This also leads to more accurate positioning of the buildings, so that they are always spaced 2048 CU apart (the narrower ones are spaced slightly differently). Previously, I had the spacing preincluded in the image, otherwise wasting memory and/or reducing the amount of repeating possible. At this point, the positions (thus spacing) are directly set in the game engine during loading.




Ronnis - designing the buildings 6


Date: Nov 2, 2011
Screenshot #196: After merging all the buildings into a single layer, that layer is done and I'm off to the next one. While I was working on the buildings for each layer, I've been keeping a simulation of what they'll look like when I get to that point based on being 12,288 CU above the ground. The transparent ones are the newest addition into the scene, the layer at 92.




Ronnis - designing the buildings 7


Date: Nov 2, 2011
Screenshot #197: Noisemaps are just that, noisy. This is as extreme as you can get. Notice the histogram though in the bottom right corner of this screenshot. See how evenly distributed the color values are? If I changed to logarithmic mode instead of linear, it's nothing more than a flat line. These noisemaps are used for a lot of things, especially textures. Yep, even my realistic-looking grass texture comes down to nothing more than noisemaps, though stretched.

I actually have 6 of these noisemaps, 2 each of 3 different sizes. There's the 1024x1024 size that isn't used for much. There's 2048x2048 that's used quite often. Then, like I needed with the buildings as the base image is so large, 4096x4096.




Ronnis - designing the buildings 8


Date: Nov 4, 2011
Screenshot #198: The buildings beyond the 128, however, are done much differently. These buildings are done via ground decals instead. Being 4 stories tall at the closest point, they're but 2 pixels tall, too short to be noticed. Thus, ground decals are used for these. The end result is the same as that of what's shown in the Sentus Mountains world, only, instead of covering less than a square mile, it's buildings out for a very long way, nearly 10 miles out.

Although I have about 2280 buildings to do this way, nearly triple that of those that rise above the ground, they are far, far faster to do as all I need to do is make rectangles of set sizes, position them, color code the roofs temporarily for how many floors they have, then make shadows. Despite triple the quantity, it actually took less time to do all these buildings than it does the others. The repeat span is also greater at 1 1/2 Kbl instead of 1 Kbl or 1/2 Kbl.

This screenshot shows the first stage of the process for making these buildings. The texture in the background is made darker temporarily so I have optimal contrast so I can place things as needed and see them easily. Each pixel is exactly 10 2/3 CU so 3 pixels is 1 block.




Ronnis - designing the buildings 9


Date: Nov 6, 2011
Screenshot #199: One of the last stages of the process for the ground decals' buildings is getting the shadows. Why don't I have shadows for the foreground part? Memory usage will get extremely high. To get shadows, I first need to set the heights of the buildings, since their height determines how long the shadow is. I've color-coded the heights. White represents a single-story building. These are the most common. Red represents a 2-story building, also very common. Orange is for a 3-story building, fairly common, and yellow is for a 4-story building, somewhat rare. The 5-story green buildings, 6-story cyan buildings, the 2 7-story blue buildings, and the lone 8-story magenta building are increasingly rare. These buildings are much shorter in relation because they are far from the central downtown area. The sky scrapers in the foreground is pretty much city center, or, at least, very close to it.




Ronnis - designing the buildings 10


Date: Nov 6, 2011
Screenshot #200: Once the heights are set, making the shadows themselves is the last step, before the obvious final save of the texture. The length of the shadows is determined by the tangent of the light source's elevation. In this case, it's the Sun, of which I've set to having an elevation of 45 degrees. This makes shadows very easy to do because there's a 1:1 height-to-shadow-distance ratio. A lower angle (like 30 degrees) makes for longer shadows, the tangent of 60 degrees (it's 90 minus the elevation) resulting in a 1.732:1 height-to-shadow-distance ratio.

Even buildings cast shadows on other buildings! This screenshot shows an example of this being done. Notice the odd dark line going across that white-roofed 1-story building? This is where I'm in the middle of the process of getting a shadow on the roof. Once the shadows are done, I just set the colors of the roofs back to white again then save the output texture.






Footnotes:
None.