Post news RSS Dev Log #1 - New Weapon

Demo of a new weapon for White Forest; The nailgun!

Posted by on

Hello everyone! I am pleased to share with you all the progress that has been made on a new weapon for White Forest; The Nailgun;

GIF showing the nailgun being used to open a door

GIF Showing the nailgun electrocuting zombies


On the 4th of May 2022, the videogame documentary YouTube channel ‘noclip’ uploaded an hour long video demonstrating some of the gameplay from a cancelled Half-Life 2 expansion from Arcane Studios called ‘Ravenholm'.

This is what initially inspired the development of White Forest as during the hour long gameplay showcase a custom nailgun weapon was demonstrated, A weapon that had the ability to conduct electricity, trigger traps as well as electrocute enemies. After seeing this in action, I challenged myself to attempt to recreate it which over time evolved into White Forest.

Development History


This was the first proof of concept of the nailgun.

When a crossbow bolt impacts a surface, we create a new point entity of type 'point_electric_nail' to act as our ‘nail’. This entity looks for any other ‘active’ nails in a small radius, if it finds an active nail the it will consider it its ‘child’ and draw a beam to it.

As the nail is a point entity it can be used in map making, this is how we can create electricity sources. By placing a nail in the map (with no associated model) and setting it to active, any nail shot nearby will find it and make it it's child.


The next step was to make our electrical beams between nails deal damage to the player and NPCs.

Dealing damage to NPCs and the player was rather simple, just fire a ray between the nail and it's child, any player or NPC that gets in the way take damage. The main issue was that it didn't look very convincing if NPCs just collapsed after walking through the beam. I initially tried using the ‘dissolve’ effect which looked even worse (the dissolve effect happens if an NPC gets hit by the secondary fire of the AR2).

if you've ever used the super gravity gun from the later chapters of Half Life 2, you may remember that NPCs that get punted by the super gravity gun have an interesting effected applied to their ragdoll where their corpse twitches with electrical energy. This effect is delightfully referred to in the code as 'Ragdoll Boogie' and makes a perfect effect for any NPC hit by the electrical beams

Additionally, I also changed the beam sprite texture as the one I was initially using didn't look very good (and for some reasons could also be seen through wall).


After spending some time working out how to get custom models into the source engine as well as figuring out how the weapon and ammo system works. I separated the nail logic from the crossbow, purchased a nailgun model from CGTrader and managed to get the nailgun into the source engine as a new weapon with a custom ammo type.

This really helped to bring the weapon to life, a maximum clip of 100 nails, no waiting to reload a custom model and basic animations really produced a convincing effect.


A bit of a gap since I last worked on the nailgun. At this point I had decided to commit to creating a Half-Life 2 mod, something that I had always wanted to do but lacked either the time or experience and with the amount of work I have already put into this, now is the best time to create a mod.

So at this point I was busy at work on the first map but after thinking out about how the mod would play out and what puzzles I wanted in the game, I realised there was a small bit of the puzzle left, I hadn't actually added any code to handle nails being deactivated! So after a small rewrite of the nail logic we now had nails that could handle their electricity source being deactivated.


You may have noticed in earlier videos that we are still using the crossbow bolt as the nail model. I had originally intended to use a custom nail model, but it seems that Valve have provided a suitable alternative with the railroad spike model from Episode 2. This made a suitable replacement and struck the right balance between realism and being easy for the player to spot and pickup.

I had been busy working on the maps and had not touched the nailgun code for a sometime when I decided to implement being able to pickup nails (I really don't recommend this style of development, it's much easier to get work done if you don't leave large gaps of time between features).

As it currently stands, this is the latest version of the nailgun, I will make some additional tweaks as required, some custom sound for the electrical beams would help.

Overall I'm quite proud of how this has turned out so far, considering I have never programmed anything before in C++, let alone the source engine.


Will you release the code?

Yes, once I get a bit further in development, the whole nailgun source code will be released for people to do with as they wish.

What's the maximum distance between nails for electricity to conduct?

This is currently set to 75 hammer units, originally this value was hard coded but I have moved it to a console variable so that the radius can be configured on the fly.

Can you nail NPCs feet/body parts to the floors/walls?

No, I don't intend to implement that feature and would prefer to leave it to someone who is smarter than me to figure out.

Will I be able to electrocute enemies standing in water with electricity?

Yes, I'm currently working on a brush-based entity that will detect the presence of an electric nails and electrocute any NPCs within it.

Will you be (re)making Arcane Studio’s Ravenholm mod.

No, White Forest will not be related to Ravenholm in any way, although this project started as an attempt to recreate Arcane’s nailgun I have decided that I want to create my own story rather that try to recreate someone else's.

How's the mod coming along?

Good, I spent a fair bit of time redesigning how the second map plays out (you get given the nailgun in this map) as I was not happy with the overall flow and some of the puzzles I had initially created were a bit obtuse. I have now started work on the third of the five maps and it is coming along nicely.

Thanks for reading this far, see you in the next update!

SweetRamona - - 5,159 comments

New weapon looks fun to use! 😺

It makes me think of the crossbow in Bioshock with one of it's alternate ammo types being electric tripwire bolts

Reply Good karma Bad karma+1 vote
asw01 - - 141 comments

wow. your put more effort into this than I put into anything.

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.