Gez
Why don't I have a custom title by now?!
Posts: 11202
Registered: 0707 
The binary & operator only gives 1 if both bits are 1. 7 is 111, so the only possible results from a random byte & 7 are in the range from 000 to 111, so 0 to 7 in decimal. Then you add 1, which makes it between 1 and 8. And finally you multiply by 3, 4 or whatever other value.
So, a comparison table:
code:
PC Jaguar
Zombieman: 3x1d5 3x1d8
Shotgun Guy: 3x1d5 3x1d8
Imp scratch: 3x1d8 3x1d8
Demon bite: 4x1d10 4x1d8
Cacodemon bite: 10x1d6 8x1d8
Baron scratch: 10x1d8 11x1d8
The shift operator multiplies (<<) or divides (>>) by a power of two.
code:
PC Jaguar
Melee: 2x1d10 3x1d8
Guns: 5x1d3 4x1d4
Using theoretical average (where each value of the virtual dice has an equal chance of coming up), the average result of a die is the sum of its possible results divided by the number of "sides".
1d3: 6/3 = 2
1d4: 10/4 = 2.5
1d5: 15/5 = 3
1d6: 21/6 = 3.5
1d8: 36/8 = 4.5
1d10: 55/10 = 5.5
In practice, each result does not have an equal chance of coming up but I don't feel like making full fledged analysis of the random number generators used.
So a gun pellet deals between 5 and 15 damage, with an average of 10, on PC; and between 4 and 16, with an average of 10, on Jaguar. Punch and chainsaw deal between 2 and 20, with an average of 11, on the PC; and on the Jaguar it's between 3 and 24 with an average of 13.5.
Monster attacks, by the same token:
Zombieman: PC: 315 (avg 9); Jag: 324 (avg 13.5)
Shotgun Guy: PC: 315 (avg 9); Jag: 324 (avg 13.5)
Imp scratch: Both: 324 (avg 13.5)
Demon bite: PC: 440 (avg 22); Jag: 432 (avg 18)
Cacodemon bite: PC: 1060 (avg 35); Jag: 864 (avg 36)
Baron scratch: 1080 (avg 45); Jag: 1188 (avg 49.5)
Now for missile damage formula... It's in the collision code.
PC:
code: // damage / explode
damage = ((P_Random()%8)+1)*tmthing>info>damage;
P_DamageMobj (thing, tmthing, tmthing>target, damage);
Jaguar:
code:
damage = ((P_Random()&7)+1)*thing>info>damage;
P_DamageMobj (latchedmovething, thing, thing>target, damage);
That is pretty much the same, though. Modulating by a power of two is the same as &masking by that power of two minus 1. So all that remains to compare is the damage value for the various projectiles.
Lost Soul: both 3
Imp shot: both 3
Caco shot: both 5
Baron shot: both 8
Rocket: both 20
Plasma: both 5
BFG main shot: both 100
The released Jaguar source code doesn't feature the Doom II actors.
Last edited by Gez on 071612 at 11:51
