Design Doc
Source Code
Live Builds

Developer Diary #5: Back to Business


Finishing my bachelor's thesis. Marrying the girl of my dreams. Going on honeymoon.

All three very good excuses to not do something very important: work on Citybound. But now I'm back. For three days I've already been working fulltime on the game again. I couldn't be more thrilled and motivated - this blog post will give an overview of the progress I made.

Day 1: traffic lights, roads, T-intersections

My goal for this day was to finally implement something that I kept postponing: traffic lights. But since all lower-level traffic behaviour (basic collision avoidance) was in place, I had no excuse to not do it. Pretty soon I came up with a generic algorithm for figuring out traffic light timings, which I roughly modeled after my experience:

(animation sped-up by a factor of 10, ignore the bad loop at the end)

Then I wanted to test the algorithm with intersections of different sizes, so I quickly added keybindings to increase or decrease the number of lanes per road:

One-way and two-way roads of different widths.

My traffic-light-timing-algorthim seemed to produce reasonable-ish results for all kinds of intersections:

(static image)

This first implementation of the algortithm was just to make sure no conflicting directions get green at the same time. There still are a lot of cases where it could give green to more directions at once though.

Finally I started to implement T-intersections, something that I didn't pay attention to at all so far. This still kinda broken T-intersection is all I got before I called it a day:

Day 2: cars & traffic lights, t-intersections

I decided to start this day with a livestream:

Full livestream

In the livestream, we made cars react to traffic lights:


(ignore the cars with glitchy color)

Later that day, I made a little more progress on T-intersections. They are still slightly wrong though, and their traffic light timings are very weird.

Day 3: lane changing & merging behaviour

Today I was able to implement something in one day, that took me more than one week, the first time I tried it: cars changing lanes and reacting to other cars while merging. It is also not perfect yet, but already works pretty well:


Three lanes worth of cars trying to turn right.

That's all! I'm quite proud of the progress during those 3 first days and I hope to continue with this speed :)

What Michael has been up to

Michael started doing livestreams of his own, make sure to follow his channel as well!

Lately he has been working on something called Straight Polygon Skeletons, which is an algorithm to find something like the "spine" of arbitrary polygons:

It will be useful in a lot of places in Citybound, two important application examples are roof geometries and parcelling of irregular road blocks into building lots.

He said he will start working on the latter soon - I can't wait!

→ Discussion on /r/Citybound