by

Developer Diary #1: Where do you think you're going?

(
Jan
07
)

Finally a little progress that is literally visible! Cars now kinda started working on the new roads. (As you can see, not completely, more soon!)

To give you an idea why it took so long to get here, here is a short description of the deep underlying differences between the old and the new road system:

Old:

smallest entity: lane piece (just one straight or curved segment)

cars were managed on a per-lane-piece-level!

roads were collections of a lot of lane pieces

intersections consisted of even more lane pieces!!

the code for multilane and intersection traffic had no chance but to be horrible, for each car you needed to constantly consider at a lot of cars on other lane pieces

connections between lane pieces were given implicitly

finding conflicts between lane pieces for intersection behaviour was hard, ignoring false positives was even harder!

New:

smallest entity: lane bundle

cars are managed on a per-lane-bundle-level

this means it is a lot easier to do multilane traffic: all the relevant cars are probably on the same lane bundle

roads consist of just one or two lane bundles (one, or two-way road)

intersections still consist of many lane bundles

shape information needs to be stored only once per lane bundle, the graphics card takes care of rendering cars in the correct position according to car's progress on the lane bundle and its lane offset

connections between lane bundles are given explicitly by so called "connection points"

I'm already tired and I probably forgot a lot of stuff, or wrote it in an incohesive way, but I hope this first developer diary was interesting.

Let me know what you think!

Discussion on /r/Citybound
Support Citybound