Shadowrun: Awakened Forums Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
  Site Forums   Wiki   Bugs Tasks Code FAQ Docs Help Register  
    Page   Discussion         View source History  

Rolling dice

From Shadowrun: Awakened

Jump to: navigation, search

Rolling dice gives things a more diverse outcome. Count hits also offers a gradient of outcomes between absolute success or failure.

Game Rules Description

In Shadowrun 4th edition, all dice are six-siders (d6). A five or better on a roll indicates a "hit" (formerly known as a success). A roll may have a required number of hits in order to succeed (called a threshold). Conversely, a roll may be opposed by another person, whoever gets more hits wins.

Most of the time when someone is rolling, they roll an attribute plus a skill in dice. There are some occasions (such as a full dodge in melee combat) where a more complicated formula is used. This number of dice is affected by the context of the situation through bonuses and penalties, each with a set subtraction or addition of dice.

For less demanding situations in a game, simple algebra may be substituted for rolling. In a statistically perfect model, 1/3 of all dice would come up a hit. So, just divide your number of dice by 3 to get a "quick and dirty" number of successes.

Technical Implementation

The "good old reliable" method would be to just generate a roll for each die with a "rand" function. This is rather fast, but if the server needs more performance there is a potentially faster way.

In order to do this, we would trade time on the CPU for memory. Instead of reporting a random result for each die, we simply use statistics to generate a number of hits for a given number of dice using one random number. We setup a 2D array where one dimension is number of dice and the other dimension is your randomly generated number. The value contained in the referenced cell is the number of successes.

For example...

1d6 == 33% chance hit 1 hit, 66% chance 0 hits

2d6 == 1/3*1/3 = 11% chance 2 hits, 1/3*2/3*2 = ~44% chance of 1 hit, 2/3*2/3 ~ 44% chance no hits

.....and so on

Given such a distribution, one could make a reference table that has percentages on one dimension, number of dice in another, and number of hits as values:

1 2 ... 11 ... 66 ... 89 ... 100
1 die
2 dice
3 dice
...

Then put the number of hits inside each cell.

For some rolls, such as rolls for healing, we will substitute the quick and dirty method just for computational efficiency. Generally, this is fine for any time where we need to describe a rate (such as for healing or movement) or anytime there is no risk of failure. However, situations like combat represent times when randomness should always play a part.