Talk:Pain state

From DoomWiki.org

Revision as of 19:16, 12 January 2009 by Ryan W (talk | contribs) (Explanation)

This article needs information on pain threshold. See Quasar's note here.

100% pain chance

According to Dehacked (and the respective actor's entries here on the wiki), the player and Romero's head all have 255 pain chance. This is translated to 100%. But something is wrong. As I understand, pain chance is out of 256, which would mean that 255 pain chance would translate to 99.61%, not 100%. However, if we assume that pain chance is actually out of 255, then that throws off every other pain chance calculation. Examples:

  • Arachnotron: 128 pain chance
    • (128*100)/256=50% (agrees with wiki)
    • (128*100)/255=50.20% (doesn't agree with wiki)
  • Mancubus: 80 pain chance
    • (80*100)/256=31.25% (agrees with wiki)
    • (80*100)/255=31.37% (doesn't agree with wiki)

I could go on, but you get the idea. If pain chance is really out of 256 and not 255, then the real pain% for the player and Romero's head is (255*100)/256=99.61%. --Reaper with no name 04:33, 31 December 2008 (UTC)

Very sensible.  According to the article, this is where an actor does or does not enter its pain state (from P_DamageMobj):
   if ( (P_Random () < target->info->painchance)
        && !(target->flags&MF_SKULLFLY) )
   {
       target->flags |= MF_JUSTHIT;        // fight back!
       
       P_SetMobjState (target, target->info->painstate);
   }
Therefore, AFAICT, what "255" really means is "what fraction of the entries in m_random.c are below 255?".  The answer is 255/256 ≈ 99.61%.  For "80" it would be 79/256 ≈ 30.86%.    Ryan W 20:18, 8 January 2009 (UTC)

Explanation

Pain chance is an 8-bit variable. That's 256 possibilities, from 0 to 255. 255 = 100%. --162.123.17.80 16:33, 9 January 2009 (UTC)Jared

I thought about that, but according to Dehacked, the Lost Soul has 256 pain chance. That's what makes me think it's unlikely, unless Dehacked messed it up somehow. But if pain chance is out of 255, then there's going to have be a lot of recalculation for all the monster's pain %'s. --Reaper with no name 17:05, 12 January 2009 (UTC)
"A lot"?  Surely the wiki doesn't use these numbers anywhere besides the data tables in the monster articles.  I'll be glad to redo those myself if we can agree on what the mistake is.  :>   Our tables seem to have been added originally by User:CyRaptor who I assume is long gone.  However, in the source code, you can read the pain chance numbers (used in the excerpt above) from info.c.  Romero's head indeed has 255, which means that your analysis is testable: for example, one could make a custom PWAD + demo in which Romero's head is hit by a pistol shot and doesn't react.    Ryan W 00:16, 13 January 2009 (UTC)