Hacker Newsnew | past | comments | ask | show | jobs | submit | Ef996's commentslogin

This is amazing. Some objective would be great


Author here: i agree the article oversimplified here and in practice vehicle tracks can sometimes be non concentric. But it has nothing to do with differentials. Differentials just allow wheels to rotate at different speeds (as perimeter of a smaller radius circle is smaller the outer one). Non parallelism usually comes from the Ackerman steering or slipping. But rear tracks of a vehicle going slowly through sand will always be concentric. Parallelism is important for engineers because it also allows multiple vehicles to go in parallel on a multi lane road. You can see how that is failing with bezier paths in the CS2 ss in the article. Also hairpin turns are usually designed with arcs in mind as well


Will share more soon. I have some more recordings of it on x https://x.com/SandboxSpirit if you're interested.


Yep, good point. I am myself a huge fan of livable oriented infrastructure (bike lanes, pedestrian paths, public transportation) but the hard truth is that roads were initially designed for carriages and later for cars. A though I recurrently have is how would a city designed from scratch by a civilization that uses only bikes and walking look like?


Why should you use only bikes and walking? Cars/trucks have a role to play, it's just not the most efficient to move the majority of the people from one point to another. Simple examples: ambulances, firefighters, police, cranes.


True. I mostly meant not personal vehicles, so jut buses, trams etc. I supposed emergency services will use those dedicated lanes. or maybe civilization is so advanced those will be served via flying only. Idk just since fiction thinking.


Roads as in? I recall hearing once (with no current source nor desire to research) that most city streets were originally at least _used_ with pedestrians in mind. Whether they were created for carriages or not, the advent of the automobile really messed up a lot of how people primarily used streets


I am a huge fan of satisfactory as well (probably no surprise for anyone)


I mean they are not a math nightmare per se if you’re comfortable with the theory. What I meant is that they become comparatively complex to integrate into a system like this. Think about arc length, compute intersections, reparametrization, etc., and with clothoids that usually means some complex numerical algorithms.

Using circular arcs or even simple third-degree polynomials (like cubic parabolas) reduces many of those operations to trivial O(1) function calls, which makes them much cheaper to evaluate and manipulate procedurally, especially when you're computing it 60 times per frame


You might be familiar with these, but GP wrote a couple of excellent pieces on Euler spirals:

https://raphlinus.github.io/curves/2021/02/19/parallel-curve...

https://levien.com/phd/euler_hist.pdf


Wow, that’s a really detailed deep dive, saved it for a read later. I didn’t even realize clothoids are also tricky to connect. I never really dared to jump into actually implementing them myself.


Yes, I don't even know how I didn't know about this at the time of wiring the article. But a must read for sure!


Glad you mentioned it. Cubic parabolas were actually used by eraly railway engineers as good approximations of clothoids back when numerically solving a true euler spiral was a daunting task.

They are visually very close because their curvature increseases approximately linearly along the curve but not exactly. Mathematically speaking if you wirte the cubic parabola as something like y = kx^3, the second derivative (which give the curvature) grows linearly with x which makes it behave similary in gentle transitions.

The problem is that the second derivative is not enough alone for having a true smooth curvature. The real curvature formula has in the denominator the first derivative as well (slope) making it not increase perfectly linearly along the curve. (denominator becomes larger and larger as x incrases)

But yeah, cubic parabola is basaically a good enough approximation. Might be a good solution for a system like this.


Very happy reading this because I was always thinking exactly the same about historical games. One of my turn offs for any historical city building is when they are grid based. I always found that to be highly unrealistic, but I yeah, was aware that it was just some unneeded complexity and just my nerdy nitpicks. The point you make would’ve actually been a strong argument in my article. Too bad I didn’t have the inspiration to include it. The way historical cities developed in an ordered yet intricate way without any central planning (same as ant colonies) is actually very fascinating and I might write about this at some point.


Regarding modern roadways and viaducts that pass around medieval city cores, it's fascinating how they can be seen and still not seen. I tried to do this in Cities Skylines II for awhile, building very narrow streets in "organic" city centers with low-to-mid density, and then transitioning to a new city grid around the old center. Finally, superimposing highways and tunnels without destroying the original historical core. There were some beautiful results, but the traffic jams were astounding, even with limits on the city center roads and highway exits. This is the way cities actually grew, so to me it's much more interesting to simulate than a "perfect" city built all at once. One thing that was fun in SimCity 3000 was that certain technologies didn't become available until you had a certain population. I would almost wish that a city-builder now would allow you to take that to the extreme: Spend 200 years with horse-drawn carts before you can pave a road, and then figure out what to do with the mess. But more than anything: Oddly shaped buildings that fit into oddly shaped lots, which are not limited to hotdog stands.


Haha. I myself tried to play CS like that. Start with a historical core. The thing is the way the game is implemented buildings only have rectangular footprints while in reality buildings occupy the spaces more organically. I actually spent quite some time on google maps trying to see what pattern historical buildings followed to fill in spaces but couldn't get a definitive answer. I drafted it at some point in sketchup. Here is the result

https://imgur.com/a/procedurally-generated-buildings-that-or...


That's very cool! Thinking about historic city centres, like Prague, the presence of courtyards is also really important. But what often seems to happen is that several smaller buildings will conform their fronts to the curvature of the street, being more or less rectangular themselves, but not as deep as half the block, so that they form natural courtyards between themselves and the buildings on the opposite sides of the block. So in your example, the smaller buildings might be only 2/3rds of their depth, forming courtyards in the center of the block that aren't exclusively part of any one building. I'm not really sure why it happened that way, historically, that they didn't build as deep back into the block as they could. Perhaps because the apartments were small and they could get two across a hall if the rear apartment had a window to at least some air. (Having lived in one of these rear ones in Prague for a little while, I can attest that it's not a window you want to open - the air is mostly full of pigeon feathers and excrement).

The way you have them formed, though, seems to point to an obvious algorithm that would divide building fronts into tall rectangles and stitch them together. I wonder since you already have all those nice street splines, maybe they could be applied to the building faces and rooftops as well.


I will definitely explore this in the future as architecture is probably my next passion after roads :D


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: