Jump to content

  • Log In with Google      Sign In   
  • Create Account


mike3

Member Since 06 Feb 2012
Offline Last Active Dec 26 2013 02:44 AM

#5086964 Programming origin of (bug? feature?) in old game ("Duke Nukem 3D")

Posted by mike3 on 18 August 2013 - 12:28 AM

I just got the code from the 3D Realms website and had a look. I believe your hypothesis is in fact correct.

 

I discovered the following code segment in the routine "processinput" in PLAYER.C:

    psect = p->cursectnum;
    if(psect == -1) /* hypothesis: this means "out of range" sector */
    {
        if(s->extra > 0 && ud.clipping == 0) /* "clipping == 0" = no clipping? I note this variable is modified by the noclip cheat */
        {
            quickkill(p); /* kill the player */
            spritesound(SQUISHED,pi);
        }
        psect = 0;
    }

(Comments added by me -- this code has pretty much no comments)

 

It looks to be exactly what you said. To check if the player is out of range, and kill them if that is the case. A failsafe, just as you thought.

 

There also appear to be a few other checks that look like this one.

 

Thanks for the suggestion!




#5086955 Programming origin of (bug? feature?) in old game ("Duke Nukem 3D")

Posted by mike3 on 17 August 2013 - 10:59 PM

Hi.

 

(I'm posting this here because to me it seems game-programming related, but if you think it should be elsewhere, you can move it)

I saw this on Wikipedia:

 

http://en.wikipedia.org/wiki/Noclip_mode

 

 

No-clipping can conflict with other elements of the game. For instance, in Duke Nukem 3D, and the Commander Keen series, having no-clip and walking outside the level area causes death, and if the player has god mode activated the game will be left in an infinite loop or crash due to the way god mode was implemented. In most source ports for Duke Nukem 3D, this problem is corrected and it instead behaves more like Doom.

 

 

I'm curious about this. Now, Duke Nukem 3D's source code has apparently been released under free license (GPL), so I suppose one could dig through it and/or run experiments, though I don't feel like doing it right now. What would cause this phenomenon (namely that going out of the level in "noclip" mode kills you), from a programming point of view? As it doesn't seem at first obvious that this kind of thing would occur.




PARTNERS