Maes
I like big butts!

Posts: 10202
Registered: 07-06 |
I went through GhostlyDeath's code analysis, and tried to count the actual number of calls to P_Random() per pellet on every possible code branch (assuming that they're all there):
- Hitting nothing: 3 calls, base case.
- Hitting a wall, with puffs: 7 calls (base case + 4)
- Hitting a shootable object that spawns blood or puffs: 7 calls (base case + 4)
- In addition to hitting a shootable object the "inflictor" condition applies: 1 extra call, 8 total.
- If the object is to be damaged:
there's 1 extra call if it survives for pain chance,
or 2 calls if it dies and spawns an object (if I understood correctly). Therefore 9 and 10 calls total, respectively
Therefore, the maximum number of calls is 10, and the possible subcases are only 3,7,8, ,9 and 10.
Of those, only some can lead to actual damage to actual monsters, with 9 and 10 calls respectively.
I made a small Java program to test the cumulative damage of 7 pellets by using the P_Random() table for damage (first call) with added bogus calls to simulate angle computations and the other code paths. This was repeated for ALL 256 possible starting indexes in the P_Random() table, and for all 3, 7,8,9 and 10 call subcases.
My summary results were:
3 calls: when you hit NOTHING, not even walls.
- MIN: 45
- AVG: 72.46
- MAX: 100
7 calls: when you hit walls or stuff that bleeds/puffs but is not damaged.
- MIN: 45
- AVG: 72.46
- MAX: 105 <-- Pointless, since it can't be dealt!
8 calls: when a weird "inflictor" condition applies, but the object can't be damaged afterwards, OR when it can be damaged, doesn't die, but "inflictor" doesn't apply OR when it dies and doesn't drop anything and "inflictor" doesn't apply.
- MIN: 45
- AVG: 72.46
- MAX: 100
9 calls: can occur when "inflictor" occurs AND target is damaged but doesn't die, OR when inflictor DOESN'T occur but target dies AND spawns object.
- MIN: 50 (Ha!)
- AVG: 72.46
- MAX: 100
10 calls: can occur when "inflictor" occurs AND target dies AND drops objects.
- MIN: 50 (Ha!)
- AVG: 72.46
- MAX: 95
So what does this mean? A round 100 damage to a single target IS possible in cases of 8 and 9 calls , but as you will see in the distribution histograms I'll publish later, the chances for this happening are 4/256 for 8 calls, and 1/256 for 9 calls. Dealing 105 damage vs damageable objects is impossible. You'll be glad to know the minimum damage is 50 and not 45 though ;-)
When a player is shooting a lost soul in full health with a shotgun, all cases except the last one will fall within the "8 calls" subcase, but the last call to P_Gunshot will yield 9 calls.
So that leaves you with a 4/256 or about 1/64 chance for a 1-hit kill vs a lost soul, if I did the math right. Boy, what a mouthful :-p
The 105 damage occurrence can only occur with a 2/256 chance only vs...solid walls. Poor wall, but lucky monsters :-p
Update:
All rise, all rise, here's the One and Only Ultimate Doom Shotgun Anal-ysis.
Includes compiled Excel file with data and graphs, and Java source for the simulation.
Last edited by Maes on 03-16-10 at 22:58
|