Difference between revisions of "Talk:Pain state"

From DoomWiki.org

(Added explanation)
(Explanation)
Line 27: Line 27:
 
Pain chance is an 8-bit variable. That's 256 possibilities, from 0 to 255. 255 = 100%.
 
Pain chance is an 8-bit variable. That's 256 possibilities, from 0 to 255. 255 = 100%.
 
--[[Special:Contributions/162.123.17.80|162.123.17.80]] 16:33, 9 January 2009 (UTC)Jared
 
--[[Special:Contributions/162.123.17.80|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. --[[User:Reaper with no name|Reaper with no name]] 17:05, 12 January 2009 (UTC)

Revision as of 12:05, 12 January 2009

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)