two attempts at a city simulation game
Free time projects | 2015 - 2016 / 2022
While coming up with new things I wanted to try in the Unity Engine back in 2015, I came up with the idea to make a simple grid-based city building project. While working on a basic prototype I quickly realized how much learning potential a project like this actually had. This little experiment then accompanied me for the next two years, becoming a larger game project as the days went by.

Six years later, I wanted to give a project like this another try. This time however, I tried to add another challenge:
To make a game like this with no game engine.
Concept
The core idea was to make a city builder game, inspired by the SimCity games, but on a much smaller scale. Unlike SimCity, which often feature large-scale worlds to build your cities on, I wanted to focus my attention more on the little details and the ability to precisely control the development of your city. By limiting the playable map to a rectangular grid, the project became far easier to create.
Execution
The first step was to be able to generate an empty world using a grid of tiles. Next up came the placement of buildings, roads and vegetation, both from user interaction and from loading premade template maps. Then I added a simple economy system, where housing generates income and other buildings and road cost maintenance.
All buildings were modeled in SketchUp over the project’s two year timespan.
Details, for example the dynamically generated vehicles on the road or a working day-night cycle, were slowly being added as well.
The original project was created in Unity 5.0 and was upgraded to a more recent version to add post-processing effects for the sake of this portfolio.
Details
After having created the game’s base mechanics, I focused on adding details to the now barren and lifeless world.
One of them being a dynamic traffic system, where every vehicle is simulated and follows a precalculated path.
From there I added an employment system, where every inhabitant gets a job assigned and drives to work every morning and back home at evening, even creating traffic jams in larger cities.
To break up the repetition of seeing the same buildings multiple times, the vegetation on each placed building is randomly generated.
Another way to add variety was the ability to upgrade buildings with additional floors, yielding more real estate for people to live in.

Timelapse of a typical city

2D De-make
After learning some basics on how to create a Winforms/WPF application with my recent Raytracing project (see: Raytracing), I wanted to try to make a game with it. From the very beginning it was clear that this was not to become a real 3D game. Inspiration came from the old DOS/Win98 game
SimCity 2000 and their pixelated isometric graphics.
Example on how a city might look like
Example on how a city might look like
Graphics
The various tiles are drawn in Photoshop, with the ground tile having a resolution of 32x16 pixels. A very early version used only 16x8 pixels, but I realized very early on that it was next to impossible to  give the buildings enough detail on that  resolution.
By precisely arranging the map’s tiles at the right locations, the illusion of a three-dimensional isometric world is created.
Statistics
Just like in the Unity version of the game (and as it is common in city building games), I wanted to be able to draw statistical maps directly in the 3D view. While it was quite straightforward to do in Unity, by using a top-down projector with the map as the texture, I had to instead find a way to tint each building as it was drawn.
Eventually I found a way which involves converting the colors into a low-contrast graysacle version and tinting it with the color needed.
Visualizing road usage directly in the 3D view
Visualizing road usage directly in the 3D view
The function used for the grayscale filter
The function used for the grayscale filter
Day-Night cycle
Once that was in place, new possibilities opened up for the game. By gradually darkening everything with a dark blue color I was able to make a believable day-night cycle. Adding a layer of lit windows on top of all inhabited buildings gives the impression that there are actually people living in the city.
Back to Top