Skip to content
Menu
Mob City
  • Home
  • Contact
  • About
Mob City

Animation

Posted on February 14, 2025

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 with some help, I’ve managed to create modular assets that I can render and reuse across different animations and directions. It’s already making a huge difference in workflow and consistency.

Blender assets

Before going back to “first principles” (as in, animating everything in Blender for an isometric game!), I tried a bunch of other routes: browsing free assets, trying to stitch things together manually, even experimenting with AI-generated sprites. All of it turned out to be pretty futile.

Eventually, I accepted that the only real path forward was to use Blender to rig, animate, and render everything myself. The approach I settled on was straightforward: find the right modular assets and start merging them.

Clothing was the first step. Below, you can see a pawn-in-progress in a T-pose, dressed in a hat, shirt, jacket, trousers, and a coat – ready to be rigged and brought to life.

This was done for guns (pistol, shotgun, Thompson (“Tommy”) gun) as well.

Rigging

Adobe’s Mixamo was a godsend. It saved me a ton of time. The workflow is simple: upload a T-posed .fbx file, choose from a library of poses or animations, export them, and then bring them into Blender for styling and final tweaks.

It’s not perfect, but for getting decent base animations quickly, it’s incredibly useful.

A lot of time went into importing various poses (running, walking, shooting a shotgun, and so on) and making sure I had the right Blender materials set up to easily swap clothing and gear around.

Rendering combinations

One of the more fun parts of this whole process was coming up with combination templates (like the ones circled in the screenshot) and writing logic to swap materials based on each template string. For example, one way to build a pawn is by using “combos_list[0]“. From there, you start assigning materials—like picking a coat by using the "4. Body Coat" key from CFG_MATERIALS, which might have options like "Coat Camel" among others.

After a few rounds of trial and error with Blender scripting (thankfully it’s all in Python!), I finally started seeing results – here’s what I’ve got so far:

Animation framework

The framework turned out to be fairly lean. You can see the basic skeleton below. The real magic happens in self.animate_entities() where I use a few techniques – like dynamic chunking – to keep performance in check. This part probably deserves its own blog post down the line

The images rendered from Blender were packed into a texture atlas. I initially made a few memory-heavy attempts where I tried to detect the maximum bounds across all frames and use that as the standard size for each animated pose. The idea was to avoid having to compensate for pixel offsets when cycling through sprites. It worked in terms of simplicity, but it turned out to be a memory hog.

So, in the end, I packed the images as tightly as possible and handled pixel offsets manually when pulling coordinates from the texture atlas.

I was pretty happy with the variety this algorithm produced, so I decided to wrap up my Blender journey (at least for now). Here’s how it looks when you quickly flick through the images.

And in the game

  • animation
  • blender
  • blender scripting

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Modular building graphics
  • Lit up mode in night time
  • Night mode (tinting with shaders)
  • Traffic system and cars
  • Animation
©2025 Mob City