Live data from Hacker News

Many games are held together by duct tape

polygon.com

131–140 of 155 posts

Re: Many games are held together by duct tape

#131
post #71

Earlier quoted context omitted.

During the Hotline: Miami run this year the runner mentioned that on certain GPUs the game would crash unavoidably after 25 minutes due to a memory leak, and that if you wanted to increase the FPS you could plug in more mice. None of that precluded it from being a great game, though. https://youtu.be/aPnobTZfnfU

> and that if you wanted to increase the FPS you could plug in more mice I am having trouble imagining what sort of event handling bs this might be taking advantage of... I am too vanilla a coder at this point in my life.

Rendering is likely blocked on mouse interrupts.

Re: Many games are held together by duct tape

#132

Watching speed runners play through games is a great way to visualise not only this aspect (that games are flimsy at best), but to visualise the same practice in any software - if you don't code defensively, often a simple mis-input breaks the game. A common pattern in many speed runs is finding some glitch through a door, and then the game logic kicks in and says "you are past this door, so you must have got the key…

For anyone interested in speed runs, you should check out Games Done Quick - https://gamesdonequick.com/ . And it's all done for a great cause too. I recently watched the fallout anthology run and some of the things the speed run community have discovered are amazing.

One of the best GDQ runs I've ever seen was one of the FFVII speed runs. This is a game that normally takes like 50 hours to complete start to finish. The RNG of the game is able to be manipulated by keeping the number of steps taken by the player absolutely perfect. This is a "speed run" that they play without any kind of tools or cheats for hours and the entire time they're keeping the exact number of steps taken through different levels on perfect track to be able to beat the game without spending dozens of hours training their characters.

Re: Many games are held together by duct tape

#133

Earlier quoted context omitted.

This can get super heated. There was a controversial "glitchless" run of Mirror's Edge at GDQ a few years back... Sometimes people make a "no major glitches" or "no OOB" category, where specific glitches are disallowed, but others are allowed.

If we're thinking of the same Mirror's Edge run, that was meant to be a joke and to bring to light the ridiculousness of a "glitchless" run as a lot of things can be interpreted as a glitch or not.

Interesting! Thanks for this; this happened just as I was getting into speed running, and I, like many others apparently, didn’t realize that, but I did some googling over lunch and it appears this was the case! Thank you for the extra context.

Re: Many games are held together by duct tape

#135
post #109
post #67

Ex-Game dev here: shipped many titles on console (AAA and some zzz titles). When comes time to shipping a game, the crunches, pressure and overall stress is through the roof. Most everything goes at that point: duct tape, hot glue, bobby pins and toad spit. And if you disagree with management over these 'not so best practices' (in order to ship faster...) they will find someone to do it and you could be out of a job.…

What do you do now? I like clean code, but also understand the need of producing results. I get pleasure from creating clean, readable, commented and maintainable code. However, I understand my boss mostly doesn't care, he just wants a working product that can improve the efficiency of our business. Example: Product which ran part of our business for the last 15 years, is the worst code I have seen in my entire life.…

My favorite insight on clean code is that the metaphor of "technical debt" is incredibly deep. It's not just "we skipped X hours of cleanup" - you can meaningfully discuss the purpose and size of the loan, interest rate, payment plan, and more.

From that viewpoint, there are basically three happy cases for paying tech debt. You can treat it like a paid-off credit card, releasing code today and then paying off the principal tomorrow before you incur any interest. You can use it like a home loan, accepting that you can afford long-term interest more easily than committing all the time upfront. Or you can use it almost literally as a business loan, releasing something ugly which makes the money you'll need for services/salaries/etc to pay off the debt.

In practice, most companies accrue tech debt like credit card debt or back taxes. Either they pay a fortune in interest (i.e. maintenance, dev ramp-up time, and slowed development) so they can't afford to work down the principal, or they ignore the entire problem until it grows way more expensive.

The upside is that there's not much longterm cost to declare tech bankruptcy. If something can limp along until it's replaced, all the work you've been putting off can be skipped completely. Hence the godawful state of videogame code: people aren't necessarily worse about hacking things together, but they're usually coding with a clear ship date in mind, so they don't worry so much about feature requests, training new devs, or anything else long-term.

(Sometimes this blows up, like when a studio wants to make a sequel to a hit game and discovers everything they've built is unusable. And post-release patching has raised the lifespan of game code a lot from the days when you pressed a master CD and walked away. But all of that is speculative: if you don't ship, or don't sell well, the code is dead anyway.)

Re: Many games are held together by duct tape

#136
post #95

Earlier quoted context omitted.

> and that if you wanted to increase the FPS you could plug in more mice I am having trouble imagining what sort of event handling bs this might be taking advantage of... I am too vanilla a coder at this point in my life.

I'm not a game dev, but rough guess: the framerate is artificially limited to some 'sane' range by the equivalent of a short sleep() which is cancelled by an input event. More devices, more events, more chance to prompt the next frame early?

Yep, almost certainly what's happening.

It's very common to constrain your central "game loop" for several reasons. A game like Hotline presumably has some basic loop like "process inputs, process events, update AI plans, process AI actions, redraw screen". When the logical tasks are easy (e.g. most of the AIs are dead and you're standing still), that's essentially just a busy-wait that redraws your screen as fast as it can. Constantly maxing system resources is obnoxious, and it can be jarring when things slow back down. 40FPS might look just fine, but you can still 'feel' the change when you ramp up and down from 60FPS, so it's nicer to just cap the whole thing at 40FPS. Mouse inputs probably don't adjust the cap itself, but to avoid laggy responses they're usually interrupts which might refresh the screen.

A fun aside: some games fill out the time until the next redraw with more "thinking time" instead of sleep(), which leads to bizarre behaviors like an AI that gets smarter when you turn down the graphics settings.

Re: Many games are held together by duct tape

#137

Earlier quoted context omitted.

Mind you both reused many ideas from previous ones. Doom reused Wolfenstein 3D, Quake reused pieces from Doom. (WAD format for example.) The engines made for the games were indeed intended to be one offs. Reuse of design and formats does not imply reuse of code. This is very different from new "universal" engines like Unity, Unreal Engine, Ogre, Frostbite, Dawn Engine or Unigine. Those were designed to be separate fr…

True; I guess ID had this internal engine strategy or it grew out of the culture there naturally? I read the Doom book but don’t remember if that was explained. I have the Doom black book but did not read it yet.

I'd suggest Michael Abrash's Black Book which I recently read. He wrote it while working for ID and there's lots of little bits of gold in there. The PDF is free online. Note, it's very big.

Re: Many games are held together by duct tape

#138
post #59
post #12

I run a small MMORPG and I'm considering open-sourcing the whole thing but the code is a complete mess. The source code of VVVVVV is a work of art in comparison. What holds me back are 1. I'm ashamed to reveal the monstrosity 2. I'm afraid the code is too messy for anyone to be able to make contributions 3. it will make it much easier for hackers to find exploits. It's a shame because I think the game would be really…

Messy code that produces a valuable product is better than beautiful code that does nothing.

True. It's a balance that we as developers must always seek; Some people say that premature optimization is evil. Premature code refactoring can be just as damaging.

Re: Many games are held together by duct tape

#139
It's interesting to see how duct taping a game inside out can result in absolute success once you ship something valuable. It can be really thrilling and you can get away with it specially if you're working alone, which for me is the best work. It's another story entirely if you're on a team, coding together a product that must be maintained and improved for years. I work on both sides, and I can say that I only have real fun when I'm coding alone. Though learning to work in team is a great skill as well. I'm specially careful with code architecture and readability, but sometimes when you're on the flow, the zone, the code just flows as well;

Re: Many games are held together by duct tape

#140
post #137

Earlier quoted context omitted.

True; I guess ID had this internal engine strategy or it grew out of the culture there naturally? I read the Doom book but don’t remember if that was explained. I have the Doom black book but did not read it yet.

I'd suggest Michael Abrash's Black Book which I recently read. He wrote it while working for ID and there's lots of little bits of gold in there. The PDF is free online. Note, it's very big.

I did read that too long ago; will reread: thanks!
Post reply on HN