Pages

2013/05/01

A Dice Rolling Server for Table-top RPGs


Charachter sheet, pencil, eraser, and dice
The typical tools of table-top RPGs
I have played RPGs (role playing games) for over twenty years. As life gets busier we find it harder to schedule a few hours when we all can sit together. Because of this we want to give playing via Google Hangouts a try.

Google Hangouts covers most of the issues: we will see each other's face and talk as though we were together (with limitations, of course); and we can share documents on-screen with Google Drive for maps and other props needed during play.

But there is one thing that we cannot do easily: rolling dice. Pointing the webcam at the table to broadcast the roll is clearly out of the question, and just announcing the results may be dangerous; too much of an incentive for cheating. So we decided to develop a dice rolling server and clients.

A dice rolling application may seem rather trivial at first sight: hey, get a random number between 1 and 6 with a uniform distribution and you're ready to go, right? If you have ever played one of these games you know it's not that easy.

First, there are different types of dice: 4-, 6-, 8-, 10-, 12-, and 20-sided are the regular ones, and there are variations like simulating a 100-sided dice using two 10-sided ones, one for units and one for tens (if you're not using an actual 100-sided die), or a 3-sided one by rolling a 6-sided die and dividing by two (rounding up).

Then there are the rolls themselves. If you are already familiar with RPGs you may skip the following four paragraphs; I recommend that you also skip them if you find them boring (which is likely); in a nutshell, what they say is that each game has its own rules about rolls and that makes it more difficult than getting a random number between 1 and 6.

In some games rolls are quite uniform; in The Call of Cthulhu all rolls are 1D100 (that is one 100-sided die), and you compare the result to the applicable skill level, which is the odds of succeeding, in percentage.

In other games they can be quite convoluted; in Dungeons & Dragons you may roll things like 2D8+1D6+3 (i.e. two 8-sided dice, one 6-sided die add the three together and then add 2 to that) and check the result against a table depending on your character's level, race, and profession and the opponent's level to determine if it is successful; and another roll may be 1D20, and so on.

In other cases, the result is not calculated by adding up the result of every die. In the World of Darkness games you roll a number of 10-sided dice, check each one against a set difficulty, and count how many are greater than, or equal to, that number; oh, and substract one for each die that yields a 1; oh, and re-roll any 10 if you have a specialty that applies to the roll.

And in Legend of the Five Rings you roll things like 6K3+5 (you read that as roll 6, keep 3, plus 5), roll six 10-sided dice, add up the result of three of them (usually you'll choose the highest ones, but you may want to fail or succeed by a small margin on purpose, say, to fool someone into believing you're not as skilled as you really are) and then add 5 to that; and check that the result is greater than, or equal to, the set difference; oh, and if you roll a 10 you re-roll that die and add it; oh, and sometimes you may also re-roll nines; and there is a specific arithmetic for the rolls: you may never roll more than 10 dice, so if you have more to roll, every two excess dice turn into an additional kept die; at the point where you would roll and/or keep more than 10 dice, the excess dice turn into a +2 each... welll, you get the point.

Welcome back.

So, what we want is an application that each of us will run, loaded with the data of our character; it should allow us to make the rolls needed, broadcast the public ones, share the private ones only with the master and help with the special roll arithmetic in some games.

We will use a server to do the actual rolling and (broad)casting at the behest of the clients. I just bought a new Raspberry Pi for that, taking advantage of the free hosting offer from PCExtreme to use as the server. I will develop the clients on the Pi I have at home, but they should be portable to any system.

At the moment the rolling part is done for World of Darkness games and Legend of the Five Rings. That should be enough to begin with, and the design is, I hope, easy to extend to include new games (The One Ring will be next). I still have to transform it into a server application, right now it's just a local application.

In future posts I will explore the architecture of both the server and the client as I advance on them, and when it is in good shape I will post it on github.

Stay tuned for more new on this topic.

No comments:

Post a Comment