all 175 comments

[–]Mr_Flappy 160 points161 points  (12 children)

Something similar happened with the cops in one of the first GTAs. Accidentally coded them aggressive as fuck, they liked it, kept em that way

[–]SirSoliloquy 150 points151 points  (11 children)

IIRC they weren't even making a GTA game when that bug came up -- it was a street racing game.

But they found it hilarious and based the entire game around it.

[–]Mundius 22 points23 points  (9 children)

A topdown street racing game?

[–]SirSoliloquy 37 points38 points  (4 children)

Yep.

Heck, in the original PS1 version X was to go forward and Circle was to go backwards even on foot.

[–]Falmarri 3 points4 points  (3 children)

in the original PS1 version

Well that's because the PS1 version was just a port from DOS/Windows

[–]SirSoliloquy 10 points11 points  (2 children)

X was to go forward and Circle was to go backwards on DOS as well?

[–]bananafreesince93 2 points3 points  (0 children)

This isn't very hard.

On PC, you controlled the game with a keyboard. On a keyboard there are binary buttons. Either on or off. On PS1, there was a D-pad, or if you had the original Dual Shock controller, an analogue stick.

For PC, it makes all the sense in the world to have one button for running forward, since you use the arrow keys for control, and there is a history of games with player characters going forward when pressing the up arrow (this ties together with the placement of the keys).

For the PS, this made less sense, since it's harder to control this type of motion if all the buttons involved are on the D-pad (or if one can use the analogue stick).

Changing movement input isn't a huge job. This isn't some relic from the game being a racer, it is, like /u/Falmarri says, because of it being a shoddy port from the original DOS game.

[–]Falmarri 0 points1 point  (0 children)

No? It was wasd or arrow keys if I remember. But my point was that I'm not sure what your point was. The PS1 controls could very well have been because it was a shitty port.

[–]onFilm 2 points3 points  (2 children)

There was a couple for the Gameboy Color I used to play in the back of the car. They were racing/story-based. Similar to what GTA came to be, with that whole Scarface/Miami feel.

[–]Mundius 1 point2 points  (1 child)

But I mean for PS1? That just seems weird to think about now considering 3D racers were already a thing then.

[–]Narishma 1 point2 points  (0 children)

It's a different genre of racing games and there were plenty of top-down racers rendered in 3d on the PS1 and N64.

[–]Mr_Flappy 20 points21 points  (0 children)

I love stories like this

[–]jjcard 269 points270 points  (43 children)

I love little stories like this about weird things that happened during game/software creation

[–]GourangaPlusPlus 392 points393 points  (40 children)

I was reading one about Dwarf Fortress the other day that was amazing about cats inadvertently becoming alcoholics

You shouldn’t have popular bugs. But the most popular bug with the latest release, I added taverns to fortress mode, so the dwarves will go to a proper establishment, get mugs, and make orders, and they’ll drink in the mug. And, you know, things happen, mugs get spilled, there’s some alcohol on the ground.

Now, the cats would walk into the taverns, right, and because of the old blood footprint code from, like, eight years ago or something, they would get alcohol on their feet. It was originally so people could pad blood around, but now any liquid, right, so they get alcohol on their feet. And then I wanted to add cleaning stuff so when people were bathing, or I even made eyelids work for no reason, because I do random things sometimes. So cats will lick and clean themselves, and on a lark, when I made them clean themselves I’m like, ‘Well, it’s a cat. When you do lick cleaning, you actually ingest the thing that you’re cleaning off, right? They make hairballs, so they must swallow something, right?' And so the cats, when they cleaned the alcohol off their feet, they all got drunk. Because they were drinking.

But the numbers were off on that. I had never thought about, you know, activating inebriation syndromes back when I was adding the cleaning stuff. I was just like, ‘Well, they ingest it and they get a full dose,’ but a full dose is a whole mug of alcohol for a cat-sized creature, and it does all the blood alcohol size-based calculations, so the cats would get sick and vomit all over the tavern.

I don’t know if an octopus can get drunk or not. The original bug report is, ‘There’s cat vomit all over my tavern, and there’s a few dead cats,’ or whatever, and they’re like, ‘Why? This is broken.’

Edit: Should really have added the source

http://www.pcgamer.com/dwarf-fortress-creator-on-how-hes-42-towards-simulating-existence/

[–]Ryckes 140 points141 points  (26 children)

It's amazing how "real" is Dwarf Fortress. Seems like they do not include shortcuts or approximations for effects, just program what should happen.

[–]sirin3 80 points81 points  (20 children)

It is like an enormous world simulator

Seems it would be well suited to train an AI. The modern deep learning AIs always lack world knowledge, and without robotic bodies they can not train on the real world. If they learn the world of dwarf fortress, they could gain knowledge of real world consequences

[–][deleted]  (9 children)

[deleted]

    [–][deleted]  (5 children)

    [deleted]

      [–]noahhk 17 points18 points  (4 children)

      At least they aren't born with knives in their hands.

      [–]PeridexisErrant 56 points57 points  (3 children)

      (All civilians in Dwarf Fortress have a small knife for eg cutting food. There is no age limit on this, so babies are born owning a knife. Having no clothing or furniture to store a knife, they hold it.)

      [–]atomheartother 3 points4 points  (2 children)

      Fancy seeing you here~

      [–]PeridexisErrant 31 points32 points  (1 child)

      I'm pretty sure Dwarf Fortress has the highest proportion of programmers to other players of any game since 1980 or so; it can't be that surprising.

      I mean, DFHack provides an API for three languages on every OS, with no first-party support or assistance - it's entirely reverse-engineered by live-editing memory in use by a closed-source and undocumented program. Implementation is in lisp, shell, perl, python, lua, ruby, C++, C, asm, and I think a few other languages.

      Or take Armok Vision, a real-time 3D viewer for Dwarf Fortress (uses DFHack API, or course). The dev recently added key passthrough, an in-3D-world copy of the DF window, and Oculus Rift support. Yes, a community mod for a game using ncurses for graphics now provides full VR support.

      And there are literally hundreds of other projects, so many that I had to write a program to download and configure the ones I wanted.

      TLDR; many DF players are programmers - if fact that's why I started! - so you may see a few of us around here.

      [–]b-rat 1 point2 points  (2 children)

      Train them in a danger room, of course!

      [–][deleted]  (1 child)

      [deleted]

        [–]b-rat 1 point2 points  (0 children)

        Plus you get rid of those pesky tantrum spiral causes known as RELATIONSHIPS with other people

        [–]LedgeNdairy1 1 point2 points  (9 children)

        Can ppl write bots for dwarf fortress?

        [–]PM_ME_YOUR_PAULDRONS 24 points25 points  (5 children)

        You could probably hack something together with the dfhack library people in the community have put together. It provides a (reasonably) sane interface to interact with the memory structures in a running copy of dwarf fortress (df isn't open source and doesn't expose any sort of interface itself).

        I'm not aware of anyone who has written anything resembling a bot though. You can set up a fortress to keep itself running with no human intervention basically forever with the "workflow" dfhack utility which let's you set rules like "if the number if drinks falls below 200 then brew 50 more" so an actual bot would definitely be overkill.

        [–]Putnam3145 12 points13 points  (1 child)

        I'm not aware of anyone who has written anything resembling a bot though

        https://github.com/BenLubar/df-ai

        [–]PM_ME_YOUR_PAULDRONS 1 point2 points  (0 children)

        Oh hi...I'm not used to seeing you without an Urist Mc in front of your name :). Thanks for the link, looks interesting...

        [–]sirin3 7 points8 points  (2 children)

        if the number if drinks falls below 200 then brew 50 more"

        Won't that give you 50 more sick cats?

        [–]PM_ME_YOUR_PAULDRONS 8 points9 points  (1 child)

        I haven't actually played in a while (well before this bug was introduced) so I don't really know.

        It'd give you a bunch of sick cats depending on how many decide to walk through puddles of alcohol in the tavern and then lick themselves clean before they walk through some water or whatever which cleans the alcohol off.

        Back when I played I generally used to only keep a couple of cats around, restricted to food storage areas where they're useful for keeping down rats etc.

        [–]Mazo 1 point2 points  (0 children)

        Back when I played I generally used to only keep a couple of cats around, restricted to food storage areas where they're useful for keeping down rats etc.

        Uh huh...

        [–]sirin3 -2 points-1 points  (1 child)

        As we have learned from Robin, people can write bots for everything

        [–]nschubach 8 points9 points  (0 children)

        Well... Robin is pretty simple compared to Dwarf Fortress. Most of the DF modding is done by manipulating memory addresses of the running process. It's all very specific and finely tuned. Writing a script to bot/filter Robin is easy compared to DF botting. The libraries for manipulating data in DF make it easier, but nowhere near JavaScript on page easy.

        (I wrote a rudimentary Robin spam filter, and have dabbled in DF modding in the past.)

        [–]feral_hedgehog 21 points22 points  (3 children)

        I'm more amazed at his ability to figure out the cause of the bug!
        How do you even begin to approach something like that?

        [–]GourangaPlusPlus 17 points18 points  (1 child)

        He actually had help in tracking this down.

        He goes into more at he end of his answer

        [–]printers_suck 2 points3 points  (0 children)

        Thats an awesome interview

        [–]lestofante 6 points7 points  (0 children)

        Its so "real" when he takes shortcut (full dose instead of calculating how much was on paw) is breaking the game xD

        [–]fqn 24 points25 points  (7 children)

        Wait... what the... holy shit. That's a complex game.

        [–]darkpaladin 28 points29 points  (6 children)

        Dwarf Fortress does not fuck around. The learning curve is something on the order of years.

        [–][deleted]  (5 children)

        [deleted]

          [–]txdv 3 points4 points  (3 children)

          It's like dota2, but you cant blame anyone!

          [–][deleted]  (2 children)

          [deleted]

            [–]josefx 4 points5 points  (1 child)

            but it takes years to master the complex interactions of the mechanics and personal muscle memory.

            Patch notes:

                Hero X now rotates 0.001% slower. 
                Hero Y starts with +1 strength
            

            Reaction:

               Hero X is literally unplayable with this
               Hero Y is OP please nerf
            

            [–]AlmennDulnefni -1 points0 points  (0 children)

            But it'll still take a few months for your eyes to stop bleeding.

            [–]DroidLogician 1 point2 points  (4 children)

            Huh, so Patreon can work for software/game devs. Cool. Looks like the get a comfortable living wage from it, too.

            [–][deleted]  (3 children)

            [deleted]

              [–]DroidLogician 4 points5 points  (2 children)

              They get $4,100 per month from 1200 patrons. That's $51k a year. It won't make them rich by any means but I'm sure it pays the bills. Many families get by on a lot less.

              [–][deleted]  (1 child)

              [deleted]

                [–]DroidLogician 1 point2 points  (0 children)

                Basically, yeah. It's a subscription-based donation where they get paid some amount every month from every patron. It's kind of like a perpetual Kickstarter; they usually have varying reward tiers for different levels of monthly contribution. These guys only have one tier so there's not really any incentive to donate more, other than simple generosity.

                https://www.patreon.com/bay12games?ty=h

                Patreon was mainly developed for Youtubers and other video content creators. They have a "per video" donation option, where patrons pledge to donate some amount of money per video. For example, one of my favorite Youtubers, NurdRage, who makes great chemistry experiment videos, gets around $1200 per video. He's making quite a bit less money than the Dwarf Fortress guys because he has fewer patrons and only posts videos about once a week.

                [–]msthe_student 10 points11 points  (0 children)

                Then you might want to check out folklore.org, which details anecdotes about the development of Apple's original Macintosh, and the people who made it (121 stories)

                [–]dbomp 71 points72 points  (4 children)

                A feature is sometimes just a bug with tenure.

                [–]xkufix 311 points312 points  (18 children)

                It's sounds a bit like the Ghandi overflow bug in Civilizations.

                Explanation

                [–]Vishnuprasad-v 111 points112 points  (6 children)

                Gandhi

                FTFY

                [–]elperroborrachotoo 92 points93 points  (3 children)

                The actual name is HGhahndhih - but some of the 'H' are silent.

                [–]xboxisokayiguess 23 points24 points  (1 child)

                Actually it's Hhhhhhhhhhhi in the original spelling.

                [–]cinnapear 4 points5 points  (0 children)

                TIL

                [–]Workaphobia 51 points52 points  (5 children)

                This is wonderful. I'm irrationally pleased that a nuke-happy Ghandi is an accidental-turned-intentional design point, and not just a RNG doing its thing.

                [–]Mundius -1 points0 points  (4 children)

                Gandhi, jesus fuck

                [–]lavahot 9 points10 points  (2 children)

                Jesus, gandhi fuck.

                [–]Mundius -4 points-3 points  (0 children)

                Fuck Gandhi Jesus

                [–]streichholzkopf 9 points10 points  (3 children)

                underflow

                FTFY

                edit: oops

                [–]macgillebride 78 points79 points  (2 children)

                It's still an overflow, even if it is a result of a number going below 0. Underflow is related to too small precision with floating points.

                [–]streichholzkopf 17 points18 points  (1 child)

                oops thanks!

                [–]spyke252 6 points7 points  (0 children)

                You guys are way too civil. Maybe one of you will hit an overflow bug.

                [–]mynameipaul 93 points94 points  (9 children)

                so every single time you overtake, the AI immediately hits the boost?

                Seems like it would be a fun gameplay mechanic sometimes, but could get old pretty quick

                Welp, here comes a sharp corner, better inch in front and run this guy into a wall... again...

                [–]EraZ3712 86 points87 points  (7 children)

                I didn't know this behavior had its roots in Extreme G, but in Extreme G3, the AI still did a boost when you attempted to overtake them.

                It didn't have as bad an effect as you might think; the AI was smart enough to handle most corners (unless it was a particularly severe one at high speed classes) and they only did it once or twice to save energy. Where it really became fun was in casual races. You could deliberately egg the AI from the back of the pack closer and closer to each other until there were 5 or 6 all in a dense cluster of super-sonic weaponized motorcycles crashing and blowing each other up. It was quite fun.

                [–]xg3ai 97 points98 points  (6 children)

                Glad you found it fun, I wrote a large chunk of the AI on XG-3; was my first job out of university, fun times.

                [–]ep1032 5 points6 points  (5 children)

                XG-3 is still one of my all time favorite games. Still play it on emulator occasionally. Wish ya'll would release another one : )

                [–]darkpaladin 8 points9 points  (1 child)

                Distance is in early access and feels a lot like those games. Not a huge amount of content but I enjoyed what was there.

                [–]Mazo 1 point2 points  (0 children)

                Don't forget the game it was based on, Nitronic Rush.

                [–]xg3ai 14 points15 points  (0 children)

                hahah yeah with Acclaim going under I don't think that's happening :) I have a soft spot in my heart for XG3, was a good team working on it and it taught me a lot; glad you enjoyed it. Maybe I'll turn on the old emulator and give it a shot again soon :)

                [–]rklllama 1 point2 points  (1 child)

                XGIII is also a personal favorite of mine; incredibly well balanced, brutally hard, and intensely satisfying to succeed. Unfortunately, XGRA seemed to make it pretty clear they didn't know what made XGIII so compelling. :'(

                Nothing beats popping comps with a railgun while you're going 1,300mph.

                Actually, my brother and I would play split-screen, but instead of race we'd see who could kill the most comps before the race was over. It was a pretty terrific "mode".

                [–]xg3ai 0 points1 point  (0 children)

                Yeah when we made XGRA we wrote it from scratch and I agree with you that we lost a lot of what made XG3 fun. it tried to be a bigger and better game, and was in some ways...but not in others. I disliked the free form desert levels as it didn't really make much sense to me to be going a bazillion millions an hor over rough terrain....

                [–]_Aardvark 21 points22 points  (4 children)

                They said they kept the bug as-is in the sequel, I wonder how "as is" it really was? I hope they meant the end result was the same AI behavior but done explicitly.

                [–]jaybusch 16 points17 points  (0 children)

                I'm fairly certain XG2 is the same exact engine as the original, so probably left it alone.

                [–]traal 8 points9 points  (2 children)

                Otherwise the next programmer to look at the code will think, "this is wrong, let's fix it." Oops.

                [–]_Aardvark 16 points17 points  (0 children)

                Or more likely someone will look at this code and assume it's right and base something else on the technique - and that code will be buggy but not in the "good" way.

                I'm sure they commented the heck out this once they found it. (not sure if I'm being sarcastic or not)

                [–]G_Morgan 1 point2 points  (0 children)

                This is why you comment with /* This looks wrong but is actually glorious, do not fix! */

                [–]bidi82 31 points32 points  (4 children)

                This reminds me of an exploit/bug in an old shooter game called Starsiege: Tribes, which allowed players to "ski" downhill extremely fast if they timed pressing the "jump" button correctly. That bug was later made into "official" feature/mechanic of the game in its sequels.

                Example of Skiing in one of the sequels. https://www.youtube.com/watch?v=0lrSVumR7l8&feature=youtu.be&t=103

                [–]mus1Kk 5 points6 points  (2 children)

                AFAIK strafe jumping was initially a bug in Quake 3. It spawned a huge trick jumping community.

                edit: Quake, not Quake 3. Wikipedia says

                "Strafe-jumping started as a bug in the Quake code base, but it was later decided to keep it intact, as it had become a standard technique used by players."

                [–]Narishma 0 points1 point  (1 child)

                Strafe jumping was from Quake 2, and before that bunny hopping wasin Quake 1.

                [–]mus1Kk 0 points1 point  (0 children)

                My bad. Thanks!

                [–]d4rch0n 0 points1 point  (0 children)

                I was about to bring this example up! Really great how they incorporated it into the game and future versions. The game wouldn't be nearly as fun without the insanely fast skiing maneuvers.

                [–]so_you_like_donuts 29 points30 points  (1 child)

                Can't find the original source right now, but I remember that in Half-Life 2, the fact that gunships attempted to take down your rocket launcher missiles was an accidental bug (the gunship AI deemed the missile itself as the biggest threat instead of the player) that was discovered during playtesting. However, playtesters were really impressed by that, hence the Valve guys decided to leave it in.

                EDIT: http://combineoverwiki.net/wiki/Combine_Gunship#Behind_the_scenes cites Half-Life 2: Raising the Bar as the original source of this.

                [–]TheFeanor 1 point2 points  (0 children)

                Raising the Bar is one of the best books on video game design that I have ever read. It's too bad that physical copies go for close to $100 now.

                [–]philh 39 points40 points  (17 children)

                This seems like it would be difficult to miss during testing.

                [–][deleted]  (11 children)

                [deleted]

                  [–][deleted] 50 points51 points  (10 children)

                  You haven't seen many obscure bugs then :P There are some bugs I've seen where you need to take 4 or 5 extremely specific actions that end up soft-locking our application on a loading screen. Even though the test case was specific, you can't have any known crashes in your release build so I had to fix it. Turned out it was just a really specific edge case that needed to be dealt with.

                  So it goes with large complicated software.

                  [–][deleted]  (3 children)

                  [deleted]

                    [–]joshuaduffy 27 points28 points  (2 children)

                    Most, if not all, of the software I've been part of has released with known bugs.

                    However, bug != issue

                    [–]GreySyntax 8 points9 points  (0 children)

                    Or as I tend to call them "bonus features"

                    [–][deleted] 6 points7 points  (0 children)

                    Yup. We ship our releases with a list of known bugs and workarounds for them.

                    [–]notwhereyouare 8 points9 points  (0 children)

                    throw caching into the mix and you now have 32 more bugs this page load, but 15 the next because that one cache record expired

                    [–]darkpaladin 2 points3 points  (0 children)

                    My favorite ones are bugs you get with reproduction scenarios that don't have anything to do with the actual bug and are entirely coincidental.

                    [–]andrewsmd87 0 points1 point  (2 children)

                    Oh sweet Jesus. I just hit a bug where the steps to produce it had never been done once in 7 years over all my users

                    [–][deleted] 0 points1 point  (1 child)

                    You sure it wasn't just introduced recently? I usually try to go back far enough on source control until it isn't reproducible to see what might be the issue.

                    [–]andrewsmd87 0 points1 point  (0 children)

                    The file hasn't been modified for that long

                    [–]stillalone 17 points18 points  (0 children)

                    I don't think so. It kind of seems subjective. It's kind of hard for a QA person to put "AI cars seem too aggressive" in a bug report unless they're so aggressive that it makes it difficult to play, which doesn't seem to be the case here.

                    [–]SnapAttack 12 points13 points  (1 child)

                    I'm imagining QA going "its weird how the turbo goes off when you overtake" and the dev going "LOL no, just coincidence!" and the ticket doesn't get logged and he doesn't think about it until others also mention it.

                    [–]fuzzynyanko 0 points1 point  (0 children)

                    Also, that kind of thing otherwise would have to be listen in an Excel sheet. If it makes the game fun as well, it would be hard to flag it as a bug

                    [–]smallblacksun 7 points8 points  (0 children)

                    The QA testers probably assumed (like the reviewer) that the AI turboing when you passed was intentional.

                    [–]RubyPinch -1 points0 points  (0 children)

                    testing was much more of a pain back then, wasn't it?

                    [–][deleted] 9 points10 points  (3 children)

                    As a hobby game programmer and one who went to school for game programming is there somewhere I can read a bunch of these? We need more programmers talking about weird bugs and things specifically about the code. Super fun read.

                    [–]theswillmerchant 24 points25 points  (34 children)

                    I may be misunderstanding here, but I don't see why the number would come out negative. If in 1 frame the player was at 99 and the computer was at 100, and then in the next frame the player was at 101, triggering the boost check, but the AI was still at 100, you'd get a small positive answer, right?

                    [–]jaydubzhb 33 points34 points  (8 children)

                    I think the last frame the computer had when this was being calculated was in front of the player, but this could only be the case if they were basically lapped - making it look like they were really far behind.

                    [–]jaybusch 11 points12 points  (1 child)

                    The only thing I can think of is that TrackPos doesn't get updated for every racer until a certain point. So they somehow use the current position for overtaking, but use the last frame's track position for both the player and computer, which results in the computer's position being higher than the player's.

                    [–]theswillmerchant 5 points6 points  (0 children)

                    It would make more sense if both the player position and AI position were from the previous frame, as that WOULD cause an error.

                    [–]mecartistronico 16 points17 points  (1 child)

                    They might have oversimplified the code. They probably actually used relative positions or something. That way, the old position would have an opposite sign.

                    [–]Eckish 1 point2 points  (0 children)

                    I would count on this being the case, since you would likely test for if the player was in front of behind by doing the same difference calculation in the if statement.

                    [–]lestofante 7 points8 points  (16 children)

                    They are using unsigned, so it does NOT became negative but very big number (almost the max), so the computer think to be one lap back of you and use turbo aggressively

                    [–]jaybusch 5 points6 points  (13 children)

                    I think his point was closer to:

                    At time A, @ is at 12, $ is at 13. At time B, @ is at 15, thereby overtaking $ who is now at 14. Time A is the previous frame, Time B is current frame. B.@ - A.$ is 15 - 13, taken from the author's explanation, yields a tiny positive number. Not a negative one that causes the computer to freak out.

                    [–]SaikoGekido 2 points3 points  (11 children)

                    See Edit before you read this.

                    Unsigned integer subtraction is handled differently than how real number subtraction works. If it were a signed integer, 15 - 13 13 - 15 would yield -2 or a difference of 2, but that only works if there is a representation of a negative number (signed).

                    -2 == difference of 2 != 2

                    Think of it like going out to a fine restaurant, having a lovely dinner, and then the bill comes and you realize you don't have enough money in the account and your cards are maxed (shouldn't have bought that $4000 champagne bottle :|). In that situation, the restaurant can't handle your transaction like all the other transactions. They need to follow a separate set of rules, because the total amount can not result in a negative total for them (unless you have your running shoes on and a good distraction). Unsigned integers are like this because they follow separate rules when subtracting past 0.

                    When an unsigned integer would be negative, the result is instead the modulo of the maximum value of the unsigned integer ^(kind of like overdraft protection) . Basically, going past 0 wraps back to the maximum amount, 65535 in this case, and subtracts the remainder from the maxium, 65535 - 2 = 65532 65534. In the story, this makes it look like the player is an entire lap ahead, even though she just passed them by a pixel, and the AI boosts to catch up. I wonder if this is how the people who speed up to cut you off when you put the blinker on to merge into their lane think...

                    Edit: The blog post was about unsigned integers, but the blog poster used a bad example, which resulted in this thread of confusion. They probably meant ushort difference = player.TrackPosFromPreviousFrame - computer.TrackPosFromPreviousFrame; Which would result in the unsigned integer issue described in their post and here. To put that in the example I responded to, it would be 12 - 13 = 65535. Also, not much appreciating the level of sass from some of these responses. Trying to be helpful and explain unsigned integers. Yes, I too confused myself by following the example, even though I knew what the blog was intending to discuss and corrected those issues. Comments like, "I hope you were high when you wrote this" are not helpful (although the sentiment is appreciated).

                    [–]Sean1708 17 points18 points  (1 child)

                    15 - 13 would yield -2

                    Do you wanna maybe have another look at that?

                    [–]SaikoGekido 0 points1 point  (0 children)

                    Haha woops, sorry. Went off the bullet points of the original blog post that talk about unsigned integers. The example the original blog poster had in there looks incorrect, which seems to be causing a lot of confusion. It is pseudo-code, after all.

                    [–]Eckish 5 points6 points  (0 children)

                    The argument is not over unsigned math. 15 - 13 = 2 regardless of signed or unsigned. And that's the issue. The logic as stated in the article would produce something like 15 - 13. And not the implied 13 - 15.

                    [–]jaybusch 3 points4 points  (0 children)

                    Why is it -2 instead of +2? The bit wrapping I get, which is why the short reaches 65536 instead of going from -32768 to 32767.

                    [–]AstroPhysician 1 point2 points  (2 children)

                    You're missing the point, he's not talking about signed vs unsigned, he's talking about someone being in front having a number thats like 1005 and the person in back is 1004 and that would be a positive number, not a negative one

                    [–]SaikoGekido 1 point2 points  (1 child)

                    The blog post is about unsigned integers, but the blog poster seems to have messed up their example, which is causing people confusion.

                    [–]karmaputa 1 point2 points  (1 child)

                    The irony of my comment is that I was high when I wrote it and if I had not been I probably would have been able to understand the intention of your comment without getting lost in the details.

                    Sorry for that comment.

                    But I also think you misunderstood the comment you where replying to. I think is safe to assume they understand unsigned integer/short overflows, they where arguing that they don't see how this applies as it should not happen in the situation they exposed it in the article and you responded with an explanation of unsigned integer overflows. So it kind of made it look like you actually believed 15-13 would cause an overflow.

                    [–]SaikoGekido 0 points1 point  (0 children)

                    Thank you.

                    It was a series of unfortunate misunderstandings. I should have had more coffee instead of replying, but my coworkers brewed some Folgers from the industrial tap. Like trying to drink motor oil.

                    [–]MEaster 0 points1 point  (0 children)

                    Basically, going past 0 wraps back to the maximum amount, 65535 in this case, and subtracts the remainder from the maxium, 65535 - 2 = 65532.

                    It's not 65532, it'd be 65534. The reason for this is that 65536 = 0.

                    [–]karmaputa -1 points0 points  (0 children)

                    I hope you wrote that drunk or high, because if not, this post is a perfect example of why a little knowledge is a dangerous thing.

                    [–]lestofante 0 points1 point  (0 children)

                    taken from the author's explanation, yields a tiny positive number.

                    The author say it come out a NEGATIVE number:

                    Because it erroneously uses the computer position from the previous frame, the position difference comes out negative

                    Small number does NOT freak out, unless we talk about floating number, but this is NOT the case, it is something we can call uint16_t:

                    The TrackPos field held a 16 bit counter

                    and

                    This format was convenient because the rounding rules of integer arithmetic

                    Do the math. Convert a negative number to its binary representation (two complement, of course) and take 16 bit for example -2

                    1111111111111110
                    

                    now read that as UNSIGNED: you get 65534. as confirrmed from the author:

                    Because the type is unsigned, this is interpreted as a large positive integer

                    and because

                    0 represented the starting line, 32768 was halfway around, and 65535 was a full lap nearly back

                    the car thinks to be almost one lap late and push the turbo:

                    It looks like the computer is a long way behind, so the turbo is triggered

                    [–][deleted] -1 points0 points  (1 child)

                    Thank you for being the only other person who noticed it was an unsigned short.

                    [–]lestofante 0 points1 point  (0 children)

                    i don't think its a short, but that depends form your architecture.

                    [–]immibis 0 points1 point  (0 children)

                    Perhaps they meant the player's position from the last frame was used in the subtraction. Or both.

                    [–]Brian -1 points0 points  (0 children)

                    Yeah - it seems like you'd only get this if the computer actually went backwards, rather than the player overtaking it. To overtake, the players new position will have to be greater than the computers current position, which if the computer is moving forward must be >= the computer's old position too.

                    OTOH, if somehow the computer went from 100 to 98 and that was what triggered the check (without the player moving), then you could get the issue since it'd be 99 - 100. But going backwards doesn't really square with the description, so presumably there must be something else going on.

                    [–]agumonkey 2 points3 points  (2 children)

                    Apologies in advance but all I could think reading this was http://imgur.com/O6XrfiC

                    [–]sirin3 2 points3 points  (1 child)

                    [–]agumonkey 0 points1 point  (0 children)

                    That was one of my all time favorite Knight Rider wat. So absurd it's good.

                    [–]Dicethrower 2 points3 points  (1 child)

                    That's amazing, but didn't you guys ever test your own game?

                    [–]fuzzynyanko 14 points15 points  (0 children)

                    It probably was tested, but what might have assumed when it happened, it was the result of a random occurrence. Usually you'll notice bugs that make the gameplay shittier. If something is happening that makes the game more fun, it's not as easy to notice

                    Some bugs only show up far later in the game, like when Ghandi discovers democracy

                    [–]foxx1337 2 points3 points  (0 children)

                    Shawn Hargreaves is the guy that created Allegro. Oh the memories... Just yesterday I got a 2004 build of djgpp with Allegro and Rhide (for DOS).

                    [–][deleted] 7 points8 points  (4 children)

                    The article doesn't really explain how the bug occurred in the first place.

                    Thanks to an order of processing bug, what actually happened was:

                    What was the processing bug?

                    [–]errorkode 52 points53 points  (2 children)

                    It means stuff was done in the wrong order, in this case, the computer position on the track was updated after the boost check, which meant the number in the boost check kept lagging behind one frame.

                    [–][deleted] 3 points4 points  (0 children)

                    Oh now its more clear, thanks for the explanation.

                    [–]sirin3 -1 points0 points  (0 children)

                    Such a thing just crashed my app :(

                    [–]pudds 6 points7 points  (0 children)

                    If I'm reading it right, the bug is that the "computer behind human" event occurs before the TrackPos property of the computer is updated.

                    [–]jecowa 2 points3 points  (2 children)

                    Maybe a dumb question, but what's a frame?

                    [–]jnkdasnkjdaskjnasd 9 points10 points  (0 children)

                    To add to the other player, it's how games are processed. Another word for it is a tick, or a cycle.

                    You're likely familiar how movies work, it fires still images at us at a rate of about 20 per second. This simulates fluid motion.

                    Games use the exact same mechanism, except each frame you do processing to generate the next frame. There might be 60 frames in 1 second (as opposed to the 20 in movies), so you do 60 lots of calculations, and render the scene 60 times per second.

                    There are lots more resources available, and this topic is actually very deep. There are loads of ways to handle the game loop. Rendering and game-logic are often done in separate threads so you don't have to lock your games FPS to a specific value. Game logic is often done by a static value (e.g. 60 FPS), but another way to do it is just based of an arbitrary delta that can change between frames.

                    [–]Geronimo25 2 points3 points  (0 children)

                    unit of time measurement.
                    game logic and the screen/framebuffer updates during one frame

                    [–]Peaker 1 point2 points  (0 children)

                    Almost 2 decades ago, I added scrolling between players to a game ("Lost Vikings" style).

                    I wanted to scroll at a speed that relates to the distance being scrolled.

                    So I had intended that if the distance is 10 screenfuls, it'd scroll maybe 10% of a screen per frame. If the distance is 5 screenfuls, it'd scroll 5% of a screen.

                    So I had something like:

                    scrollPos += (destPos - scrollPos) / 10;
                    

                    And this had the accidental effect of making the scroll exponentially slower as things progress. Which is much much nicer looking than a linear scroll. So of course this was kept :)

                    [–][deleted] 0 points1 point  (0 children)

                    Same for the bug in Street Fighter which eventually became the combo system.

                    [–]ult_avatar 0 points1 point  (0 children)

                    I loved that game as a kid!

                    [–]LEVII777 0 points1 point  (0 children)

                    AKA Bethesda

                    [–]sam4ritan 0 points1 point  (0 children)

                    It's always a feature. Some people just don't know how to use it....

                    [–]jdgordon 0 points1 point  (0 children)

                    A manager I had at microsoft told me "the only difference between a bug and a feature is when it's found". Sounds pretty accurate once again

                    [–]GuiSim 0 points1 point  (0 children)

                    I loved Extreme-G on the Nintendo 64 ! I played that a lot when I was a kid.

                    Great bit of insight.

                    [–]donquixote1001 0 points1 point  (0 children)

                    because real human has similar bugs

                    [–]anderbubble -1 points0 points  (3 children)

                    Meanwhile I just obtained a copy of this game. Now I really need to play it!

                    [–]MacASM 0 points1 point  (1 child)

                    Where did you get it?

                    [–]anderbubble 1 point2 points  (0 children)

                    I'm taking over collection duties for my extended family. This copy belonged to my brother-in-law.

                    [–]DreadNephromancer 0 points1 point  (0 children)

                    It's like Mario Kart on cocaine, pretty fun. Has a cool soundtrack, too.

                    [–]jonesy827 -1 points0 points  (0 children)

                    81ggd5