Evil Engine
Devlogs
2025-10-15 23:40 MST

Half-Life 2's models in Godot

sourcegd, a little Godot 4.5 project that reads Half-Life 2's VPKs, lists every model inside them and shows you whichever one you pick.


sourcegd is me poking at whether Godot can read Source’s files directly, with no conversion tools sitting in between. It’s about 2,300 lines of GDScript on Godot 4.5.

What it does

Point it at a Half-Life 2 install and hit “Load All Models”:

  1. It opens hl2_textures_dir.vpk and hl2_misc_dir.vpk, Valve’s own archives, and reads files straight out of them
  2. It finds every .mdl inside and reads each one’s header, so the list shows the model’s real name
  3. Pick one in the model browser and it builds the mesh from the model’s VVD vertices and VTX strips, converted from Source’s axes over to Godot’s
  4. It hunts for textures in the model’s texture folders first, then each material’s $basetexture, then by filename as a last resort
  5. VTF textures get rewrapped as DDS so Godot will load them

Then whatever you picked spins on a turntable.

Half-Life 2’s rusty oil drum loaded in sourcegd, textured, under the VPK and model paths it came from

What it doesn’t do

  • Models are static, so there are no bones, animation or physics
  • Only DXT1, DXT3 and DXT5 textures load
  • The VMT reader only cares about $basetexture and $surfaceprop and skips everything else
  • When a material doesn’t resolve, texture lookup falls back to matching filenames, which is about as janky as it sounds

Image preview