Thursday, August 24, 2017

Road trip sketches; notes on extracting and visualizing Half-Life 2 levels in Maya

So I'm working on (another) article about level design in Half-Life 2. I chose the d2_coast03 map of the Highway 17 chapter, which is the first real "coastline" road trip section of the game, and is probably the most successful. Look at how big and open it is. Would you believe this is a map in a game celebrated as a meticulous roller-coaster? In my mind, it's contemporary with a lot of vehicle-based first-person open world game design trends that started around the same time in 2004, and they even pulled it off in an engine architecture that's still kinda based on Quake 1.

Getting the level geometry into Maya proved to be a bit of a challenge. I'm using the good ol' Crafty BSP viewer from Nem's Tools. Unfortunately, Half-Life 2 BSPs don't ship with LDR lightmaps anymore -- and modern Steampipe and VPK systems break Crafty's 2010-era Steam filesystem support, so I had to use GCFScape to manually extract all the models and materials from the VPK archives before opening the levels in Crafty. (You'll also have to manually mount the folders in Crafty's file system; open the File System window, right-click on "root", and then browse to your \hl2\ folder or whatever Source game folder you're using.)

After that, it's pretty straightforward to use Crafty to export to .OBJ format with all textures and BSP + prop geometry intact (just make sure you export textures to TGA, and not JPG, because for some reason that breaks all the prop UVs during export).

There are also several other options for exporting Source Engine level geometry into the 3D tool or engine of your choice: Wall Worm is good if you use 3D Studio Max, and if you want to bring it into Unreal Engine 4 then you can also use the handy HammUEr plugin. Here's a sample screenshot of Joe Wintergreen UE4 test import, using the d2_coast01 map:

I think it points to an eternal dream among many level designers -- to have some sort of "universal" file format that all engines and editors can use. Sadly, the dream dies a bit more everyday; each year, 3D level design is becoming more specialized and more inaccessible to the average computer user. Most AAA games either develop their own proprietary file format and/or never release their tools, or their designers just do everything in Maya and attach some metadata to it later.

In 2D land, they're a bit better about this: a fair number of tile-based 2D games use engine-agnostic tools like Tiled, which can integrate with many different engines. There's an indie infrastructure built to support these kinds of games, with accepted technical solutions and implementations. Where's the general-purpose indie 3D level editor we all desperately crave? The universe cries out for a hero...