Project 2 .:City Generator :.

By: Chris Mizerak



Description:
This is my technical piece for Project2. I built a City Generator with Visual C++. It's pretty self explanatory actually. You can either start from scratch, or with a map you have scanned in or downloaded. To build a city all you need to do is the following:
  1. Place all the intersections you want
  2. Drag and drop roads between all your intersections
  3. Click on roads to adjust their attributes
  4. Click on menu to choose a terrain, or load your own (32x32 .bmp)
Features:
When designing City Generator, I wanted to make the UI as simple as possible. Building a large scale city will only take a matter of minutes. Here is a list of features:
  • Very quick and easy to build large cities
  • City is scaled in real-world dimensions (when drawing roads, it will tell you how long in miles it is)
  • Real world scale also allows cars to drive at real-world speeds (default road speed is 25mph)
  • Roads are all cardinal splines
  • Intersections can join arbitrary number of roads (directional-graph network)
  • Vehicles will obey traffic lights and stop signs
  • Vehicles make turns to random roads using smooth b-splines
  • Vehicles accelerate to road's set speed limit, then slow down when necessary
  • User can switch to car view to watch it drive from the car's point of view
  • All roads have editable attributes including:
    • Intersection type (stop sign, traffic lights, dead end, nothing)
    • Surface (pavement, brick, dirt, sand, grass, nothing)
    • Road curviness (0-100%)
    • Number of forward/backward lanes
    • Block location (urban, residential, countryside, dessert, beach, forest, nothing)
    • Building density (0-100%)
    • Building height (min stories - max stories)
    • Has streetlight/sidewalks
  • Roads can have any number of lanes in either direction (allowing for one-way roads)
  • Any roads that cross having sidewalks will be joined using a smooth spline
  • Terrain mesh generated by bitmaps, and then scaled
  • Roads, buildings, vehicles, etc... are all fit to terrain
  • Random Scenery added to city
  • All buildings and scenery fed through a collision detector to make sure nothing is intersecting that shouldn't be
  • User can add as arbitrary number of buildings to model directory for more variety in final city
  • Ability to save/load cities in ASCII format, for manual editing/creation of a city
  • Cities export to .mel files for import to Maya
  • Easy mouse-controlled camera orientation
Demo Videos:
Demo video showing a city being built from a map
Demo video showing a city being built from scratch
Drawbacks:
Since the intersections can have an arbitrary number of roads attatched to it, the traffic lights will not change in sync with other traffic lights. One other problem was that the roads are automatically textured in maya with the export scripts. They look fine in the playblast window, but aren't textured properly when rendering. I didn't have enough time to resolve this issue with Maya. The only other minor problem is with FLTK. I didn't have a chance to get the attributes modal window to refresh properly when the user scrolls up and down the list.