- Games
- FPS Games
- Half-Life 2
"The two biggest bug-farms in gamedev - doors and floating point - contrived to make a simple NPC placement bug into quite the time-travelling palaver"
Comments (0) ()When you purchase through links on our site, we may earn an affiliate commission. Here’s how it works.
More than 20 years later, we're still learning new and fascinating details about the legendary Valve FPS, Half-Life 2. Today, we're hearing a story form former Valve designer Tom Forsyth about a game-breaking bug discovered in 2013 that seemingly time-traveled and infected the original version of the game.
I understand that's a lot to take in, so let's unpack this genuinely entrancing case of technological happenstance. As extensively detailed on Forsyth's Mastodon, Forsyth and Valve programmer Joe Ludwig were working on porting Half-Life 2 to the Oculus Rift VR headset, and Forsyth encountered a bug very early in the game that locked him out of a room and thus away from the critical path. There was no way to go forward, which was weird enough, but what made it weirder was the fact that no one could remember encountering the bug in the original game. Forsyth even watched videos of the opening scene where he was encountering the bug, and it wasn't there.
You may like-
Half-Life 3 copium goes into overdrive as fans convince themselves Valve's Steam Machine announcement is hinting at a reveal: "I don’t want to get anyone's hopes up"
-
Baldur's Gate 3 publishing lead says Valve defeated Meta and Apple in VR by building "incredible spaces for actual geniuses" instead of worrying about non-existent shareholders
-
Discovering new Super Mario Bros levels that have "secretly been accessible" for over 30 years, "legendary Mario scientists" find themselves in a psychedelic cyberpunk hellscape hiding on their childhood SNES cartridges
Obviously, the most urgent concern at the time was just getting the bug fixed before the game was to be shipped on Oculus Rift, but adding to the frenzy was the fact that Valve seemed to be dealing with a time-traveling glitch. It didn't exist before, and now it did. "How can this possibly be? At this point people are freaking out - this isn't a normal bug - it appears to have traveled backwards in time and infected the original!" said Forsyth.
Eventually, the developers were able to identify the source of the bug: a guard who was in the now inaccessible room was standing too close to the door, and his toe was colliding with the door as it swung open and causing it to swing back into a closed state. Now that the issue had been discovered, the fix was "easy" even if it "took a lot of work to find because people had to dust off old memories of how the debugging tools worked, etc."
Still, the mystery lingered. How in the name of Gabe Newell did this bug from 2013 manage to find its way in then-nine-year-old code? And furthermore, why was the soldier's toe not preventing the door from opening in 2004? Or in any of the ensuing years until the bug was discovered?
Sign up to the GamesRadar+ NewsletterContact me with news and offers from other Future brandsReceive email from us on behalf of our trusted partners or sponsorsBy submitting your information you agree to the Terms & Conditions and Privacy Policy and are aged 16 or over."But why did this EVER work? The guard's toe was in the way in the original version as well. As I say, we went back in time and compiled the original as-shipped source code - and the bug happened there as well. It's always been there. Why didn't the door slam closed again? How did this ever ship in the first place?"
Well, thankfully, there's an answer to this riveting mystery: "good old floating point," per Forsyth. I'm going to let an actual game designer do the talking for this part, but essentially, it's not the game code that was the problem, it was the hardware that was instructing the precision of the game's physics, and due to pure coincidence, that precision allowed the door to swing open on hardware it was originally built for, but not on the 2013 kit Valve was using to test the game.
"Half Life 2 was originally shipped in 2004, and although the SSE instruction set existed, it wasn't yet ubiquitous, so most of HL2 was compiled to use the older 8087 or x87 maths instruction set," said Forsyth. "That has a wacky grab-bag of precisions - some things are 32-bit, some are 64-bit, some are 80-bit, and exactly which precision you get in which bits of code is somewhat arcane.
You may like-
Half-Life 3 copium goes into overdrive as fans convince themselves Valve's Steam Machine announcement is hinting at a reveal: "I don’t want to get anyone's hopes up"
-
Baldur's Gate 3 publishing lead says Valve defeated Meta and Apple in VR by building "incredible spaces for actual geniuses" instead of worrying about non-existent shareholders
-
Discovering new Super Mario Bros levels that have "secretly been accessible" for over 30 years, "legendary Mario scientists" find themselves in a psychedelic cyberpunk hellscape hiding on their childhood SNES cartridges
"But ten years later in 2013, SSE had been standard in all x86 CPUs for a while - the OS depended on it being there, so you could rely on it. So of course by default the compilers use it - in fact you have to go out of your way to make them emit the old (slightly slower) x87 code. SSE uses a much more well-defined precision of either 32 or 64 bit according to what the code asks for - it's much more predictable."
Well, what that 32 or 64-bit precision was asking for, apparently, was a guard's foot that wouldn't give way to a door colliding with it. In the original x87 code, there was just the right amount of friction built into the guard's boot to allow it to pivot exactly enough for the door to swing past it and open properly, but the newer SSE had "a whole bunch of tiny precisions" that were "very slightly different, and a combination of the friction on the floor and the mass of the objects means the guard still rotates from the collision, but now he rotates very slightly less far.
"So on the next frame of simulation, his toe is still in the way of the door," said Forsyth. "The door isn't allowed to just pass through his toe, so it does the only other option - it bounces back. I think by default it's set to do so completely elastically, so the door bounces back with exactly the speed it came in at, slams shut, and locks again. And you're stuck."
That means, amazingly, the bug had existed in the game the entire time. The guard was always standing too close to the door, but because the compiler in the original build defaulted to an older floating-point precision, the game's physics were ever-so-slightly different to what you'd see on a newer compiler, and that tiny bit of discrepancy meant the difference between a game-crucial door opening and not opening.
"And there you have it," Forsyth concluded. "The two biggest bug-farms in gamedev - doors and floating point - contrived to make a simple NPC placement bug into quite the time-travelling palaver."
Half-Life 3 "would register on a GDP level" as a Steam Machine launch title, but "Valve doesn't need a Half-Life-sized spectacle to sell hardware," analyst says
CATEGORIES PC Gaming Xbox PlayStation Platforms
Jordan GerblickSocial Links NavigationAfter earning an English degree from ASU, I worked as a corporate copy editor while freelancing for places like SFX Magazine, Screen Rant, Game Revolution, and MMORPG on the side. I got my big break here in 2019 with a freelance news gig, and I was hired on as GamesRadar's west coast Staff Writer in 2021. That means I'm responsible for managing the site's western regional executive branch, AKA my home office, and writing about whatever horror game I'm too afraid to finish.
You must confirm your public display name before commenting
Please logout and then login again, you will then be prompted to enter your display name.
Logout Read more
Half-Life 3 copium goes into overdrive as fans convince themselves Valve's Steam Machine announcement is hinting at a reveal: "I don’t want to get anyone's hopes up"
Baldur's Gate 3 publishing lead says Valve defeated Meta and Apple in VR by building "incredible spaces for actual geniuses" instead of worrying about non-existent shareholders
Discovering new Super Mario Bros levels that have "secretly been accessible" for over 30 years, "legendary Mario scientists" find themselves in a psychedelic cyberpunk hellscape hiding on their childhood SNES cartridges
Some of Skyrim's iconic bugs are "less than ideal," ex-Bethesda dev admits, but "you're going to lose some of that magic" if you try and "smooth everything out"
25 Best sci-fi games to travel into the future with
Dev says Steam bug ruined "more than 10 years" of work and tanked their game's 1.0 launch, Valve says oops and offers a Daily Deal slot "to help make up for lost visibility"
Latest in FPS Games
Best Black Ops 7 M15 Mod 0 build and loadout
As Borderlands 4 developer Gearbox decides to make the looter shooter's first DLC pack free for everyone, Deluxe Edition players aren't too happy: "I'm calling bulls**t"
The run-up to Marathon's release has been such a train wreck that it's easy to forget that the game might still be really good
PUBG: Black Budget is cashing in on the Arc Raiders and Escape from Tarkov extraction shooter hype, this time with a battle royale-style shrinking map
How to find the Fracture door code in Black Ops 7
Best Black Ops 7 assault rifle for your loadouts
Latest in News
Ex Valve designer reveals the door and big toe that retroactively broke Half-Life 2: "This isn't a normal bug - it appears to have traveled backwards in time and infected the original!"
One of the rarest Superman comics in existence just sold for over $9 million at auction, making it the most valuable comic of all time
Silksong is shockingly cheap at just $20, but Team Cherry says it just tries to "price the games at a reasonable level for people," man
Hytale is priced so "aggressively low" that its returning owner is "taking on a considerable personal risk," but "charging more didn't feel right" because "I don't think the game is good yet"
Minecraft player redefines sadness with the world's worst challenge, living in an inhospitable wasteland with only one Bonus Chest of items: "I think we can work with this"
After 4 years, Genshin Impact and Honkai: Star Rail dev's mystery game seemingly revealed to be the open-world game Varsapura, in a trailer that screams Control so loud I'd bet Remedy heard it in Finland
GAME REVIEWSMOVIE REVIEWSTV REVIEWS
1Constance review: "If Hollow Knight: Silksong seems too daunting, this wonderful paint powered adventure should do nicely"- 2This enthralling team board game is perfect for playing with family this Thanksgiving
- 3Kirby Air Riders review: "This racer is also equal parts fighting game, minigame collection, and roguelike – and I'm shocked at how well that works"
- 4Demonschool review: "This Persona-inspired RPG is full of fun, flair, and ready to chomp away at your free time"
- 5Morsels review: "The Binding of Isaac style roguelike shooting gets somehow grosser, but struggles to set itself apart"
1Wicked: For Good review: "Builds to an incredibly cathartic conclusion, but isn't quite as captivating as Part 1"- 2The Running Man review: "Some fun action and Glen Powell's star power aren't enough to energize this disappointing Stephen King adaptation"
- 3Predator: Badlands review: "Die-hard fans may be disappointed, but as a blockbuster action-adventure, Badlands kills it"
- 4Chainsaw Man – The Movie: Reze Arc review "Storytelling just as compelling as the chainsaws, devils, and visually excessive fight scenes"
- 5Tron: Ares review: "Misses out by swapping the Grid for the real world"
1Pluribus season 1 review: "Easily one of the year's best dramas"- 2The Witcher season 4 review: "The Henry Cavill-less fourth season is the best yet"
- 3IT: Welcome to Derry review: "A supremely confident step back into the history of Stephen King's cursed town and killer clown"
- 4Splinter Cell: Deathwatch review: "A pale imitation of the long-dormant stealth franchise"
- 5Marvel Zombies review: "A fun expansion of the What If episode with delightful MCU Easter eggs and truly gross R-rated kills"