Up close, roads are generally pretty ugly:
But from a suitable distance, they can be beautiful:
I’ve been thinking about how to model the geometry of a road network in software. I have prepared a list of demands :-)
- I want to be able to load a road network definition from a file.
- I’d like to simulate traffic running through the network, with each vehicle having an origin and destination, and route-finding its way through the network.
- I’d also like to be able to display the network and simulation in real time.
- It has to look nice.
- Down the track, I want to make the network interactively editable, so that the whole thing becomes a software toy along the lines of SimCity or Transport Tycoon.
- ?
- Profit.
Suffice to say, this is an ambitious project relative to the amount of free time I have at the moment :-). I have no idea how far I'll make it through my list of goals.
Fundamentals – tiles versus 3d
SimCity (1989) is the first game I ever played which included a road network:
Your world is a 2d grid of cells. Each city block occupies a 3 x 3 square. Roads are simpler: each cell has a flag “Is there road here?”. While the screenshot makes it look like there are many types of road tile (90 degree bend, T intersection, straight road, etc.), they are just cosmetic – when rendering a road cell, the graphics engine chooses which tile to render based on the presence or absence of road in the four neighbouring cells.
Transport Tycoon (1994) also uses a tile-based approach, but adds some complexity. Roads now come in a range of qualities (gravel, bitumen, etc.) and orientations.
Also, Transport Tycoon allowed the map and road network to vary in height. Ramps, bridges and tunnels all became possible.
Advantages of the tile-based approach:
- Fairly easy to render a 2d network a la SimCity
- Fairly easy to edit
- In the SimCity model, the user just paints road straight onto the terrain
- In the TTDX model, the user can click and drag on the terrain, and the game engine selects the appropriate road or rail tile to apply by doing some nice automatic route-finding.
But there are disadvantages that lead me to rule it out:
- You’ll never be able to model arbitrary curves (see the cloverleaf above)
- So you never capture the insane beauty of a truly over-the-top cloverleaf intersection.
- So the networks you design end up with a cookie-cutter feel – nothing ever feels really unique.
- The ease of rendering is great for a two-dimensional city, but if you want flyovers, for example, you’ll have to switch to an isometric view, complicating the graphics engine significantly.
- Creating or sourcing free tile art is a hassle.
Ultimately, it comes down to beauty. Visually, tile-based transport games sit in the realm of cute/charming. I want this sim to be about austere, sinuous, mysterious beauty and angry imaginary drivers in tiny imaginary cars, so I’m going 3d.
Next time: deciding how to model the geometry of a road network in three dimensions.