Creating realistic, varied buildings for a city simulation game presents unique challenges. How do you generate hundreds of unique structures without manually crafting each one? How do you ensure they feel authentic while maintaining performance? I’ll show you my attempt at solving this problem. At its core, every building in my game is constructed from modular components that stack together like digital…

Lit up mode in night time
I didn’t go with the standard approach to scene lighting for an isometric game. Instead, I took a route that’s a bit easier and a little more creative. It starts with adding two sprites: a street lamp and a separate light source, which stays hidden during the daytime. The lamp, its light glow, and things…

Night mode (tinting with shaders)
In the beginning, I definitely wasn’t planning to add a night mode, but with shaders in ModernGL, it turned out to be pretty easy. You just tint the pixels in the fragment shader. For a quick proof of concept, I went ahead and tinted everything to see how it would look. In the shader, when…

Traffic system and cars
Earlier I posted about A Star path finding algorithm for car traffic. In this post, I’ll show how we use it. First, I rendered all 8 directions in Blender for two types of roads – main roads and normal roads – and manually placed them to see how they looked together. After some back-and-forth between…

Animation
Last time I showed a quick POC demonstrating that animating with Pygame and ModernGL works nicely by simply flipping atlas coordinates every n frames. Since then, I’ve been working on turning that approach into a more formal animation framework. But more importantly, I’ve started spending some time in Blender. I’m far from an expert, but…

Animating pawns (a POC)
I’ve started toying with animation. While it’s not a full-blown animation framework yet, it works as a solid proof of concept. The idea is simple: cycle through images over a period of time to simulate movement. I began by rendering 20 frames of a pawn running in each of the 8 directions used in isometric…

First attempt at building occlusion
In a big city full of multi-story buildings, pawns can walk between them. If they walk behind a building, the player won’t be able to see them, meaning they might miss them entirely or be unable to select them. This is a classic visibility problem. There are various solutions to it, but most of the…

UI: pygame-gui vs imgui_bundle
When it comes to building in-game UIs in Python, pygame-gui and imgui_bundle take two very different approaches. I’ve tried both, and while each has its strengths, they suit different needs and workflows. pygame-gui is much easier to drop into a Pygame project. It runs in the same Pygame window, supports importing images for things like…

Drawing opaque and semi-transparent pixels in the shader
I was making a selection marker decal and to make it appear smoothly, I noticed a broader issue when rendering alpha-0 and alpha non-0 pixels in the shader. I had to adjust my frag shader to draw opaque pixels in a separate pipeline from semi-transparent pixels: Later, I encountered a smaller issue of y-sorting it…

Pathfinding
One of the more interesting aspects of game development is to pick and implement a variety of pathfinding algos. For now I settled on three kinds of pathfinding algos for the game: Traffic A Star This version of A* is tailored specifically for vehicles navigating city roads. Instead of scanning the full grid like traditional…