We're playing Paizo's Kingmaker, and while the GM is MIA (taking a three week summer vacation), the rest of us will be focusing on kingdom building. Some in person on the regular game night, but since kingdom building is mostly bookkeeping, also over email.
We can discuss our options and make choices over email, but eventually, we need dice rolls.
We could just roll physical dice and email the results, but that lacks a certain elegance. And since we're playing using technology, a technological solution should be used.
In the past, for similar circumstances, we've used the site http://dice.evildm.net/ where one could request certain dice rolls, and they would be emailed to the specified address(es) (i.e. the GM) along with an encoded signature that could be used to authenticate the roll(s). Pretty nice.
But that was years ago, and that site has disappeared. There is at least one other operational, which we used, but it led to thinking...
Professionally, I am a software developer. So I can put together a site to do the same thing. And I can do it right. Not just going to throw up some inelegant blob of code, but use current methodologies and architecture.
- Micro-service architecture
- RESTful APIs
- Server-less cloud hosting
I am using Visual Studio 2017 Community Edition (i.e. free), and am developing using C# in dotnetcore.
So, I've gotten a solid start. I have developed a RESTful API for DiceRolls. Using the API, one can request any of a variety of types of rolls, using a special syntax, which I use Regex to parse. The results of the randomly generated dice rolls are returned in JSON format. And I am hosting it on my free Azure account as an App Service (no need to emulate a server, runs as needed and can scale up and down based on demand.)
It can be found at https://dicerollerapi.azurewebsites.net/dicerolls/ (This is a temporary URL for development and is free. Once it has been fully developed, it will be moved to a proper URL.)
If you add the right code to the end of that URL, you can generate dice rolls. some examples:
/d20 roll a d20
/10Xd20 roll 10 d20's
/5d6 roll 5d6 (fireball or lightning bolt)
/3Xd4p1 roll d4+1 3 times, magic missile)
/6X3d6 roll 3d6 6 times, character generating old school
/6X4d6DL1 roll 4d6 drop the lowest die, 6 times, character generating, not so old school
As I said, the results are in JSON, so not really meant for humans, but one can probably figure it out. But this is just the first component. I will be writing several more: a notification service to send the result (or multiple sets of results) to specified email addresses; a Website for human to interact with the services to request dice rolls and supply email addresses; and an orchestrator service (the Website will talk to this service to convey the user's request, and it will handle making multiple calls to the Dice Roll API and then to the notification service.) Using an orchestrator, I could also allow other front-ends, such as other websites or phone apps to use the same services.
Also, instead of using the built-in pseudo-random number generator, I am considering using https://www.random.org/ to get true random values.
If you have any questions or comments, let me know. If you want to participate, let me know! (I'm currently keeping the code in a private Bitbucket repository, but can easily move it to a public GitHub repository.)
Post a Comment