Cities: Skylines

Cities: Skylines

631 beoordelingen
Practical Engineering: The Optimal Square Grid
Door me22ca
I had assumed that a 10×10 grid was best, but it turns out it's not.

(Small update 2022-10-06, with more about medium roads.)
4
7
5
9
9
2
2
2
   
Prijs
Toevoegen aan favorieten
Toegevoegd aan favorieten
Verwijderen uit favorieten
Introduction
I always figured that if I was going to build a nice, regular, square grid that of course it should be 10×10: That way each of the blocks is fully zonable and the road length highlight and road guideline circles make it easy to draw.

But it turns out we can do better.

Can you guess what's best? Can you prove it?

(by me22ca)
Time for Mathematics
For the 10×10 grid, the calculation is simple: we get 8² zonable tiles in a 10² tile area, for a density of exactly 64%. (Here, and in the rest of the section, we assume a small—2u—road.)

For the general case of a square of side 𝓁, the zoneable area is (𝓁-2)²-max(0, 𝓁-10)²—the area inside the road minus the area in the middle where the zoning doesn't reach—and the total area is 𝓁².

It's hard for me to grok that quotient in my head, so let's just graph it and see what happens:


That shows that the "obvious" 10×10 grid is actually only as good as a 15×15 grid:


It also looks like 12u is the best. Can we prove it? Sure, let's go back to Calculus I:

0 = d/d𝓁 (𝓁-2)²-(𝓁-10)² / 𝓁²
0 = d/d𝓁 ( (𝓁-2)+(𝓁-10) )*( (𝓁-2)-(𝓁-10) ) / 𝓁²
0 = d/d𝓁 (2𝓁-12)*8 / 𝓁²
0 = d/d𝓁 (16𝓁-96) / 𝓁²
0 = ( (16)*𝓁² - (16𝓁-96)*2𝓁 ) / 𝓁⁴
0 = (16𝓁 - 32𝓁 + 192) / 𝓁³
0 = -16𝓁 + 192
𝓁 = 192/16
𝓁 = 12

So yes, it's a block length of exactly 12 that gives the best density.

(Coincidentally, that's also the maximum segment length for an axis-aligned road in CSL.)

How much better? ⅔ of the area (66.66…%) instead of just 64%.

Now, I admit that only about 4% more zoning doesn't sound that exciting. But not only is it more dense, but it's also cheaper.

How's that? Well, you need to pay for the roads. And for the 10×10 blocks, those 64 tiles of zoning need 40u of roads (1.6tiles/u), but with a 12×12 block you get 96 tiles of zoning out of only 48u of roads (2tiles/u). So you're also paying 16% less on the roads to grid the same area with more stuff.

For some concrete numbers, let's compare a 60×60 area (as it divides evenly in a bunch of ways) using a variety of block sizes and the basic small two-lane road:
Block Length (u)
Zonable Area (u²)
Road Length (u)
Road Cost (₡)
Road Upkeep (₡/week)
6
1600
1200
48,000
384 00⁄100
10
2304
720
28,800
230 40⁄100
12
2400
600
24,000
192 00⁄100
15
2304
480
19,200
153 60⁄100
20
2016
360
14,400
115 20⁄100
30
1536
240
9,600
76 80⁄100

So if you make a 10×10 grid, you'll spend 50% more than you need to for the area you'll get.

(That table also shows that zonable area drops slower than road cost, but don't forget that lower density is also increased cost for any service with a radius of effect.)
Conclusion
If you want the densest square grid, make it 12×12 (using small roads).

You'll fit 1⁄24 more RICO in the same space but spend 1⁄6 less on the roads, compared to a 10×10 grid.

Appendix A: Medium or Large Roads
What if you're using a 4u-wide road, like the Medium and Large Roads?

Then the optimal-density square grid is 16×16.

But you pay a heavy density price for the larger roads: only 50% of the area is usable for zoning.

(You can easily count this visually by considering 4×4 chunks: There are 16 total chunks in a 16×16 space, of which 8 are zonable, 1 is empty in the middle, and 7 are roads.)

To emphasize how impactful that is, 50% is the same density you get from a 24×24 grid using small roads. Leaving a massive 14×14 unzoneable hole in the middle of the square with 2u roads is equal to the best you can do with a square of 4u roads.

So if you find yourself wanting more lanes in your grid, consider using pairs of one-way 2u roads instead of going to 4u roads. Getting the extra frontage makes a big difference. For example, if you think of mentally "cutting in half" the 4-lane two-way medium roads in a 16×16 grid, you end up with an 8×8 grid of 2-lane one-way small roads. That's not a particularly efficient grid, but it's still 12½% denser than the grid using medium roads (9⁄16 instead of 1⁄2) and as a bonus you avoid the traffic lights showing up and get more parking spaces and fewer conflict points in the intersections (32 in the single full 4-leg two-way intersection, but only 5 in each of the four 4-leg one-way intersections -- a 37½% reduction).

For completeness, if you're using a 6u (48m) extra-wide road from the workshop, the the optimal zoning density is 40% using a 20×20 grid. (But those are usually industrial roads, typically used for Industries DLC buildings or other ploppables, not zoned RICO, and thus this calculation is irrelevant.)
Appendix B: Rectangles
Rectangles, as they get longer and longer, can arbitrarily approach the limit† of 80% density.

The density formula for an α×β block is ((α-2)(β-2) - (α-10)(β-10))/(αβ) = 8(α + β - 12)/(αβ), assuming both sides are 10-or-longer for simplicity (it's clear that if both are smaller than 10 it's worse than the square, and I don't care what happens for silly things like a 5×50 block).

So there's a surprising amount of choice if you just want to do better than the 10×10 block:


But your choices are far more limited if you want to beat a 12×12 block:


(Interestingly, that also suggests that 12×anything ties the 12×12 block, for larger sizes. If you think about it, that actually makes sense: the cross-section in the middle is 12u wide with 8u of zoning -- the same ⅔ as the overall -- so you can just add as much more of that as you want without changing the overall density. Alternatively, this can be shown by substituting β=12 into the formula and simplifying: the β-12 part disappears, leaving just (8α)/(α12) = ⅔, since α≠0.)

Indeed, if you restrict yourself to integers (so you can draw it with Snap to Road Length), then the only things that beat the best square block are α ∋ {10, 11}, β ∋ {13, 14, 15, ...}[www.wolframalpha.com].

How much better? Well, 10×16 has a density of 70%, an extra 5% more than the 12-square. Getting up to 75% density takes 10×32, which is more oblong than I personally like for a grid, but if you're used to New York you probably disagree with me.

But this is all somewhat unsatisfying, as the asymptote means that we can't make the best one. Instead, since we don't want blocks that are too thin anyway, let's try re-parameterizing it by enforcing a particular aspect ratio 𝘙 ≥ 1, so β=α𝘙.

That gives a maximum density when α = 24/(𝘙+1) ≥ 10. As a sanity check, for a square (𝘙=1) that correctly gives the α=12 that we found earlier. But the domain restriction on that is fairly severe; even at 𝘙=2 it gives α=8, so it doesn't apply. That means that for large 𝘙, we're back to just 10×10𝘙, which is again not telling us much. But where's the cutoff? Solving for α=10 gives 𝘙=14/10, which gives us an conveniently-integral block size of 10×14, with a density of 24⁄35 ≈ 68.57%.
So maybe that's the "best" grid, in the sense that it's the squarest aspect ration you can use without having the optimal block leave zoning gaps in the middle.

Is the extra density worth being less regular? I'll leave that up to you.

† The limit is parallel lines that are infinitely long and never connected, as that way there's never any potentially-zonable area taken up by a cross street. A quick look at the cross-section of such a road shows 4u zoneable on each side and a 2u road, for (4+4)/(4+2+4)=0.8 density.
Appendix C: Real Cities
Grid Size (chain)
CSL Size (u)
Timgad (Roman)
1⅓
3⅓
Portland
4
10
Houston
5
12½
Antigua, Guatemala
13¾
Minneapolis
15½
Ottawa
4×9¼
10×23
New York
4×14
10×30
Philadelphia
6¾×8½
17×21
Christchurch (Central City)
6×12
15×30
Salt Lake City
12
30

These are measured from satellite maps and include the widths of the roads (not just the frontage length), so don't always match the "canonical" answers you'll find elsewhere. For example, the Portland Bureau of Transportation says its blocks are 200ft (≈7.6u)[www.portlandoregon.gov].

Grid Size (ken‡)
Approximate CSL Size (u)
Osaka (Semba)
50
11
Kyoto
38×76
8½×17
Nagoya
60
13½

Thanks to @eightroomofelixir in the comments below for suggesting more Japanese cities -- I only had Nagoya[xn--7orpdr10a.tokyo] originally. (WARNING: The Japan table is still a work in progress, as I'm hitting some uncertainty in units, and want to be sure I'm getting this right.)

‡ See https://en.wikipedia.org/wiki/Japanese_units_of_measurement#Length

Why chains?

Because most of these grids are 100-300 years old. The chain unit was a 17ᵗʰ-century invention of Edmund Gunter, an English astronomer. It's 66 feet or 1⁄80 of a mile (about 20.117m†).

In the Colonies of the English-speaking people in America, the land boundaries were measured by
the chain unit, the most convenient unit for the computation of areas in acres. One acre is equal to
10 square chains.
~ Surveys and Surveyors of the Public Domain by Lola Cazier, https://www.ntc.blm.gov/krc/uploads/538/Sur_Sur_Pub_Dom.pdf

For an Australian example, the unit also explains the strange-seeming lengths in the following:

I staked the main streets ninety-nine feet wide, and after having done so, I was ordered by the Governor to make them sixty-six feet wide; but upon my urging the Governor, and convincing him that wide streets were advantageous on the score of health, and convenience to the future city of Victoria, he consented to let me have my will. I therefore gave up my objection to the narrow lanes thirty-three feet wide.
~ Robert Hoddle, 1837, quoted in http://ergo.slv.vic.gov.au/explore-history/colonial-melbourne/everyday-life/melbourne-city-grid

So while I normally would use metres, and did in fact measure in metres on the satellite map, it's probably more correct to say (for example) that Portland's grid is 4 chain (and thus 20 per mile) than try to directly write any of the various measures I got. Especially since that could be a 1-chain road with 3-chain frontage: 3 chains is 198 feet, which might be more true than the 200 feet on their website.

† Of course, being an old imperial unit, its length was different depending where you were. Today you'd think it's 12573⁄625 m, but it's actually 79200⁄3937 m in the US and 4400000⁄218723 m in England. Want to go deeper down the 2-parts-per-million rabbit hole? https://frinklang.org/faq.html#foot

Appendix D: Heterogeneous Roads
@bindulanija asked in a comment about using half small roads and half medium roads.

Conveniently, it turns out not to matter whether you pick one size per direction (such as using small roads for horizontals and medium roads for the verticals) or whether you alternate roads in both directions (like overlaying two grids of twice the size, offset from each other), as ((𝓁-2)*(𝓁-4)-(𝓁-10)*(𝓁-12)) = ((𝓁-3)*(𝓁-3)-(𝓁-11)*(𝓁-11)) = 16(𝓁-7).

So when mixing 2u and 4u roads,a 14u grid is optimal, with a density of 4⁄7 ≈ 57%.

Personally, I'd suggest the alternating-roads strategy, to avoid biasing traffic capacity in either direction.
146 opmerkingen
me22ca  [auteur] 18 okt om 10:35 
@Illinger What if you squish the roundabout on the sides so it's a squareabout? And then tile lots of them all over the city? It's a grid of one-way roads! :steamhappy:
Illinger 17 okt om 20:07 
Now, if one were completely mad and wanted to use roundabouts, instead...
c_Law 21 jul om 14:31 
@ENERGIA ROKOT Thanks for the Pythagorean insight regarding diagonals. Does the 8X12 grid allow 12 2X3 buildings or did you mean 10 2X3 buildings? I initially struggled when reading this guide until I realized grids are measured to include it's half of the road & not only the zone-able tiles. Just want to confirm if 12 buildings was a typo or if I am still failing to understand a fundamental lol
Vice_Versa 28 jun om 6:43 
nerd
antonpogeee 23 jun om 21:01 
whats a block size in the netherlands
DariusCybil 22 jun om 6:14 
nice
Albob 14 jun om 6:09 
I love this
kaloqn37 10 jan om 6:52 
Love the explanation @me22ca. For anyone who want a easy way to calculate how much cells are not zoenable after a block is made, try using this formula a*b-(2*(a+b)-4)-((a-2)*8+(b-2)*8-4*4*4), where "a" and "b" are the block lenght and width.
me22ca  [auteur] 9 jan om 16:48 
@ENERGIA ROKOT I'm glad you found it an interesting read!

You might consider trying almost-Pythagorean triples too. One of my favourites is 15² + 26² = 30^2 + 1 ≈ 30.01666², which is so close to 30 that the grid still lines up great. (It's only off by 13.33 centimetres.) And it happens to be 60.02° too!
ENERGIA ROKOT 8 jan om 17:49 
I always go with an 8x12 block. This is because 6,8,10 is a Pythagorean triple (2 * the primitive 3,4,5 triple), so I can easily integrate diagonals into my grid without mismatched tile placements. Otherwise the grid "messes up" -- i.e. tiles are not perfectly side-to-side.

Aesthetically, I also like the smaller buildings I can utilize -- I think the 2x3 low residential buildings look the best so 8x12 allows me to fit exactly 12 of these in a block with no wasted space. Also -- and this ultimately doesn't matter for the in-game mechanics -- the 2x3 buildings *look* denser because they have less wasted space on things like yards.

Nonetheless this was an interesting read, I never really thought about optimizing for just density because I've always been so anal about my grid lining up perfectly while still having diagonals.