Skip to content
Menu
Mob City
  • Home
  • Contact
  • About
Mob City
MOB CITY
Step into the 1920s, an era of speakeasies, smuggling, and syndicates. Manage your crew, bribe officials, and outmaneuver rival gangs in this crime empire management sim

Animating pawns (a proof of

Posted on December 27, 2024

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…

Continue Reading

First attempt at building occlusion

Posted on December 7, 2024

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…

Continue Reading

UI: pygame-gui vs imgui_bundle

Posted on December 2, 2024

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…

Continue Reading

Drawing opaque and semi-transparent pixels in the shader

Posted on November 30, 2024

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…

Continue Reading
Player directed pathfinding

Pathfinding

Posted on November 23, 2024

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…

Continue Reading

Y-Sorting in Isometric Games

Posted on November 1, 2024

In isometric games, rendering order is crucial. Objects closer to the camera should appear in front of objects further away. This is where Y-sorting comes in—it ensures that when drawing sprites, the objects in the back are rendered first, and those in the front are drawn last. Without proper Y-sorting, objects can overlap incorrectly, breaking…

Continue Reading

Moving to OpenGL: Instance Rendering with ModernGL

Posted on October 19, 2024

After trying blitting and SDL2 rendering in Pygame, it was clear that neither would be enough for large-scale NPC rendering. Even with optimizations like culling non-visible NPCs, FPS would drop too fast as soon as I started adding animations or game logic. So, I finally switched to instance rendering in OpenGL using ModernGL, and the…

Continue Reading

Rendering with SDL2

Posted on October 9, 2024

As blitting in pygame turned out to be not enough, it’s time to see how pygame’s experimental SDL2 module compares. When comparing FPS between the two approaches, it’s important to keep in mind the non-linear nature of FPS. Also, worth noting that as of writing this SDL2 module in pygame is still in development/experimental. Pygame’s…

Continue Reading

Non-linear relationship between FPS and frame-to-frame time interval (Δt)

Posted on October 6, 2024

Before I implement SDL2 rendering, it’s worth reminding ourselves what FPS actually is and how it is measured as this is the metric I’ll be using to benchmark performance. It’s important because you can’t compare FPS gain from 30 to 60 against a gain 300 to 330. FPS (Frames Per Second) refers to how many…

Continue Reading

Optimizing Rendering by Blitting Visible Entities Only

Posted on October 5, 2024

A few months ago, I optimized blitting a lot. But wasn’t really satisfied with the results. I thought of giving up on pygame entirely. Yes, there is that experimental SDL2 wrapper to try but I was a bit disappointed with pygame’s rendering capabilities altogether so didn’t pin my hopes to it. I went looking for…

Continue Reading
  • 1
  • 2
  • Next

Recent Posts

  • Animating pawns (a proof of
  • First attempt at building occlusion
  • UI: pygame-gui vs imgui_bundle
  • Drawing opaque and semi-transparent pixels in the shader
  • Pathfinding
©2025 Mob City