Coding Horror

programming and human factors

Lessons from Garry's Mod

Garry's Mod is a fascinating study in guerilla programming. It's an incredibly successful mod for the game Half-Life 2 that essentially converts it into a giant sandbox powered by Lua.

There are a large number of Lua scripted 3rd party modifications for Garry's mod. In a server running the Roleplay modification, you have money and tools which enable you to sell items on the map, or to interact with other players. Newer game modes have inventories and highly advanced capabilities including Item Combining and Stock Markets.

Another example is "Wood Wars", where teams make vehicles or buildings out of wood, and then attack the other team's creations with weapons made up of anything from gas canisters with thrusters on, to shells launched from makeshift cannons.

Screenshot of Garry's Mod

It has also become a tool for users to create music videos, comics and other forms of Machinima.

If Garry's Mod sounds a lot like a full-blown development environment inside a 3D world governed by physics, that's because it is. But it started out as something much simpler. In this recent interview, Garry describes the humble beginnings of his eponymous mod:

Garry Newman: [GMod] was a total experiment. I was really out of my depth in the Source engine at that point. I had no idea how anything worked, but managed to throw version one together by thinking back into Half-Life 2--to work out where I'd seen the feature before. For example, the rope gun. I didn't know how to make rope so I thought back and realized that the Barnacle's tongue was rope. So I just pretty much copied that code into a simple weapon and it worked. Well, kind of worked. This was one of the good things about GMod. I could see the right way to do stuff because a lot of the time Valve had already done it somewhere else in the code. So their code would teach me. I'm not the kind of person that can learn from books, I really need working examples.

Shack: What would you suggest to mod teams to help them avoid getting held up on the details? Start with a simple idea and build on it?

Garry Newman: I would recommend the iterative method to anyone. The main argument against this is that they don't want to release a shit version of their idea and turn everyone off. Fair enough, but it's going to be so much worse if you work your balls off on it for 2 years then release, and your idea is still rubbish. Iterating would have let you know that this idea isn't working out, so you could adjust it. In every update you're picking up more people playing your mod. You build a community.

Garry cites classic sandbox games as his inspiration, such as SimCity, The Sims, and Rollercoaster Tycoon. But I'd say the current version of GMod goes far beyond those games and delves deep into software development territory -- he's created a sandbox for creating new sandboxes.

Written by Jeff Atwood

Indoor enthusiast. Co-founder of Stack Exchange and Discourse. Disclaimer: I have no idea what I'm talking about. Find me here: http://twitter.com/codinghorror