Yep, it’s time to talk about procedurally generated content. Urban Parking Simulator will need procedurally generated levels, or else players will begin memorizing the neighborhood layouts, reducing the challenge of navigating unknown territories with your partner. (We might have situations where you get to stay in one neighborhood for multiple parking jobs, or in-game days, but we certainly need randomized levels by default.)
It uses a few rules to generate a randomized neighborhood map, represented like this:
A quick overview: X means intersection, one-way directions run n/e/s/w, and capital letters mean they are avenues (as opposed to streets). Generally, avenues run horizontally, while streets run vertically (and are almost exclusively one-way). The “B” represents a boulevard, which divides the residential area from the more commercial area. We also have inputs to control the probabilities that one-way streets will alternate directions, or that any given avenue will be one-way or two-way.
Using some of the wonderfully convenient Kenney.nl assets as a stand-in, this generates the following:
And if you wanted to see the tiling more clearly:
There’s a lot more that’s missing, as researched and documented by Terry, but I’m excited because this is already starting to form a decent foundation from which we can build in even more nuances. For example, not all blocks should be the same size (there may be long, rectangular blocks mixed in with more square-shaped blocks).
My vision is to make as much headway as I can on the streets side of things, such as possibly doubling up the boulevard to take up two rows instead of one. The corners and T-junctions around the border should probably be wrapped up so the level becomes enclosed.
Afterward, we can zoom in one level at a time and fill in things like:
- Buildings. The residential zones need a wide variety of buildings, varied enough so that they don’t all look the same. Buildings immediately facing the boulevard must all be commercial (e.g. car washes, delis, tire shops, motels, fast food).
- Street signs. How are stop signs (regular and “all way”) placed? One-way signs must of course be visible at appropriate intersections as well.
- Road paint. Two-way roads need to have a dashed line painted on the pavement. Which intersections will have visible crosswalks?