As we are busy with a procedural-city-generator that we could use in future games, I created a small simple test building (prefab) to test the building-placement-code. This code is still pretty simple and only puts some buildings on a straight line along each street with a small offset. furthermore we added a sidewalk strip next to each street to give it a better look.
Here are the images created so far. Apart for some bugs it looks pretty neat.
As seen in part 1 we are building a procedural city. So far we have the generation of the street network in place. Now we where working on the generation of blocks, the places we can but building or parks or whatever on. It’s basically an open space between the streets.
Here as a screen shot of everything in “action”.
Next step: buildings!
Problem area: we want to have a city. A BIG city. I don’t have the skill or time to build a BIG city in a 3D modeling program. So what to do? Create one from code!
Why do we want to have a city?… Well probably we gonna create a race game (again) through a urban-shaped environment . How or what we don’t know yet, but we now ave another idea for yet another game…again…
Where to we start? First the streets. If we have streets, we have building blocks. On building blocks we can put building or other things like a park. Sounds easy huh.
So far I created a small test-app that defines 5 lines. Those lines are extruded and connected in a way so the look like streets. So here’s a small image of what I made so far. Red is left side of the street, blue right side (debugging purpose only…)
Left: the app as-is
Right: triangulation (draw by hand).
The triangulation in 3D space is also in place (not shown in the picture) and apart from a crappy test-texture it does it’s job very well!
Next step is to determine (detect) the two triangles in the middle. This would be the building blocks that hold some information like big building, sky scraper or park (and maybe water and other stuff).