Let’s Code, Part 2

By Shamus Posted Tuesday Nov 30, 2010

Filed under: Links 37 comments

Part 2 of Michael Goodfellow’s game-building series is now available. He’s tweaking the site in response to feedback, adding RSS feed, making clear the goals of the project, and generally learning to blog while making a game.

This week he’s working on collision detection, one of my weak areas. (My other major weakness is animating skeletal meshes – making characters walk and such. Hate that stuff. It’s one of those jobs that is hard to break down into manageable bits of complexity.) It’s difficult to get it working, and even harder to get it really, truly right. A slight misstep can burn a ton of precious CPU time, and no matter how long I work on it or how well it works I’m always left with the nagging impression that I’m probably missing something.

 


From The Archives:
 

37 thoughts on “Let’s Code, Part 2

  1. Klay F. says:

    It really is amazing how may AAA games get collision detection completely and totally wrong. *coughbethesdacough*

    EDIT: Thinking out loud about Bethesda: I recall in Fallout 3 that I was never able to shoot through the chain link fences in real time, but switching to VATS I was able to shoot through them 100% of the time (unless of course I was using something huge like the missile launcher.

    1. Cineris says:

      *coughEverySourceEngineGamecough*

      1. Will says:

        The source engine is a dinosaur, it speaks wonders about just how talented Valve’s guys are that they can produce a game like Half Life 2 on an engine as horrid as source.

      2. BKiesel says:

        The clipping soldier ragdoll shown in the article is not a class A bug by any stretch. As a purely cosmetic clipping issue, it is a class C issue. Even if the ragdoll was to get stuck and be irretrievable, it would only be a class B issue when the player has the gravity gun, and only marginally because the ragdolls can be used as projectiles, which would be a loss of ammo that could effect gameplay.

        @Cineris
        The source engine collision detection is done with a customized version of Havok, which is generally considered one of the BETTER methods. Also the source engine requires airtight level geometry which prevents objects and players from falling through the floor, which is a major issue I have encountered in other games.

        @will
        The source engine gets a new version with additional features every time a major title is released. Don’t confuse engine functionality with toolset functionality. (The toolset is admittedly archaic and difficult to use.)

        1. MichaelG says:

          I meant it was a bug in a class A game, not a class A bug in the game. I agree, it’s harmless. And not that easy to provoke, either.

          Darn that English language!

        2. Cineris says:

          Unless I’m mistaken Havok only controls specific physics entities in Source games. The problem Source has with collision detection is not, “Oh that ragdoll is embedded in the geometry,” it’s, “My character just passed through your character without colliding at all,” or “Your gun just shot bullets that somehow managed to curve around the 90 degree solid adamantium wall I just ducked behind.”

          Which may be a different sort of collision detection than whether or not a model’s arm clips into pieces of another model. But I’d argue it’s a lot more important. One is for the most part, a visual “niceness” issue, whereas the other is an issue with the reliability of what you see on the screen as a representation of the actual game state.

    2. Robyrt says:

      When Capcom was developing Street Fighter 4, the first 3D iteration of the series, they had an extremely accurate collision detection model, but kept getting complaints that the game “didn’t feel right” or “hits didn’t register”. So they switched to their 2D system from 1991 – literally, 4 rectangles per character moving around at 30fps, with no overlap allowed – and everybody was happy.

      It turns out Street Fighter’s exaggerated, effects-heavy animation style actually needs a big fudge factor to behave properly.

  2. Phoenix says:

    Very interesting series. This always makes me wish I could do some programming… ;)
    I’m also looking forward to the next part of your own “lets code!”

  3. Ingvar says:

    I had to knock up some (simple) collision detection for my “tank game” (you have a driver’s view from a futuristic hver tank, drive around an infinite plain and shoot other tanks and avoid shells and geometric shapes plopped onto the infinite plain).

    And, in case someone wants to see the code, here’s a link.

    However, I didn’t use an existing 3D API, but cooked one all of my own, using X11 as the back-end. I probably should re-implement it in OpenGL, I guess.

  4. kikito says:

    rss = win.

    Now I can keep track of it without reading twentysided

    (Not gonna happen :) )

  5. SolkaTruesilver says:

    Not to sound pedantic or [other arrogant-smartass related adjective], Shamus, but why would you want to program collision/walk animation if you hate it to begin with?

    I mean, there are many games concepts that wouldn’t need you to be remotely close to that kind of programming… :-) 4X games, to start. Basic RPGs.

    1. X2-Eliah says:

      It’s not really Shamus doing the coding, now, and sometimes you just got to have that thing.

    2. Shamus says:

      Because it was my job. My boss was never really all that receptive to the “but I don’t like doing that” argument. What a meanie.

      When your company is smaller than a baseball team, you can’t be too picky about the work you’re given. :)

      1. SolkaTruesilver says:

        Ohh..

        I was still thinking in the whole “Shamus is making a game for the fun of it”.

        Nevermind!

        /humiliation

        1. Aldowyn says:

          remember, we have no clue what Hex is going to be! :D

  6. Kdansky says:

    Am I the only one who isn’t thrilled that you write a post telling me that my RSS feed had a new item yesterday (which I have already read)? It’s the same with your Escapist-projects. If I put those in my reader, I’ll have to deal with getting them twice (once there, once here), but if I don’t, you sometimes forget and then I do not get them at all.

    Either way, just trusting your reader base to check other pages themselves would be easier. I don’t understand why you go through the hassle of playing TV announcer. Those don’t exist any more for a reason.

    1. Jarenth says:

      Don’t forget that posting the links here allows the Twenty Sided community to make its jokes and comments hére, and not over at the Escapist. Which I hear is not a particularly pleasant place to hang out.

      1. psivamp says:

        I don’t know if the Escapist is a *bad* place, but it’s a bigger place with a broader audience than Twenty-Sided.

        1. Rosseloh says:

          Have you read some of their comment threads?

          I try not to but every once-in-a-while one gets through my brain filter, and I’m dumbstruck for several days afterward.

          1. Sagretti says:

            Heck, my brain starts crossing wires after just accidentally glancing at the “latest forum threads” box. If it wasn’t for Shamus’s articles, I wouldn’t even touch the site with a ten foot pole. Course, I stay away from most non-specific gaming websites these days for the same general reason.

            1. Galad says:

              wow, guys, it’s not *THAT* bad..Sure, I glance over the comments most of the time reading no more than a dozen, but still..

    2. Eroen says:

      But some of us still like our TV announced and pre-digested, which we so rarely see on actual TV (except for close to the various traditional programming during national celebrations and such).

      Also, a separate comments thread with friendly and familiar nicks is an extra bonus!

    3. Abnaxis says:

      Thirded. I like the posts here, because I jump computers a lot, and am too lazy to be buggered with setting up a feed for every one of them.

      1. Simon Buchan says:

        reader.google.com

    4. Shamus says:

      Lots of people don’t user RSS readers. (I don’t.)

      And he didn’t HAVE an RSS feed last time I linked him.

      I link the Escapist stuff here because you can comment here without making an account, which lots of people are reluctant to do.

      1. krellen says:

        I don’t use RSS readers either, so I thank you for continuing to keep me up-to-date on the “things Shamus is up to or interested in” department.

      2. Alan De Smet says:

        I appreciate having Twenty Sided be my one-stop shop for all Shamus and Shamus-Related products!

      3. Kdansky says:

        And some people do not have computers, yet you don’t send them printed copies. Keeping up to date is everyone’s responsibility, not yours. I recommend google reader. After starting to use it, I wonder how I ever got by without.

        He added an RSS feed very early to his page, only a day or two after you linked it. But that is a valid point still.

        I also like to be able to comment here, I don’t even have an Escapist account, and I don’t think I’ll get one. Too many childish mouth-breathers. May I suggest that you make a weekly round-up post of all your stuff (or other stuff you want to show us and don’t have time to write a billion paragraphs on), a bit like Sunday Papers on RPS? I would enjoy that very much I have to say.

        1. Shamus says:

          You are seriously suggesting I change my blogging habits and posting schedule, and then adopt a feed reader myself, and give up the traffic from all the non-RSS folks you see above, just so you don’t have an extra entry in your feed now and again?

          If sending out paper copies was free, effortless, and gained readers, then yeah, I’d do that too.

          1. Corran says:

            Hmm. Your ideas are intriguing to me and I wish to subscribe to your newsletter.

            I’d like to add my two cents (not that they are needed) for Shamus to keep doing exactly what he is doing.

            I like reading the comments here even for stuff that’s published on the Escapist.

            And I want to thank Shamus for giving us all this great content week in, week out. Here’s hoping it may long continue!

    5. Ingvar M says:

      To voice a different opinion, I have Twenty-sided in my feed because I want to read what Shamus does. I am not, particularly, interested in what the Escapist published in so far that it differs from “what Shamus does”, so for me these types of posts have some value (both from a “look, more!” and from a “I can see what other readers of twentysided say about this” view).

      However, I can see your point.

  7. Abnaxis says:

    I read this article, and kept thinking, “but…but you have a square grid! You could do it so much easier!”

    Of course, everything I thought of only works in cube-land, so if Michael is really serious about leaving cube land, they wouldn’t work, but still…going through so much effort for something that seems (to me) simple hurts my eyes.

  8. Christopher M says:

    Yay for RTS! Where a simple array can suffice!

  9. Thom (talzaroff) says:

    Interesting to read! Notice he “stole” your game name: Craft of CraftCraft? ;)

    1. MichaelG says:

      With permission!

  10. Neil Polenske says:

    You mean rigging the skeleton FOR animation or the actual animation?

  11. Simon Buchan says:

    Interesting comment on skeletal animation. I’m going to be doing that sometime in the next year (I hope!) on my own engine, so I’d be interested to know what pain points you’ve run into. The rendering side seems pretty simple: throw a matrix array at the vertex shader, so I assume you are referring to the “driving” of the joints? Or is this a higher level issue of the animation/controller(/physics) loop, which I believe *everyone* has problems figuring out the balance for?

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun. Your email address will not be published. Required fields are marked*

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!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>

Leave a Reply to Shamus Cancel reply

Your email address will not be published.