Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

2026 Participants: Martin Bartelmus * David M. Berry * Alan Blackwell * Gregory Bringman * David Cao * Claire Carroll * Sean Cho Ayres * Hunmin Choi * Jongchan Choi * Lyr Colin * Dan Cox * Christina Cuneo * Orla Delaney * Adrian Demleitner * Pierre Depaz * Mehulkumar Desai * Ranjodh Singh Dhaliwal * Koundinya Dhulipalla * Kevin Driscoll * Iain Emsley * Michael Falk * Leonardo Flores * Jordan Freitas * Aide Violeta Fuentes Barron * Erika Fülöp * Tiffany Fung * Sarah Groff Hennigh-Palermo * Gregor Große-Bölting * Zachary Horton * Dennis Jerz * Joey Jones * Titaÿna Kauffmann * Haley Kinsler * Todd Millstein * Charu Maithani * Judy Malloy * Eon Meridian * Luis Navarro * Collier Nogues * Stefano Penge * Marta Perez-Campos * Arpita Rathod * Abby Rinaldi * Ari Schlesinger * Carly Schnitzler * Arthur Schwarz * Haerin Shin * Jongbeen Song * Harlin/Hayley Steele * Daniel Temkin * Zach Whalen * Zijian Xia * Waliya Yohanna * Zachary Mann
CCSWG 2026 is coordinated by Lyr Colin-Pacheco (USC), Jeremy Douglass (UCSB), and Mark C. Marino (USC). Sponsored by the Humanities and Critical Code Studies Lab (USC), the Transcriptions Lab (UCSB), and the Digital Arts and Humanities Commons (UCSB).

[Code Critique] NBA Jam Source Code - Bulls can't beat the Pistons in the last five seconds

I stumbled into this on Instagram and then ended up down a rabbit hole, but the creator of the video game NBA Jam was a massive Pistons fan and was bitter about how good the Bulls were. He says he wrote code that would prevent the Bulls from making a game-winning shot in the last five seconds of the game.

I have started digging through the code but haven't found this spot in the code just yet. I thought this crew would likely be able to find it quickly! But there's other really interesting things in this code as well - the designers built themselves into the game, and there a number of other cool nuggets in there too.

I can't post a code snippet here because I don't know where this moment in the code is, but once we find it maybe we can edit this post?

Source Code on GitHub (in Assembly):
https://github.com/historicalsource/nba-jam

Turmell Talking about it here:

GDC Presentation by Turmell where he mentions it (but doesn't point to code):

Comments

  • A couple of initial thoughts:

    1) This may just be a version of the code that doesn't have this function in it.

    2) It seems that searching for mentions of "brick" might be useful, given that Turmell says that what he did was increase the chances of a last-second shot by the Bulls agains the Pistons being a brick. I have found mention of a #nobrick function that decreases the chances of a shot being a brick...but that's all at this point.

  • The player.asm file has the following comment:

    * 1. If 4th or overtime qrtr has 5 seconds or less remaining and
    *
    *   a. If score is already tied or I am ahead, do nothing.
    *   b. This shot (2 or 3) would tie the score, then make it go in 75% of
    *      the time.  (Regardless of shot distance)
    *   c. This shot (2 or 3) would win the game, then make it go in at
    *      least 30% of the time (Close in would be higher, but even bombs
    *      go in 30%)
    *   d. If this shot would pull me to within 1/2 points, then make it go
    *      in 90% of the time for max excitement without putting him ahead.
    

    The code is:

    #nomis
        move    @game_time,a1,L
        cmpi    >400,a1         ;!!! ;Last seconds of qrtr?
        jrgt    #nohelp         ; br=no
        move    @gmqrtr,a3
    
    move    a2,a0           ;Game tied?
    jrnz    #notie          ; br=no
    
    subk    3,a3            ;In 4th qrtr or OT?
    jrlt    #nohelp         ; br=no
    movi    50,a9           ;!!! ;Last second shot of a tie game
    jruc    #nohelp         ; should almost never go in
    

    This suggests that a last second shot of a tie game should almost never go in, regardless of the teams playing...

  • edited February 2024

    I'm just starting to look through this code but this little passage from MAIN.ASM jumped out at me for its colorful comments:

        .if IMGVIEW
    ;Allow me to exit TV and go into IT to tweak these mofo's
        PUSH    a14
        movi    SYSCINIT,a14
        xori    02000h,a14
        move    a14,@SYSCTRL
        ori 02000h,a14
        move    a14,@SYSCTRL
        PULL    a14
        eint
        reti
        .endif
    

    Not what we're looking for, but evidence of some lockerroom atmostphere in the development space. Of course, it's easiest to take on the comments first. Plunging deeper...

  • There's a bunch of that stuff in there, Mark. Definitely worth digging into.

    I have a hunch that Turmell is telling stories (some youtube commenters think this too). It reminds me a bit of Pat LeMieux's work on Super Mario Clouds.

  • That makes me feel better, @jamesjbrown I spent the day pouring over this code and found little more than what you did. I mean he does have his fingers on the scales of the players, though not unjustly perhaps...

    PLYR.ASM includes this:

    ;FIX!!  This should also do an adjustment based on who it is and how good
    ;they are at 3 ptrs!  Hill doesn't even shoot 'em!  Rodman should be a 0!
    ;Store another flag for guys who don't even shoot them...
    

    But again, stats might back that up and it is not 4th quarter dependent.

  • edited February 2024

    Also based on this comment, the bias against the Bulls, might really just be the bias against anyone taking last minute shots, as in the code you've found. Quoting from this article:

    According to the lead designer and programmer Mark Turmell, that is by design. If you’re a the Chicago Bulls and you’re in a close game against the Detroit Pistons, you’re going to miss the last shot. That’s because Turmell who grew up in Michigan, is a Pistons fan. After decades of speculation, he admitted t it to Ars Technica in their ‘War Stores’ video about the legendary NBA game. “If the Bulls were taking a last-second shot agains the Pistons, it would miss those shots.”

    So it's not just about the Bulls, but any team trying to do that. And now I'm thinking about all of MJ's game winning, last-minute shots for the Bulls in the years around the release of this game.

Sign In or Register to comment.