Combat_d.c

Game engine, mechanics, coding

Moderators: avatar, creator

Post Reply
odin
Posts: 109
Joined: 29 Jul 2019, 14:17

Combat_d.c

Post by odin » 30 Apr 2020, 19:19

Line 1023 is this: prof += (random(30) - random(30));

Basically it's an arbitrary method of giving between -29% damage to +29% damage.

Anyone got a good explanation why its in there?

uriel
Posts: 54
Joined: 20 Aug 2019, 05:09

Re: Combat_d.c

Post by uriel » 01 May 2020, 20:37

odin wrote:
30 Apr 2020, 19:19

Line 1023 is this: prof += (random(30) - random(30));

Basically it's an arbitrary method of giving between -29% damage to +29% damage.

Anyone got a good explanation why its in there?

TL;DR - this basically meaningless code snippet that wastes cycles. Speculatively someone wanted more "randomness" with poor understanding of how to do that :P

Long answer -- Because nobody can accuse SG wizzes of being good at math :) The combat code is duck taped together with one-off fixes and should probably get a rewrite from scratch.

Specifically to your question:
1d6 has an average of 3.5 and a standard deviation of 1.7.
Modified with the prof += (random(30) - random(30)),... the average is 3.0 and a standard deviation of 1.8.
Why?? because when the proficiency is 70% * a roll of 1 = 0.7 which is rounded down to 0.

1d100 has an average of 50.50 and a standard deviation of 28.87
Modified with the prof += (random(30) - random(30)),... the average is 50.05 and a standard deviation of 29.74.

Suggestion -- just pull it out, it wastes cycles and doesn't accomplish anything meaningful.

Post Reply