Garry’s Mod – Multiplayer Gory Exploding Head Mod

I’m very passionate about Garry’s Mod modding, it’s actually where I developed a lot of my programming skills; my playtime on that game is 4,229.3 hours.

2 minutes read

Platform

PC

Engine

Garry's Mod (Source Engine)

Technologies Used

Garry's Mod Lua

I’m very passionate about Garry’s Mod modding, it’s actually where I developed a lot of my programming skills; my playtime on that game is 4,229.3 hours. This was a script that would trigger the player’s heads to explode if shot by certain weapons.

The trickiest part about this mod was the networking, you see, Garry’s Mod does have a difference between Client and Server code, and I wanted to make this mod work in multiplayer. At the time, all the other gore mods (like the famous “goremod”) did not work in multiplayer. This one was only for the head, anyway, but it sort of was a first of its kind. The tricky part was the fact that when a player died, their ragdoll model did not immediately exist on the client. So the server would need to enqueue the player’s head to explode as soon as it became available, rather than immediately triggering the explosion, that would cause an error.

In the meantime, the server spawned some meaty chunks which had their own code, as they had to emit sounds and particle effects upon collisions or gunshots. Once the ragdoll became available, its head would be “deflated” (set the skeletal rig’s head bone scale to 0). Anyway, here’s a demo of it working.

To demonstrate that the mod works in multiplayer, here’s a dude playing around with the spawned chunks, and an admin even removing one towards the end to clean up the scene and avoid newly joined players accidentally roleplaying to that.