John Carmack 2011 Keynote Annotated:
Part 3 of 3

 By Shamus Aug 10, 2011 133 comments

You should know the drill by now. Movie first, followed by my response with links to the part of the speech in question.


Link (YouTube)

Please, please, would someone from Quakecon log in to YouTube and CHANGE THE THUMBNAIL FOR THIS MOVIE? Thank you. Geeze.

37:15

“Every game has taken longer than the one before, and that cannot continue.”

This is, of course, one of the things I’ve been griping about incessantly for years now. I think everyone should have come to this conclusion about five years ago. Right now, Carmack is the only one saying it. (Or at least, the only one formulating a plan. So for EA’s brilliant plan is to continue to Spend Too Much, but make up for it by Charging Too Much. But that’s a rant for another time.) Other industry leaders will eventually follow Carmack, but I’m confident that the rash of studio closings over the last couple of years is a result of an entire industry that refused to see the wall they were about to run into. Even now, a few dozen studios and a few thousand jobs later, we’re still not seeing a real change in behavior that would bring these development times under control.

At this sluggish pace I imagine a few more development houses will be driven into the ground before industry leaders DO SOMETHING about it. And of course, if Microsoft or Sony hit us with another console generation, it might delay that realization even further. Because nobody will want to show up to the ball wearing last year’s graphics engine. Perish the thought.

I would love if the next generation of hardware wasn’t used to make anything look better, but simply used to make everything easier to develop. Imagine if Rage didn’t need that complicated four-tier staging system to bring textures from optical media to memory. However, until industry leaders repent, I’m sure any new hardware they get will be put into MOAR GRAFIX, and not used to give the artists and programmers a break.

42:00

“16k of ROM.”

Like he said, the high-end Atari 2600 games fit everything into 16K of memory, and it took some fancy technological tricks to make even that possible. That means that River Raid, that innovative game by plucky underdog development house Activision, was so small that its memory banks couldn’t even hold the HTML source for the web page you’re reading right now. (Not even close.)

46:00

“We don’t have detail maps [...]”

I give a basic visual demonstration of detail textures here.

46:30

So, even though Blu-Ray discs can hold a lot more data, id isn’t going to be filling up the Rage BR disc with higher-detail data. Partly because they didn’t have time to re-code all those terabytes of data. Carmack didn’t say so, but I also suspect that this would be pointless – higher detail textures would take even longer to come of the disc, and that’s already their big bottleneck.

Oops. Sorry Sony. Well, your hardware is more expensive, you came to the market late, and fewer people want to develop on it, but at least you have all that extra storage space! I mean, nobody can be bothered to fill that space because games are already too damn expensive as it is, but it’s there, right?

Again, I’m hard on Sony because this console generation should have been theirs. The PS2 is probably the greatest console ever made (going by longevity, quality, and library size) and a proper follow-up would have been enough to continue their domination. But they tried to win by cock-blocking their competition, instead of trying to release a superior product. The result was bad for everyone.

(Aside: We really need a less ribald idiom for “cock-blocking”: To frustrate or hinder a rival, even to one’s own disadvantage. To childishly destroy to prevent the success of another out of envy or spite. A kind of griefing. I know English is a second language for some of you, so I’ll ask: Do any other languages have one we can steal borrow?)

54:10

Carmack is talking about “static software analysis tools”. That’s a program that looks at your source code, analyzes it, and lets you know about possible dangers, inefficiencies, or bad practices. Just recently I was messing with cppcheck, which was suggested by reader Kdansky. This is a free, open-source version of the stuff Carmack is talking about. It’s actually kind of irritating to use, like having the world’s most pedantic nitpicker go over your code and say the same thing 11 dozen times. But it’s also good for you, for all the reasons Carmack mentions.

People praise Carmack and give credit for his stable code to his high intelligence, and I’m sure that factors into it. But I’m sure there are a handful of other coders in the industry with IQ’s in the same ballpark. Geniuses aren’t that rare. No, I think the big reason his code is so excellent is simply because he cares. Other developers have the ability to make stable, efficient, maintainable game engines, but they need to have a passion for it. It’s the sort of “are you the sort of person who will vacuum behind the couch” (metaphorically speaking) or would you rather move on from vacuuming to do the “fun” stuff?

I suppose it also helps that Carmack has a great deal of political power in the company, which gives him the muscle to keep games in development until he’s happy with the technology, not until some non-gaming manager decides, “Bah. Close enough. Let’s release it.” This passion for quality has given them great financial success, which in turn allowed them to continue to spend the time needed to build well-engineered games.

57:00

I always thought I was only attached to Microsoft Visual Studio because it was the programming environment I’d used the most, but as I’ve been learning over the past year, Microsoft really does make outstanding development tools. Their dev tools are very different from their other consumer-level software like word processing, video editing, media playing, and operating systems. In sixteen years of use, I’ve never had Visual Studio crash on its own, I’ve never had my project files corrupted, and I’ve never had it give me baffling or incorrect error messages*. I doubt anyone using Microsoft Word for the same length of time could make a similar claim. Sadly, I’m using the Hippie Freeloader edition of Visual Studio, so I don’t have access to the Microsoft tools he’s talking about.

* The compiler itself gives mysterious error messages all the time, but that’s more an issue with C++ than with Microsoft. I don’t think MS is uniquely bad in this regard.

1:01:10

Carmack is talking about a particular kind of bug that creeps into software, particularly 3D games. It works like this. Say you’ve got a few lines of code for moving the player around:

1
2
3
new_position.x = player_position.x + movement.x;
new_position.y = player_position.y + movement.y;
new_position.z = player_position.z + movement.z;

Most programmers will simply type the first line, then copy & paste it twice, changing the .x bits to .y and .z. I once had a boss who passed along some wisdom from one of his instructors in college, “Most software bugs come from copy & pasting code.” It sounded strange at the time, but over the years I’ve come to see how true it is. In the above example, the math involved is simple enough that you’re unlikely to make a blunder, but in a larger and more complex operation the odds of forgetting to change an .x or of transposing a .y and a .z increase.

The problem with copy-paste code is that it is, by its very nature, code that already compiles. If I accidentally fat-finger type “neq_position” instead of “new_position”, it won’t compile and I’ll fix the problem right away. But by copying selections of working code you can omit error checking, leave variables unchanged, accidentally perpetrate variable name collisions (where the same variable is used to two totally different things) or leave out proper memory management steps – all of which are things you’re unlikely to do if you’re forced to type out each line.

I don’t think the solution is to simply never copy & paste code. I think the solution is to recognize how many bugs arise from bad copy-paste, and to realize you’re doing something dangerous. A healthy sense of paranoia can probably help you to catch a lot of blunders before you move on, leaving a landmine for your future self.

1:04:40

Talking about game crashes, he mentions a hypothetical programmer encountering a situation, “Oh, but I didn’t expect that we would be changing weapons while falling to my death while being crushed by a vehicle that’s targeting me.”

He was using it as an example, but I’ve often found that movement code can be so much more complex that you would normally expect. Yes, the deep bowels of the engine can have areas of terrifying mathematical complexity, but most of it is fairly linear. Player movement is highly conditional.

Hypothetical example:

The jump button makes you jump. Unless you’re falling, or recovering from a fall of sufficient height to inflict damage. But if you’re running, then the jump button needs to delay a step, or wait for a button release so you can charge the jump. Except if you’re sliding down a slope, in which case it needs to be immediate, unless you’re not quite up to speed and you’ve only slid a few feet. But if you’re in the process of charging a jump and a situation arises where you would no longer be able to perform a jump such as sliding or encountering an edge, then the jump should begin right away or the controls will feel “unresponsive” to the player. Although, this immediate jump shouldn’t be allowed if the player has just sustained splash damage, since that means an enemy is trying to knock them off the ledge, and the player shouldn’t be able to exploit around that by charging a jump just before impact. However, the jump (if allowed, and not-charged) needs to be reduced in height when the player is actively carrying one of the “heavy” class weapons. If the jump takes place during a weapon-switch, the switch should complete instantly to avoid animation problems, but the player should have a cooldown placed on their weapon to prevent them from using it until the point where the weapon-switch animation would have completed. Also, if swimming in water deeper than waist-height, the jump button should be used to simply “swim up”, and if swimming up at the edge of a deep pool of water, the player should be allowed a jump of double height so they can leap up onto dry land…

GAH! Now we’ve got two pages of code to handle ONE BUTTON. The indentation on that block of code is going to be insane. Input and movement code gets like this, and a huge tangle of interfacing conditions can often be far more daunting than a big ‘ol page of math.

Worse, it’s a devil of a problem to actually test all of this stuff.

1:08:48

“What I want to be working towards is a case where we can say, the game cannot… uh… cannot have an exception.” I’ll bet the reason that he faltered there is that he was deciding if he wanted to use the word “exception”, or the more colloquial, non-techie term “crash”. The two are not quite the same thing, and when discussing complex subjects like this there’s always the question of whether you want to be precise (because your fellow programmers love to correct you) or if you want to be understood by the masses. (Because most of them have no idea what an exception is.)

What he’s proposing is a lofty goal. He wants to take Rage – the biggest id Software project to date, which involves many programmers and millions of lines of code – and make it unbreakable. There may be bugs. Maybe switching weapons, while reloading, while falling, while picking up a new weapon on the way down, will still lead to some strange behavior. But it shouldn’t ever crash, lockup, or become corrupted in such a way that the program needs to be restarted.

Again, I really hope the id Software technology and culture can rub off on Bethesda. It would mean nothing but good things for the rest of us.

1:23:55

“The Doom 3 source code will be released this year.”

I’ve been waiting for this for a long time. When Doom 3 was new, I really thought the unified lighting would open up this new world of procedural (or at least dynamically generated) games. No more building fixed light maps in a lengthy compile. I played around with the editor when it first came out. I’d wanted to make something like System Shock 2 gameplay with randomized layouts, but I found I didn’t have the fine-grain control I needed to do a real proof-of-concept. I decided to shelve the project and revisit it when the Doom 3 source went public. (I didn’t realize how long it would take. I suspect Rage’s lengthy development delayed the release of the source.)

Sadly, now that it’s coming out I don’t have time to do anything with it. Between the book, Project Frontier, this website, and some of the other contract work I’m doing, the hours just aren’t there. Hopefully someone else will step in and make it happen. I’m sure I can’t be the only person with something like this in mind. It should be easier now than it was in 2005, since you don’t need to be nearly as picky about overdraw. There are lots of CPU and GPU cycles to blow on un-optimized level geometry.

And we come to the end. I tried to make that as accessible as possible. I apologize if I got too jargon-heavy there at the end. Hopefully you were able to enjoy his presentation at least a fraction as much as I did.

A Hundred!2013There are 133 comments here. I really hope you like reading.


  1. Mark says:

    “Frustrate” is a good synonym for cock-block, but it’s kind of overloaded. “Stymie,” perhaps, or “foil” or “baffle” might work.

    John Carmack is a man of vision and his comments on functional programming and safe subsets of languages were very interesting; I’d give my left nut to be involved in anything he’s up to. Unfortunately, as a programmer I lack the experience to credibly apply there. It’s the old unemployment catch-22.

    • Ingvar says:

      Harking back to the classics, “Pyrrhing”. From “Pyrrhic victory” of course.

      I think it kind of fits, at least partially.

      • Alexander The 1st says:

        Pyrrhing doesn’t work though, since it’s not about winning – it’s about deliberate sabotage of someone else’s success, irregardless of your win condition. You can still win under certain conditions (i.e. Apple does this with the iPhone – requiring Objective-C or specific library calls, and specifically went out of their way to prevent Adobe from getting Flash code to convert into iPhone code. One could easily say Apple’s won this fight, but it wasn’t about winning. It was about taking the fight to Adobe and getting them to not gain iOS developers.”).

        Maybe “Loss-lead-block?”? Intentionally writing off something in order to hamper someone else? (In the case of the PS3, intentionally writing off “easy development cycle” in order to hamper the intent of developers to cross-code and port?)

        • Wtrmute says:

          It would be vaguely similar to the economic term “dumping”, where a large company sells below cost taking advantage of its larger cash-flow in order to starve its smaller competitors and drive them out of business. Although, dumping refers to setting an artificially low price, not setting up a technological barrier.

        • Ingvar says:

          Yep, thus the “partially”. Although extending “Pyrrhing” (and possibly devalue “Pyrrhic Victory”) is probably a win, compared to keeping using cockblocking.

        • Blake says:

          I wouldln’t normally grammar nazi here but since we’re already arguing over words I thought I’d just say that ‘irregardless’ isn’t a word, if it was it’d mean ‘not without regard to’, which is the opposite of what you wanted.

          ‘Irrespective’ or ‘regardless’ would’ve worked here.

          • Takkelmaggot says:

            How is “irregardless” not a word? It is clearly a word, it simply has a meaning in common usage which isn’t consistent with what it *should* mean. Merriam-Webster and other dictionaries gave up on this and just caved in to common usage, so, a word it is.
            Myself, I try to use “irregardful” instead.

            • Because English has rules, that’s why.

              When English stops having rules, people stop being able to communicate with one another.

              There’s no such thing as a private language – it defeats the whole point of language.

              And if you run around breaking the rules and changing words willy-nilly, then in a few centuries you end up with an entirely different language (which is why English and German are different languages now).

              • But which rules matter? And which don’t? Languages HAVE to change to deal with objectively new conditions.

              • LokisDawn says:

                Wait, wait, wait! Are you trying to be cynical there? Are you implying the development of different languages is inherently bad? Or that the language you are using right now is the same as the one Shaespear used(kinda cliché but just to make a point). Now of course it’s is arguable that it would be better if no multiple languages would exist, thereby eliminating a lot of language-dependent borders(As was tried with Esperanto). But really that is just utopian fantasy, for language is a living and developing thing.
                Just to Note: I’m only refering to this one post, not the whole “irregardless” thing, as that is a inherently logical impossibility.
                Another note: I’m not a native english speaker, so forgive me for eventual mistakes.

    • Tse says:

      I think “screw over” would be appropriate.
      P.S. I’m from Bulgaria and we have a saying: I don’t need to be well as long as my neighbour is worse off than me. (rough translation)

      • lazlo says:

        I think what you really need is a verb form of schadenfreude.

        • ClearWater says:

          So, schadengenießen?

          • lazlo says:

            Not quite. That’s verbing the enjoyment part of the word, while what really needs it is the harm part. Schadenfreude is the enjoyment of another’s misery, schadengenießen is the act of enjoying another’s misery, what we need is the enjoyment of actively causing another’s misery.

            Griefing is probably the best approximation.

        • Zukhramm says:

          Everytime I see that word in English I can’t help but ponder why the German word is used.

          Were the English such a friednly bunch that they never needed to describe the concept and therefore never developed the word? I somehow doubt it.

          • Alphadrop says:

            We just thought it sounded cool so left it as is.

            • Zak McKracken says:

              Thanks :)

              Now, I’d like to know how you pronounce it, with the “sch” and the “eu” and all…

              As for Shamus’ question: “Spielverderber” means someone who ruins a game for the others, either by cheating, through cheesy tactics or simply by quitting. This is usually someone who’s playing (or competing) with others, but it might also be an outsider interrupting the game at the worst time.
              Sadly, there’s no verb for this. You could say “Jemandem das Spiel verderben”, but that is not more eloquent than “spoil someone’s game”. It’s also a lot of German words and I wouldn’t want you to break your tongue trying to pronounce them…

          • Mephane says:

            Every language has some words it directly takes from another one. Actually, German contains much more English words than the other way round.

            Some German words used in English I remember:

            Schadenfreude, Bratwurst, Doppelgänger, Hinterland, Kindergarten.

            Feel free to add more to this list, heh.

    • Deadpool says:

      Yeah, I moved here pretty young, so my Portuguese vocabulary is that of a 13 year old… Portuguese doesn’t roll off the English tongue like French, German and its cousins do so…

      To Stonewall? To Philibuster?

      How about turning a rescent event into a verb? To Tea Party?

    • droid says:

      More importantly, Stymie is part of a safe subset of English, while cock derived phrases potential unsafe and are deprecated.

    • Matthew says:

      Keep the rhythm of the expression and coin “stop block.”

      The actual fencing term is stop thrust (when you extend your sword into another person’s lunge). Done right, the other guy impales himself on your sword, but it’s still more dangerous than a parry, and you can both end up skewered.

      Seems to be the idea we’re going for: I’m far more interested in killing the other guy than I am in properly defending myself by either blocking or retreating. If it works, I win. If it doesn’t work, we all die. But I’m OK with that. At least, until I feel the sharp end.

      Though that p b combination is gonna be killer.

  2. kikito says:

    “GAH! Now we’ve got two pages of code to handle ONE BUTTON. The indentation on that block of code is going to be insane. Input and movement code gets like this, and a huge tangle of interfacing conditions can often be far more daunting than a big ‘ol page of math.”

    It doesn’t have to. You can split the “big tangled code” into smaller functions with proper English names. So instead of this:

    if(status != FALLING || status != TAKING_FALL_DAMAGE) {
    int delay = 0
    if(status == SLIDING && slidingTime > 0.5) {
    delay = 5
    }
    [ lots of code dealing with a delayed jump]
    }

    You do this:

    if( canJump() ) {
    int delay = calculateJumpDelay()
    performJumpWithDelay(delay)
    }

    And you define as many methods as you need.

    Sure, it’ll take a bit longer to code upfront, but it will be easier to maintain in the long run. If you are worried about the code efficiency, don’t; the compiler will inline most of that for you, with any modern compiler. But you probably knew that.

    “Worse, it’s a devil of a problem to actually test all of this stuff.”

    That’s another advantage of having it all divided into smaller chunks. You can test them separately. You can even create *automated tests* (OMG!).

    Next time you have to add a condition, or change the behavior, of what not (we have a new gel type that makes you jump farther!) you can just make the changes in one or two places, run the tests and check that everything is still running fine.

    • Kdansky says:

      Well done. This is the proper OO-approach. Split stuff up. If you really want to, you can then force_inline everything in C++ to make it a tiny bit faster (not that this would matter in the slightest when we are talking about half a dozen call stacks only on jump-button presses).

      But the main point still stands: Code like this is error prone, because there are a lot of possible paths to take. Has the programmer really thought them all through?

      • Wtrmute says:

        Strictly, this is the structured-programming approach. OO-approach would involve interface-hiding and message-passing, with different entities (objects) responsible for separate parts of the logic. Dijkstra is the one who would chew you out for this, not Dahl and Nygaard.

    • Mike Riddle says:

      Another way that is a little easier to analyze for missing points is to use “data tables”, each column is one state variable and the last column is the result state which may be complex. (or in a database even.) (also makes the code shorter..

      table =
      {
      { RUNNING, SLIDING,< other state variables > , <result > },
      { WALKING, SLIDING, < other state variables >, <result > },
      { RUNNING, CLIMBING, < other state variables >, <result >},
      { FALLING, SLIDING,< other state variables > , <result >},
      ...
      }

      One can even generate the code (except for the result), to ensure that all cases are handled.

      • Kdansky says:

        A huge issue I see with this: What do you do when you release Burning Crusade, and suddenly, all avatars can not only run and ride and jump and swim, but also fly? Extend a fixed length array by one, three years after release, and break every single access to that table that was ever written?

        This is also the one giant problem relational DBs have: Adding columns late is clunky and a huge mess.

        • Alexander The 1st says:

          A huge issue I see with this: What do you do when you release Burning Crusade, and suddenly, all avatars can not only run and ride and jump and swim, but also fly? Extend a fixed length array by one, three years after release, and break every single access to that table that was ever written?

          Sounds like a sound DRM tactic against pirate servers/pirated accounts. “Hey, before you begin playing, you’re going to need this data, otherwise everything looks very odd.”

        • John Lopez says:

          Relational databases have lots of “problems” (at least from the too-cool-for-school NOSQL crowd), but adding columns late isn’t one of them.

          ALTER TABLE tablename
          ADD columnname datatype not null
          CONSTRAINT DF_tablename_columnname DEFAULT (defaultvalue)

          Wow, that was *hard*. I think even the non-programmers can follow along that we are changing table by adding a column of a given type (not null just ensures we don’t leave it blank) and the default value is specified.

          Once that statement is executed I update my object relational mapper (I prefer LLBLGen) and I now have the new column on my low level objects.

          Considering I’m working on a line of business system this very moment (well, not working while I type this) I can state the entire cycle of typing a line of SQL, updating the ORM and continuing to code is a two minute procedure.

          I like some of what NOSQL brings to the table, but it also brings its own problems. Ease of schema changes though isn’t something I find NOSQL is winning on though… it just delays the problems until you load old data.

          • Zak McKracken says:

            Is it a good idea to use relational databases in a game, instead of variables?
            Won’t that be very slow? I haven’t programmed databases or for databases ever, but I figure you’ll need a front-end, a back-end, possibly a complete client-server thing, just to get a value that would otherwise just be fetched from RAM adress xy, many many times per frame…
            … or are there db-like structures that can be compiled to be just as fast as regular variables these days?

      • Zak McKracken says:

        Actually, that seems like a good idea … have a default state, defined by variables, and anything happens will apply a change to those variables. The “jump button pressed” action then “just” reads those variables and determines what will happen.
        If you introduce new properties, that’s just a line at the right point in the hierarchy, and the programmer does not need to thing about every single combination of states, because that will happen automatically. Even if in some case, the variables are defined poorly, the wrong thing may happen, but the game won’t run through a batch of unfullfilled if conditions and then crash.

        Although I guess getting the hierarchy right there (i.e. determining the order in which changes are applied) can still be a challenge, although that needs to be done in any case.

    • Lalaland says:

      I see what you’re saying but all too often it seems that code that ‘reads well, runs poorly’. I can’t remember where but there was a great article that consisted of images of source code with post its attached reaming the coder for inefficient yet reasonable seeming steps. Even in JAVA optimising code can break portability and that was supposed to be impossible (along with a lot of other things but I digress). OOO techniques in particular are better suited to non-real time systems that can afford the flab that so often comes with them.

      • kikito says:

        “code that ‘reads well, runs poorly’”

        All too often I hear that. It’s patently not true. Code that reads well runs faster, simply because it’s easier to modify and bend. “Optimizing” the code by making it less readable might get you a 5% performance increase, but a change in the overall design might get you a 50% increase. If your code is so unreadable that the original design doesn’t transpire any more, you lose a lot.

        Carmack himself hints at this on his presentation: he mentions extremely “optimized” pieces of code… that no one dares to touch, because they are extremely brittle.

        “OOO techniques in particular are better suited to non-real time systems” that can afford the flab that so often comes with them”

        They said the same about C when it started. It was seen as “flab”; after all, machine code was faster.

        Real time systems are not all-critical. They have subsystems were they absolutely must meet very strict requirements, but usually that just one core section of the functionality. And then there’s another part that isn’t that critical. For example, in an elevator, the system that controls the safety brakes is critical, while the one controlling the interior illumination isn’t.

        Sometimes is tricky to differentiate between the two groups. And that’s where a good upfront design helps.

        Once the critical parts have been properly defined and isolated, it’s still better to start with a legible, well designed version, and iron out inefficiencies as they are found, via rigorous, exhaustive testing – but you do the “good” design first.

        What real time systems really can’t afford is a giant chunk of messy, entangled, unreadable code where it’s difficult to tell what does what and the side effects of every action are non-obvious.

        • Kilmor says:

          Sometimes even simple code changes can make things harder to read but gain massive speed boosts. One thing I did at my company(we do embedded sw) awhile ago was looking at what functions we spent alot of time in and try to optimize/improve this for more idle time, and sprintf was one of them.
          Something simple and readable like(as an example, assume this are all char*’s):
          sprintf(pcNumbers, “%s%s%s%s”, pcOne, pcTwo, pcThree, pcFour);

          was about 10x as slow as:

          strcat(pcNumbers, pcOne);
          strcat(pcNumbers, pcTwo);
          strcat(pcNumbers, pcThree);
          strcat(pcNumbers, pcFour);

          This is a simple example but, what was more common was putting together printable date and time strings, etc. Add in putting a space and a dash and the strcat version can be hard to read but you get a Serious performance increase. Sometimes fast code is just hard to read :\

          • kikito says:

            “looking at what functions we spent alot of time in and try to optimize/improve this for more idle time”

            We are saying the same thing then. First, do it readable. Then, do tests, and find bottlenecks. And then, do low level optimizations. But don’t start with low-level optimizations and unreadable code.

            Nevertheless, in your case I would have tried to use a custom print function, instead of calling strcat so many times. Then, I would have compared that with the “multiple strcat” solution and replace it only if the savings were worth it.

    • decius says:

      get jumping_status
      Case standing_walking;
      jump(up)
      break
      case running;
      jump(forward)
      break
      case fall_damaged
      stumble
      break
      case swimming_UW
      swim(up) //break omitted: player should be able to climb out directly from swimming underwater
      case swimming_surface
      mantle_out_of_water
      break

    • Zak McKracken says:

      With this approach, you’d still have the basic problem: What if some time later someone decides to add one more state, or it is possible to do two things at the same time that you didn’t think about? You’d still have to handle every case separately, and if you forget about it, boom! Also, the amount of mixed cases (crouching while jumbing, running with scissors…) goes up exponentially with different states and also with different things that have states (mode of movement/environment/stuff you’re doing/stuff others are doing to you/things the player is doing in the game menu/options in the game engine/ingame options…)

  3. X2-Eliah says:

    About the copy-and-pasting.. Well, this would only work in an IDE, and not in your console/notepad ;)

    But, how about shading each copied line grey isntead of usual-black, so you can tell on a revision-glance what areas of copied-pasted code are left unchanged (if you change an area, it goes to the true black colour saved for ‘new code’).

    Dunno if some IDEs already do this or not, but imo might be useful.

    • Alan says:

      Huh, I use notepad2 (Open source version of notepad with more features), but if you made software which did that, I would buy it :-)

    • Veloxyll says:

      I was going to say myself that programing languages need a highlight for C&P code. Great minds steal each others ideas and all that!

    • Ingvar says:

      I normally solve the copy&paste problem with a macro. But, that approach is almost never flexible enough in the “C heritage” line of languages. Oh, well, it’s OK for the specific case demonstrated, but I find that copy&paste is even more of a danger when you need a larger chunk of code, with only minor changes spread throughout, where turning it into a function call wouldn’t, necessarily, work.

      • Alexander The 1st says:

        Hmmm – maybe it forces the entire block to be highlighted, and only the characters (Not the lines themselves) get un-highlighted>

        Sure, it would get OCD-programmers like myself to end up re-writing all the code (“Make it neat.”), which would have the effect of us re-writing all the code, but then we shouldn’t be copy-pasting in the first place. <_<

        • Ingvar M says:

          I much prefer changing the language to suit my needs. Domain-specific languages (embeddable, compilable to native code, usually by being in-place transformations to the surrounding language) FTW.

    • Zak McKracken says:

      What helps: replace everything that will have to be changed in the new lines with a placeholder than go find/replace on them. Make the placeholders so obtrusive you can’t miss it if you forgot one.
      John Carmack’s solution, though, seems to be to write a loop instead of three near-identical lines:
      for coord in range(3):
      position[coord] = oldposition[coord] + speed[coord] * timestep

      the timestep is in there to prevent ingame stuff from happening slower if the framerate goes down and vice versa.

      …although John Carmack does not like Python and that made me sad … I’d like for him to elaborate more on this. I mean, not for high-performance code of course but for modding stuff, and basically for macros on the user side? I love it.

      • Gimli says:

        His objection to it is, I believe, based on the static analysis stuff he was talking about. dynamic duck typing, while really convenient when you sit down to write code the first time, makes many kinds of static analysis a tremendous pain. Writing good, safe code in any language requires that something goes over every line with a microscope, and for Python, that needs to be a programmer more often than you’d want.

        • Zak McKracken says:

          As I said, for coding a game, python is probably a really bad idea. But on the user side, for modding, scripting, stuff like that? Potentially buggy user scripts are not in the final release, you just allow users to make them. And if they breaks the game it’s not the vendor’s problem. Of course, implementing a python interface would be source for bugs, but since python itself has a pretty bug-free interface, I think that problem must be solvable.

          I just came across this paper that shows how users spend more time and effort on innovations than corporations:
          http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1683503
          (German article on the paper, with interview: http://heise.de/-1198648 )

          From this perspective, not allowing laypeople to mess with your product would reduce its usefulness a lot!

  4. Alan says:

    Sorry to add a feature length post to your post, but this one struck a few ideas.

    “Every game has taken longer than the one before, and that cannot continue.”

    I am not really involved in the industry, but from what I have seen with the information publishing on the Internet and the indy movement with games is that you have the big AAA studios who make the flashy releases and the big engines, then the indy developers use licenses on the engines and make smaller niche games.

    This leads to big hits, and smaller games with little in between. We are sort of seeing that now, but I think that it will only intensify.

    The scary part is when large games companies start swallowing up the smaller ones so they get every layer of cake.

    “16k of ROM”
    It still amuses me that I had a graphical calculator which has more processing power than that.

    Copy and Paste are the gremlins which infest pretty much every area or creative work. I have seen all kinds of professional publications fall foul of it, the problem is that paranoia isn’t enough. If you go tighrope walking often enough, you won’t worry about the fact that you are 60 feet in the air with no safety net. If you are good, then a centimeter wrong will mean that you have to take an extra step to rebalance. With Copy and Paste, you will still have an error which will cause problems.

    “What I want to be working towards is a case where we can say, the game cannot… uh… cannot have an exception”

    While your explanation of what that stutter means makes complete sense, I have another thing that occurred to me. This is a non-sales / PR guy who spoke for about an hour and a half with no notes, with no repetition, little hesitation, and while didn’t have any hype or amazement, he managed to be interesting throughout based on his target audience.

    That is quite a feat of public speaking. It makes me wonder whether he was speaking off the cuff, or he had memorised his speech. Either way, that is pretty impressive.

    Although, being a technical guy perhaps he found some way to use lasers to display the speech on his glasses.

    “and some of the other contract work I’m doing”

    I know this is coming from some random Internet guy, but good for you. I hope it helps to keep you from being homeless.

  5. Halceon says:

    I’m fully sure that it’s not going to catch on, but I’d suggest cock-block be replaced by čakarēt. Anglicize it to chakarate and voila – nobody understands what you’re talking about.

    Edit: And then I realised you were looking for an idiom. Nevermind.

  6. Kdansky says:

    Some people just get the copy-paste thing, and the others will never become really great programmers. It was one of the first things my software engineering professor told us, which were:

    - Copy-Paste is evil. It leads to redundant code (always bad) and you are likely to make mistakes on top of that. Try to refactor your code so you don’t have to copy-paste.

    - There is no tax on keystrokes. Use clear variable names. Think about them for a moment. Be concise if you can, but be utterly clear at least. Do not use short but slightly wrong names. Example from the book: If you have a function returns a number and proceeds to read the next one into cache, don’t call it “getInt()”. Because then you’ll have code like “getInt() + getInt()” which looks like it could be written shorter as “getInt() *2″, but it cannot, because the two values are not identical, which is not obivous. Call the function “getLastInt()”. It may be longer, but it will throw you off when you are about to rewrite it incorrectly.

    - Command/Query separation. Try to avoid functions that have side effects AND do meaningful querying (returning a “I have inserted a value, but not overwritten anything” can make sense). Because then you cannot just ask for the value without changing your data, and you will at some point forget about the side effects. The function from the earlier example qualifies well for this problem too.

    - Comment reasoning, don’t comment behaviour. Everyone can see that your loop goes through the array. Don’t write “iterate over the array” on top of it. But nobody will know why it does it. Write “compute height of all objects to get ceiling minimum” there.

    These four minor things improve code by a ton. Or rather, every time you have to work with code that violates them heavily, you will curse a lot.

    • kikito says:

      “Command/Query separation”

      I would extend that to: each function/method should do one thing, and one thing only. If a function does two things, you split it into two functions. If a function iterates over a structure and performs a calculation, that’s all it should do. If a function uses a calculation to invoke this or that condition, that’s all it should do.

      This means that a function might have a loop, or an if inside it, but probably not both.

      At the end, functions should be small; 6 or 10 lines, tops.

      “Comment reasoning, don’t comment behaviour”

      I don’t agree with this. To me, each comment is … a failure.

      Instead of adding comments to make the code clearer … make the code clearer!

      So don’t do this:

      /* compute height with all objects to get ceiling minimum */
      int ceilingMinimum = 0;
      for(i=0; i<objects.size; i++) {

      }

      Instead, do this:

      int ceilingMinimum = calculateCeilingMinimum(objects);

      And put the calculateCeilingMinimum function where it corresponds, with the loop and whatnot inside. If the code inside the loop still has dark areas, move those to their own functions too. Rinse and repeat, until the code doesn't need any extra explanations to "make it clear".

      I started thinking this way after reading the Clean Code book:

      http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882

      There's also a series of (paid) video tutorials in http://www.cleancoders.com , which are somewhat more updated, and funnier to watch (but they are also more expensive)

      Disclaimer: I have no personal gain on putting those links here; I just found them really good and worth sharing

      • Kdansky says:

        I agree with everything you say. I should have offered a better example for comments:


        /* This block is required to work around an MFC anomaly when doing message handling in a GUI thread, or else it can lock up during calculations that take a long time while receiving a lot of messages over TCP. */
        ... code...

        And I am not really making this example up. The next person to read this will know why that very weird looking block is there. I also find the Javadoc (or Doxygen) style comments useful. You write up a short explanation on how a class or function works and what it does, and what the possible pitfalls and caveats are. Most obvious example: Write clearly if a container structure supports multi-thread access or not, and if yes, by what means and how enable/disable it.

        I just hate pointless comments which do not tell me anything at all. I’ve seen countless comments like these:

        uint32_t m_uiCount; // stores the count of the number of elements in the data structure

        That is so redundant! You can infer the “ui” from the fact that its type is uint. You can infer that it obviously counts something. You know it stores stuff, because it’s a member. And because you know it’s a member, the m_ is really quite pointless. This is also a prime example of badly used hungarian notation. Just get a decent IDE which uses proper colouring by scope instead of murdering readability.

        The Clean Code stuff is a good read, I can also recommend it.

        • Daimbert says:

          Kdansky,

          On the first one, I do want to know why you added that code, but more importantly what I want from that comment is in fact HOW that block of code works around that problem. So something like:

          “If you’re receiving a lot of messages over TCP, sometimes you can lock up doing these calculations because of an MFC anomaly. So what we do here is do blah and blah to work around it”. The comment you list is better than nothing and even some simple comments, but it isn’t what I want when I come across your code a few years later and need to know what you did to fix your issue.

          On the variable, is it really the case that someone puts that ui in there to indicate that it’s an unsigned int? Even in the coding standards are work, we don’t do that. We would do this: m_count_ui (maybe). But if someone did m_uiCount I’d presume that this counter counted things related to UIs, not that it was uint.

          Now, why would we use the m_ and ui? Well, it isn’t for when you’re looking at the definition, but when you’re looking at the code that uses it. So in a block like:

          m_uiCount_ui = count_ui;

          Stated like this, I know that:

          a) I’m taking the local count and putting it into a member variable.
          b) These counters are unsigned ints.

          And I know this looking only at that line and only at the names. I don’t need to find the definitions or even follow any other line of code to know this. But your way:

          uiCount = count;

          I get none of that. I can guess that they’re counts, but that’s it.

          I’m not obsessive about this myself — even to types and member variables — but I can see why people say that it’s a good thing to do.

          • Kdansky says:

            The m_uiCrap stuff is from the coding conventions of where I work. It’s not much of a bother to do it, but on the other hand, it’s not much of gain either, while hurting readability.

            The thing is, you can always look up whether a variable is an unsigned int. Hungarian notation was invented in Excel:

            rIndex vs cIndex

            Both are ints (or uints), but the important thing is: One is for row indices, the other for columns. Without proper naming, getting these mixed up is a huge problem, because they have the same type and pretty much the same name. Sure, I would call them rowIndex and columnIndex, but if you want to shorten that, rIndex makes a lot of sense. Hungarian should be used for information about the variable, not about the type, because the type is clear anyway. The compiler will tell me about types, but it won’t tell me about semantics.

            m_uiCount = uiCount
            this.count = count

            Second one doesn’t pester you with info you really don’t need. Is count signed or unsigned? It never matters, and when it does, some idiot has used an unsigned for no good reason than to look cool and old-school. So the error isn’t in omitting the type, but in having wrong types to begin with. And as soon as C++ enters the fray, you get things like dwCount = uiCount (identical types, different names!), which is anything but bonkers.

            • Blake says:

              “this.count = count”
              Except that with this in any function someone might have
              int BarsCount()
              {
              int barCount = 0;
              int bars = GetBars();

              for (int i = 0; i < bars.Count(); i++)
              if (bars[i].IsHappy())
              {
              count++;
              }
              return count;
              }

              And accidentally increment and return a member variable 'count' instead of the local variable 'barCount'.
              With m_count you absolutely know you're dealing with a member variable with all the side effects (and memory chache misses) that entails.

              • Mephane says:

                What’s accidental? He’s not declared the variable inside his function, so he’s obviously producing a side-effect. And if it has to be so explicit in some situation that something is a member, I’d still prefer this->count over m_uiCount.

                We have similar coding standards at work using Hungarian notation for types and other redundant stuff. More often than not it is pointless, doesn’t help anyone and makes the code butt-ugly on top of it. And guess what happens when the data type of some variable changes (say, from int to double)? No one ever bothers to update the Hungarian notation anyway, so you will not even be able to rely on the notation telling you the proper type.

                The original idea for Hungarian notation was to display distinct semantics, for example


                int iArea = pxHeight * cmWidth; // wait, why do we multiply pixels and centimeters, something must be wrong here
                int px2Area = pxHeight * pxWidth; // ah, that makes sense now

                This is similar to units of measurement language like F# provide, where you can turn a primitive into a compile-time semantic type, example


                [<Measure>] type px; // pixels
                [<Measure>] type cm; // centimeters

                let pxHeight = 1024<px>
                let pxWidth = 768<px>
                let cmHeight = 20<cm>
                let cmWidth = 25<cm>

                let area = pxHeight * cmWidth // compiler outputs an error!
                let px2Area = pxHeight * pxWidth // pxArea now has the unit px^2

                Since such a compile-time feature does not exist in C or C++, Hungarian notation was a clever invention to at least make these issues visible to the programmer. If he had used types instead of units, he’d just see that integers are multiplied, which wasn’t even the point (could all have been long integers, for example, and wouldn’t have mattered at all).

              • kikito says:

                The problem there is that “this.count” isn’t a good name, to begin with.

                It’s like wanting to have a member variable called “i” and wanting to prefix it with “m_” to differentiate it from local variables. The problem there isn’t the prefixing, is that the name chosen for the member variable wasn’t specific enough in the first place.

                I’m also of the opinion that with today’s IDEs, prefixes and hungarian notation bring very small advantages in exchange of clutter.

                • Daimbert says:

                  Well, how specific do you want it? Imagine that I have a member variable called “timeOfDay” and I have to set it in a method at some point from a local timeOfDay. How would I name that to avoid an issue like that? I’d still have:

                  this.timeOfDay = timeOfDay.

                  In fact, the more specific I make the name the more likely it is that that’ll be the only useful way to name the thing stored in such variables.

                  Which is why I love to copy the old Smalltalk standard of:

                  setTimeOfDay(Time aTimeOfDay) {

                  timeOfDay = aTimeOfDay;
                  }

                  • kikito says:

                    I was talking about the specific case of having to use the member variable as an “initializer” of the local variable.

                    In the opposite case (parameters initializing member variables), I just use the complete path (this.whatever):

                    setTimeOfDay(Time timeOfDay) {
                    this.timeOfDay = timeOfDay;
                    }

            • Daimbert says:

              Kdansky,

              My whole point was that I don’t really want to have to look into the header file to see what this was defined as. For small examples like what we have here, it doesn’t matter, but when you start getting into more complicated types and code it’s really, really nice to do exactly what I said and look at that one line and say “Ah, those are unsigned ints. So that’s the problem; you can get a signed number into count.”

    • Phill says:

      - Copy-Paste is evil. It leads to redundant code (always bad) and you are likely to make mistakes on top of that. Try to refactor your code so you don’t have to copy-paste.

      Absolutely. You might get away with it once, but any code that is appearing in three or more places needs to be put somehow into a single block of code that is called from various places. In Shamus’s example you might need a three-vector class that defines an addition operator, and then you can just write:


      new_position = player_position + movement;

      You may spend ten minutes writing a class to get rid of some copy-paste code that could be done in 10 seconds, but in terms of maintainability, readibility and future development it wins out in a big way.

      • Chris says:

        Yes, this. Then the code only has to be correct in one place in your code base. Also it will be one highly used and hence well tested place so if there is a copy-paste but in your operator overloading it should be found straight away.

    • DrMcCoy says:

      Try to refactor your code so you don’t have to copy-paste

      Yes and no. For small and specialized things, that only confuses the code more by littering it with 1000 small functions that are each called only once.

      When I copy and paste, I always look twice at what I just did.
      Balance and common sense are the key, just yelling that copy and paste is always evil does not help.

      Do not use short but slightly wrong names.

      On the flipside, a 50+ character variable name isn’t really handy either. :P

      Try to avoid functions that have side effects AND do meaningful querying

      Again, depends. For example, reading an n-byte value from a stream absolutely should have the side effect of advancing the stream position by n.

      Comment reasoning, don’t comment behaviour

      Agreed.

      • Kdansky says:

        You’re setting a straw man on fire there. ;)

        If you only call your functions once, you obviously have not avoided any copy-paste, because there was nothing duplicate to begin with.

        If your variables need to be 50 characters long or else they are wrong, you should likely refactor the code that uses them. If you need to distinguish “uiArrayElementsNonDuplicateCount” from its WithDuplicates version, maybe you should just use a class to encapsulate that monstrosity, where you can just call it “count”.

        Query/Command: Yes, streams are one of the important exceptions. At hardware level, good OO-guidelines are usually not of much use. And streams are about as low as it gets in something high level like Java or C#.

      • When I copy and paste, I always look twice at what I just did.
        Balance and common sense are the key, just yelling that copy and paste is always evil does not help.

        This. I use copy-paste all the time, but I always read through it line-by-line immediately and make sure I understand what I just did, and caught every instance of code that needed changing. The danger is that it’s so easy to just copy the whole thing and then just glance over it. Yes it’s dangerous, but I don’t work at infinite speed, and there is a trade off somewhere.
        Point being, copy-paste coding is not an evil. It is a dangerous tool, but only because it is powerful.

      • kikito says:

        “Yes and no. For small and specialized things, that only confuses the code more by littering it with 1000 small functions that are each called only once.”

        If you really are doing 1000 small things:

        * You are not doing a “small and specialized thing” any more.
        * Those 1000 things probably don’t belong together in the same scope. Group then in classes, modules, or whatever your language has. The simplest way to do this is by looking at the parameters.

        “50+ letters variable names”

        The example on that code is just a bad design; using shorter variable names would not make it any less ugly. But I realize it’s just a joke.

        Properly naming variables is important. And difficult. As a general rule, name lengths should be inversely proportional to the frequency of use and importance.

        * A very important, frequently used class – short name: Actor, Enemy.
        * A frequently used parameter- short name: parser, x, y
        * A private method used only in one place of the code – long name: adjustCameraPathInCinematic, deleteReferencesToUnusedResources

        Again, I can’t recommend Clean Code enough for these matters.

  7. benjamin says:

    in french, a colloquial way to say cockbolck is to say “pourrir” someone, literaly “to rot” someone.

    also good to heard you still working on project frontier. give us somme news man!

  8. Andrew B says:

    It’s a good deal wordier, but I’d always use “cutting off your nose to spite your face” rather than “cock-block”. Cock-blocking is a particularly American phrase to my mind, and not one I fully understand the implications of. (Is it done by girls to guys, guys to other guys going for girls or is it unisex?) Of course, the nose/face thing does always imply harm to yourself as well as the object of your hatred, so it may not be exactly what you’re looking for. Definitely not ribald, risqué or even rude though.

    • Ingvar says:

      I had to check the Wikipedia page until I stopepd thinking the word was about male henfowl.

    • Hal says:

      There’s quite a few things available; I comment here because “cutting off your nose to spite your face” was one of the phrases I had in mind. Some others:

      -Pyrrhic victory: A victory that may as well be defeat because of its cost
      -Shooting oneself in the foot: Self-explanatory
      -Salting the earth: Conquerors used to do this to prevent crops from growing in enemy territory. Less useful if you wanted to hold the territory yourself, but a great way to spite your enemy if you were retreating or just laying waste.
      -By hook or by crook: Accomplishing something in whatever way possible, legitimately (hook) or not (crook).

      Truth be told, I think your (Shamus) definition of “cock-blocking” here isn’t too useful. The idea is generally “stopping somebody from getting something they want” when used in a non-sexual context; I’ve never understood it to take the “blocker’s” motives into account. But I’m not sure I have a perfect fit for the situation here.

      • silver Harloe says:

        indeed, when Shamus added “…even at detriment to yourself” he went way above and beyond the definition of a cock-block. In fact, swooping in to “claim the prize” (ugh. do NOT like to think of women that way, but it fits the mind-set of people who would use the term ‘cock-block’) is one way to actually perform a cock-block, and would be considered by people of that mindset to be “blocking someone else’s action to the _great benefit_ of oneself” (I’ve had enough sex to know that count of partners isn’t a benefit in and of itself, but, whatever. to people who are in the mindset, this is what it means).

      • Mephane says:

        I like “salting the earth”, it really conveys that the action is, in the long run, detrimental to everyone, even yourself, and intentionally malicious.

        • silver Harloe says:

          I don’t think the Romans felt any ill effects from salting Carthage. It’s not always to one’s own detriment, except in a global “we are the Earth” kind of new agey sense.

  9. Rem says:

    I tend to use the term ‘jockey’ when talking about cock-blocking or tactical griefing (Which makes griefing sound far too organised). Hardly similar, but still.

  10. Ayegill says:

    I see what he did there. He memorized an hour and half of talking.

    Damn.

    Also, i started to read the youtube comments. This was a mistake, and i believe i am a couple thousand brain cells poorer now.

  11. Utopiav1 says:

    It’s always fascinating to hear from the industry veterans, and there was an awful lot of dissection and discussion in Carmack’s speech. (Think he did go into post-mortem mode a couple of times :P )

    Your input was also thoroughly enjoyed Shamus, you picked up on his key points an elaborated in a way that he couldn’t at Quakcon (employer backlash at saying the wrong thing about the wrong people etc, or maybe just too in-depth for a 90 minute talk).

    Let’s hope the gameplay of Rage is as good as its technological foundations. I also really hope the modding community gets the source code for Rage a lot quicker than for Doom 3 (judging from trends and lawyers though, probably not). Those guys really need to be supported, they are literally any games biggest fans, and the stuff they churn out is usually fantastic. Really is the best reason to be a pc gamer.

  12. Aelyn says:

    So you tried to sneak that book reference in on us, but it didn’t get past all of us. Does that mean you’ve cooled off enough to start writing again?

  13. ccesarano says:

    I can personally attest to the “copy-paste” dilemma at my job, though I’d like to add REGEX as a possible way of screwing code up. I had to figure out why some code wasn’t working, and it turns out a function name being called was spelled incorrectly. Since other objects use very similar code, the person copy-pasted the line making minor changes…but never fixing the typo. I had to track every instance of it down and fix the typo.

    This has happened various times.

    When my supervisor started changing the engine/framework for our simulation, we had to change the nature in which simulated cables connect to each other. His proposal: just use REGEX to find the old code and replace it with new code.

    There were two problems with this. The first was you needed to LEARN proper REGEX in order to find all proper conditions of the code and swapping correctly without causing a disaster. It was possible, but the man hours it required were just as bad as trying to do it in a more manual manner. Secondly, even IF you used the correct search terms, it was still possible to be irresponsible and change something incorrectly.

    That was the longest couple weeks of debugging ever, because a few times we had to pore through logs in order to spot what LOOKS like a correct new change, sans ONE MINOR DETAIL that the REGEX didn’t properly catch, and the coder just find-replaced through without paying attention.

    • Kilmor says:

      Example of this(kinda): Programmer is porting code to new hardware, and having some issues with bool/BOOL defines/typedefs. So he does a global find/replace of BOOL to int, just to get something running.

      result: intEAN (from BOOLEAN).

  14. Fizban says:

    On replacements for “cock-block,” the best I can think of would be “power-block.” Literally, to try and block your opponent through sheer strength or by making it impossible for them to compete. Ends up a little more proactive, but keeps the aggressive tone of the original phrase.

    • Alexander The 1st says:

      Except “Power-Block” doesn’t really work here – it sounds more like a corporation going on a power rush to get the solution without regard to the opponent.

      The current term is intended to be offensive-relative, along the lines of griefing. Rather than trying to blot out any and all competition at any cost, it’s targeted blocking just to do it.

      Think LulzSec, only less hacking, and more Avatar main character as an Avatar alien (Na’vi? Nav’i? I’ve forgotten).

      EDIT: Or hey, just more Navi (LOZ:OOT). There, that should do it.

  15. Irridium says:

    You’ve probably already watched it, but here’s the video of the Q&A with him.

    http://www.youtube.com/watch?v=00Q9-ftiPVQ

  16. Factoid says:

    As far as making it accessible, I think you did a heck of a lot better job than Carmack did. I don’t know what the Quakecon audience is like…but I assume it’s mostly deathmatch gamers who came to play quake.

    That should have been a talk at GDC or something…where the audience has a chance in hell of understanding what he’s talking about.

  17. neminem says:

    Are you joking me? VS has never crashed on you, or corrupted any of your files? I’ve only been working with VS on a regular basis for maybe 5 years, and it’s crashed a decent amount (maybe once a month or two?), and done all kinds of crazy messed up things to files I’ve had to fix manually (mostly to the .designer files of forms/controls, which means, yes, I’m talking about C# here, not c++, but still.)

    Of course, I expect it’s still the best Windows coding IDE out there by far, I just wouldn’t call it anywhere near perfect.

    • Blake says:

      I certainly have Visual Studio crash on me periodically (C++, PC & console dev), but I’ve never seen another IDE as capable generally speaking.

      Intellisense is awful, but ‘Visual Assist X’ by ‘Whole Tomato Software’ replaces it quite nicely.

      Anyone doing C++ dev in Visual Studio without Visual Assist should really look at getting a trial version/buying Visual Assist. It is well worth the money.

      • paercebal says:

        +1 for the Visual Assist thing.

        Its most basic feature is to successfully styles every thing from keywords, method names, etc., making the code very pleasant and easy to read. Now that I’m used to it, without it, my code seems difficult to parse, as if read from notepad.

        Visual Assist is the plug-in for Visual Studio you want to try (and probably have, after trying).

        As for Visual Studio itself, I tried a lot of IDEs and no one got even near it (not even Eclipse, which is great).

  18. swimon says:

    I don’t think there’s a swedish version of cock blocking (I think we mainly just say “cock blocking”) but do we really need to change it? I mean there’s a reason it caught on. It’s straightforward for a metaphor, word efficient and the image of blocking a cock is enough to instantly put a juvenile smile on the most serious of faces (I can’t stop giggling at the moment, apparently I’m still 12 years old mentally).

    The only problem with it is that it’s rather ribald as you say. But is it really? I mean it’s so universally adopted by this point that I’m pretty sure you could use it in polite society. It’s like calling someone a silly bugger. Sure the original meaning isn’t exactly polite (it’s also rather homophobic) but by now it seems jovial and quaint like you lived in the Victorian era without the prostitutes. I’m not saying that cock blocking is there yet, but it’s well on it’s way I think.

  19. noahpocalypse says:

    I first thought it said ‘code-block’ instead of cockblock. =P How’s that as a substitute? I like it.

    EDIT: Been meaning to ask this; how do I get a custom picture? I saw an explanation somewhere, but I can’t remember where. I didn’t frequent this place yet.
    I think I always have the same picture anyway, though. I always get the guy with a monocle or something.

    • X2-Eliah says:

      You make an account with Gravatar (it’s a website), that controls your pic.

    • burningdragoon says:

      Edit: yep. As I was typing I knew someone either already had or was going to ninja me >.<

      Pretty sure the default geometry icons are unique to an email address, but anyway, if you sign up for Gravatar you can set your own icon for… um, whatever sites that it does that for. I know it works for WordPress and whatever Mumbles's blog uses (if not also WordPress)

      Handy when you want to consilidate your icons/avatars for as many sites as possible.

      • noahpocalypse says:

        Thank-yous to both of you.

        • decius says:

          More specifically, your Gravatar is based on a hash of your email, in your case 573ec1c1a29a4bcd3fcd7d995edd1ad5, and in my case 794ddc14d165c6ec425018d798ff5486 and a rating request: Shamus requests images rated PG or nicer. Some people have issues with privacy regarding the process, but none more significant than the fact that you are giving the blog owner your email and IP address by commenting.

  20. Dave says:

    The PS2 is probably the greatest console ever made (going by longevity, quality, and library size) and a proper follow-up would have been enough to continue their domination.

    The PS2 had exactly the same problems the PS3 did, albeit to a smaller degree. It also had a crazy complicated new architecture, a new media format, and Sony tried to bury its earlier-launching competition with hype that was largely unjustified. It’s just that when the PS2 launched, Sega was broke (so they couldn’t lose money on the Dreamcast very long — and they never made money with it), it wasn’t clear Nintendo was even going to stay in the non-portable business (the GameCube would launch a year after the PS2), and it wasn’t clear Microsoft was getting into the console business at all. Oh, and instead of being one of the first DVD players, the PS2 was launched about when DVD was transitioning from the videophile market to the mainstream, so DVD didn’t make the console extremely expensive. Half the reason why Krazy Ken’s PS3 design didn’t get vetoed by higher management was that it was mostly doing everything the PS2 did, except more so.

    • Brandon says:

      This is something I was itching to say when I read that statement. The PS2 is a bizarre 3D design that has very few memory caches and instead wide, fast data pathways. You cannot store texture data in reserve. You have to know what you need and when you need it so you can go fetch it RIGHT NOW, thus the wide, fast data pathways, to attempt to mitigate some of the time it takes to fetch data off the DVD.

      Truth told, between the PS2, the Xbox, and GameCube, the PS2 was the least powerful and the most difficult to design for. It had a mild flexibility advantage over the GC because the GC used fixed shaders, but the GC more than made up for that in raw power.

      The Dreamcast wasn’t more powerful than the PS2, but it was easy to develop for and had more than enough memory in all the right places. It was missing some shaders and a little poly pushing power and that was it. The Dreamcast failed because Sega Japan was in a difficult position and was unable to fully capitalize on its own fantastic creation (Sega US was actually doing fine, financially, until Sega Japan pulled the plug).

      No, the PS2 did well because Sony had built up a massive amount of political good will among developers and publishers with the PS1, not to mention mountains of cash. Sony’s PS2 was a success largely because of the inertia from the PS1 era and the relationships they developed. I would argue their difficulty pushing the PS3 was probably due at least in part to the experience devs had with the PS2. They could see that the PS3 was more of the headaches and hassles they had to fight through with the PS2 and thus were more willing to consider alternatives.

      This may all be moot because indications are that the PS3 is starting to actually outsell the Xbox 360 a little bit, this despite the PSN outage, meaning Sony’s fortunes may finally have changed, but there is still much to be determined.

  21. tengokujin says:

    EDIT: Nothing to see here, move along.

  22. Yar Kramer says:

    I actually caused a copy-and-paste bug recently! It was for player-movement in a (2D) game I’m making. I took “If the player is pressing up, Velocity.Y = -1; else if the player is pressing down, Velocity.Y = 1; otherwise, Velocity.Y = 0.” I copied this so I could do the same thing for horizontal movement aaaaaand forgot to change that last bit to “otherwise, Velocity.X = 0.”* Result: pressing left or right caused the player to increase speed exponentially until they hit the outer bounds of the game-area, and you couldn’t move vertically, only diagonally. All I can say is, I figured it out eventually …

    (*This is oversimplified, and the “if the player is pressing a particular direction” code already accounts for if they’re also holding down the opposite direction: it simply cancels out. And yes, I do have it set to normalize the player’s speed if they’re moving diagonally in order to avoid “bunny-hopping.”)

  23. I agree, Visual Studio is great, but there seems to be some problems with SP1. I recently upgraded to SP1 and have had 3 crashes in less than a day (as in Vis has stopped working and restarted itself).

    I’d also like to see C++ intellisense have the option of behaving like C# intellisense, which I find a bit more useful as an auto-complete tool. C# is a great language, and second only to Python for quickly knocking up a quick example program, but c++ has the performance which means I use that day to day.

  24. silver Harloe says:

    “people are making mistakes all the time and you have to have structures around you to help you recover from them as early as possible”

    this is something software development companies could have learned ages ago from… everybody else. The amazing juggler you just saw? Made a half-dozen mistakes you didn’t even notice because of the long practice the juggler has had in correcting for them rapidly. The flawless airline trip you just took? Probably had scores of mistakes that were corrected by the co-pilot or navigator or air-traffic controller before they became more than a second’s worth of real issue. Surgeons operate with redundant surgeons and redundant nurses, all watching the work, so that they can correct errors before they become critical. People who don’t make mistakes are non-existent. People with years of practice in recovering quickly, and people who have other people to back them up to correct their mistakes are common.

    Many software practitioners have the years of practice, assuming they care enough to look over their code rather than writing it out quickly and plugging +1s in until it works. They almost never have other programmers looking at their code soon enough to matter (even in places with regular code review, the review is when the programmer asks for it, so happens after a mistake has been in place for days or weeks and has corrupted a bunch of other code to work around it). Kent Beck once proposed a solution to this, but everyone laughed at him (after buying and reading his book and implementing none of it, which, in the end, still meant they bought the book, so who gets the last laugh there?)

    I have no solutions here. Just noise.

    • Sem says:

      You’re correct but your examples have some advantages that programming doesn’t have.

      First, in your airline example, mistakes can kill people. That’s quite a bit of pressure to provide error-correcting mechanisms. Consequently, when people make software for medical devices, planes, etc there is a lot more quality control then is standard. The most extreme example if have read was about the specifications for the control software for a space shuttle. If remember correctly, the original spec was somewhere around 16000 pages. The change requests about 30000.

      Second, in both your examples, the mistakes have a very short feedback loop. If you make a mistake it comes back immediately to slap you in face (the juggler drops his ball, the plane crashes). In software this is almost never the case. You make a mistake now, it comes back 6 months later.

      Also, because of this, in business there is a pressure to not look for mistakes. Correcting an error now costs money and time now but not correcting it only costs money and time later. In engineering there is saying : ‘Time, money, quality. Pick two.’ In software it’s the same and most managers pick the first two unfortunately.

      Third, the consequences of the mistake are for the one who makes the mistake (i.e. if the juggler makes a mistake, he drops the ball. The pilot makes a mistake, he dies in the plane crash). In programming, this is not always the case. For a lot of bugs, it’s the user who will pay the price.

      Unfortunately, I suspect decent quality control in software is still a long time off.

      • decius says:

        The juggler doesn’t make a mistake until the audience notices. The pilot doesn’t make a mistake until he loses control. The programmer doesn’t make a mistake until the software ships.

        It’s just a lot harder to avoid dropping the ball if you throw it too low, or to taxi the plane with the wheel chocks in place, or to ship software that works after only using the bottom two bytes of level*agility to calculate knife damage…

        • Sem says:

          True but my argument was that the incentives for juggler & pilot to correct their mistakes are lot higher then they are for a programmer. This also means that the incentive to make software that doesn’t do things like ‘using the bottom two bytes of level*agility to calculate knife damage’ is a lot lower.

  25. Wtrmute says:

    Ok, it was funny you didn’t comment on the scripting issue Carmack brought up. Now, you could say I’m solidly in the camp that prefers statically-typed languages to dynamically-typed ones (sorry, Python and Lua) but he’s really been talking about throwing away *all* scripting and doing everything in C++: quests, event eggs, the whole nine yards.

    Of course, he himself admits that this will make modding impossible for this game, but it also means that the scriptwriters will have to work in C++, which even I, a stalwart defender of statically-typed languages, think is ill-advised.

    Perhaps if he manages to get ID to move away from C++ and into a language which supports DSLing better like SML or Haskell or some sort of compiled LISP, then he should be able to create a DSL which the scripters can learn without too much trouble and who knows, with the magic of shared object extensions, rescue the modding scene again.

    At any rate, in C++ I think that just abandoning scripting languages for the “soft” logic in games is a bit too extreme, even for such a laudable goal as writing a program which is unable to throw an exception. Of course, the graphics driver can still throw exceptions, so we won’t be seeing absolutely zero exceptions on the PC anyway.

    • kikito says:

      Well I’m in *love* with dynamic languages, and if someone else was saying what he says, I’d agree with you.

      But he’s Carmack.

      I don’t usually use authority arguments but… he’s Carmack.

      I agree with the part of “someone who doesn’t know programming should not be programming”. Even if someone else specifies what a script should do, the script should be written by a real programmer.

  26. Alexander The 1st says:

    “What I want to be working towards is a case where we can say, the game cannot… uh… cannot have an exception.”

    You know, that reminds me of the console (portable/household) market; I’ve seriously never remember getting an exception on a console.

    Sure, there were a *few* bugs, but never a full out exception error. And the only time it froze/crashed was when the game was taken out mid gameplay.

  27. ps238principal says:

    When has Sony not tried to rooster-cube the competition? They try to use proprietary formats and hardware whenever possible, even when it bites them in the end (hi, Betamax!). It seems they value being able to get licensing fees and prevent anyone from easily figuring out their architecture over providing a usable (both for consumer and dev) end product.

  28. MaxDZ8 says:

    Some months ago I was speaking to a guy which got into computers “more or less when Pentium 4 came out”. This is a lot of time around here. I’ve been around since 486 (386 is stretching it).
    Those guys have no chance to understand the intricacies involved with computer architectures.

    I have spent great amounts of time trying to explain my friends why setting the texture detail slider to max and then playing 1024×768 is complete BS. AFAIK, they still don’t get it… not that this matters, since this resolution can now be crammed into a mobile device.

  29. Dragomok says:

    I would really, really, REALLY thank you for pointing that amazing video I – and perhaps a bunch of other people – would otherwise miss.

    On a side note: is it me or was Carmack really getting more and more handsome as he talked? This is a serious question: for me he was looking way better at the end of the video than near the beginning.

    • GabrielMobius says:

      That is a simple matter of your brain perceiving his sexy, sexy intelligence and adding layers of attractiveness to him as it did. It’s quite an interesting phenomenon.

    • Spectralist says:

      Could be the microphone and chair. When he was just standing there talking into his headset mic he seemed kind of awkward like he didn’t know what to do with his hands/what posture to assume. The hand held mic they gave him really helped and the chair helped again later.

  30. Slade says:

    many companies have been bit my the RISK architecture. The idea of having two kind of processors is novel; because they could in theory compliment each other. But it seems in the case of sony, it just raises the complexity of development.

    I’m Kind of curious how the game industry is going to handle the added complexity in gaming. For instance will more games adopt pre made libraries to reduce their development cycle? The force unleashed comes to mind; They took a pre made physics system, combined with with a pre made rag doll system, and added a pre made material emulation system.

    As it stands many companies are already use to licensing technologies. They do it for audio playback, video playback, extra. Many of these technologies try to simplify development; by removing the number of hours arts, programers, level designers, animators, extra need to spend on creating content.

    • Alexander The 1st says:

      As it stands many companies are already use to licensing technologies. They do it for audio playback, video playback, extra. Many of these technologies try to simplify development; by removing the number of hours arts, programmers, level designers, animators, extra need to spend on creating content.

      Of course, it doesn’t reduce costs. <_<

  31. Zaghadka says:

    What Sony did: Legal positioning.

    It’s as if their corporate mission is positioning products, rather than developing them.

    Thus: “Missionary positioning” the competition. Let’s hope they don’t pull out of the market too soon.

    Better? ;)

    • Alexander The 1st says:

      Well, at least it can be used around children, because then parents can explain missionaries who come to places to convert people.

      Unfortunate implications aside. <_<

  32. Atle says:

    Two good things about Blu-Ray:
    1. More diversity in the levels (Could Uncharted or Heavy Rain or Little bug Planet fit on a DVD or two?)
    2. Watching movies.

  33. El Quia says:

    (Aside: We really need a less ribald idiom for “cock-blocking”: To frustrate or hinder a rival, even to one’s own disadvantage. To childishly destroy to prevent the success of another out of envy or spite. A kind of griefing. I know English is a second language for some of you, so I’ll ask: Do any other languages have one we can steal borrow?)

    Here in my country we have the expression “Escupir el asado”, that can be translated to “spit (someone else’s) barbecue”. So, instead of saying that A cock-blocked B, we say that A spitted on B’s barbecue. I think it complies with all your specifications and it has the added advantage that instead of trying to force a foreign language word on the person you are talking about (and, in consequence, forcing you to explain/translate it), it provides a graphical description of an action that clearly explains itself, specially when the context provides additional details :D

    The part that maybe doesn’t get across clearly is the “even to one’s own disadvantage”. But, unless I am mistaken, the expression is used in the sense of the other person being the cook. So, in spitting his barbecue, you are spitting on the barbecue you are going to eat from :P

  34. Regarding “cock-blocking”, does “dog in the manger” have a verb form?

  35. Andrey says:

    John Carmack mentions in report PVS-Studio tool. PVS-Studio is a static analyzer that detects errors in source code of C/C++/C++0x applications. There are 3 sets of rules included into PVS-Studio:

    1.Diagnosis of 64-bit errors (Viva64)

    2.Diagnosis of parallel errors (VivaMP)

    3.General-purpose diagnosis

    Download page: http://www.viva64.com/en/pvs-studio-download/

    Free keys for open-source projects: http://www.viva64.com/en/b/0092/

    P.S. This code

    new_position.x = player_position.x + movement.x;
    new_position.y = player_position.y + movement.y;
    new_position.z = player_position.z + movement.z;
    

    is related to V525 and V537.

  36. Jaco says:

    Regarding the ‘cock-block’, I would just say ‘spite’. It really fits pretty well.

  37. JasonD says:

    “Games… exponentially taking longer… Right now, Carmack is the only one saying it. (Or at least, the only one formulating a plan.)”

    Will Wright, creator of the sims and spore, lives and preaches this knowledge. Pointed-out 10 and 8 and 6 years ago… (Solution at the end.)

    Everyone who is failing, is talking about it… (Not that they will fail as a business, they are failing at attempting to manage the unmanageable, using compounded unmanageable back-ends.)

    Translation, they created the problems they are facing. They are the creators. The industry is misinterpreting our misinterpreted desires…

    (We only think we want miles of land. Really, we just don’t want monorail-entertainment, and we think it will be neat to demand things like “unlimited everything”.)

    Just as they are inevitably making it more difficult to obtain, using primitively and unnecessarily complex layers of bad code…

    (Not bad because it was programmed wrong, it is just the “old way” or the “only way”, or the “best way”, that they “KNEW”. 1,000,000 lines of code, you don’t re-write them all, even if that is what is actually needed. Not including the millions of lines of assistive code, known as GL, DX, MSOS, LINUX, and other drivers.)

    The market is taking a turn, and has been for a while. We just don’t realize it. Just as I have been led here, doing similar programming, the solutions are under our fingers.

    The solution:

    Dynamic repeatable content creation, user-sub-creators (Like second-life and modders and IMVU), and a new universal or specific standardized language which includes direct standardized hardware control.

    Like he said… We only “think” or assume, how code actually works, because of past knowledge of how it once worked. The reality is, most new coding devices use “hacks”, to make them simulate what they once did, using simple code, with newer “safe” code in place of the faster code that once ran the hardware.

    The few things that EVERY game developer has ever asked for, and never gotten… Real timers, and real feedback-returns, and true direct memory access. Timers are a suggestion, feedback is programmatically collected by timer-watching and buffers, and DMA is all virtual “safe” managed, even when you think it is not.

    Real timers with settable return-triggers are NEEDED for true game micro-management. Real feedback-returns are needed for true INPUT CONTROL TRIGGERS, as opposed to overly complex hack-code, still resulting in pseudo-responses and wasted processing. DMA, well, we all need real memory control that is truly direct. Memory pipes and memory allocation that is 100% managed, unless that is not desired. It isn’t even an option. One language, that works, one way, for everything. No more reinventing the mouse-wheel, for every game, for every user, for every version of sub-branch of code. If only for the most basic and most overly complex things. Leave the programming demands to content manipulation, not display, input, sound, base-3D, etc… Mapping, lighting, extended 3D, after effects, game-flow… those should be the only concerns of those who have not already programmed them once.

Leave a Reply

Comments are moderated and may not be posted immediately. Required fields are marked *

*
*

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun.

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a> on Wikipedia!