Monday, October 1, 2018

DiceRoller - almost done

I've made a number of improvements in usability, and it now gets its random numbers from Random.org (falling back to the internal pseudo random generator if it cannot connect.)

Just need to put some text in the Credits and Technical Details pages and create a favicon, and I'll be ready to wire it to the real URL and see able getting it noticed by Google.

Still need to add a digital signature to authenticate rolls, but that can wait (since no one really uses it anyway, but still a good thing to have.)

feel free to play with the test install at https://dicerollerxyz.azurewebsites.net/




Sunday, September 9, 2018

DiceRoller - something actually usable!

Got some time to continue work on the diceroller, working on the website so actual humans can use the system.  And while it's super simple so far, there's a usable page at https://dicerollerxyz.azurewebsites.net   give it a try.

Yeah, the URL has changed again.  I haven't had much time to work on the site for a little while, due to life.  When I first signed up to use Azure, I got 30 days to use a free $200 worth of cloud processing.  When it got close to the end of that free trial time, they encouraged me to sign up for the "pay-as-you-go" system.  Since the site is in development and what's running in Azure is just for testing, no real traffic, it shouldn't add up to anything significant.  So I was a little surprised when I loaded the Azure dashboard, and it told me I had incurred about $7 in charges, and projected $28 per month charge.  For no usage.

It seems that Azure charges a token fee for each app service, even with no traffic.  About 31 cents a day.  And with my micro-service model, I already had 3 sites running, and would like stand up 2 more and the actual website.  While it's just pocket change, it would add up.  But since it was charging per app service, there was an easy solution: combine them.  Ideally, with microservices, each site runs completely separately; but I didn't want to pay 6 times more just for architectural purity.  So I combined all the microservices and the website into a single app service.  Each microservice can still call each other as if they were hosted separately, it'll just happen to be the same base URL.  So sue me. :)

Sunday, August 19, 2018

DiceRoller progress

making progress!

I've completed the diceroller notification microservice and have it running up on Azure as well.  For testing, I'm running a program locally that connects to the dice roll generator microservice to get dice rolls, saves them in memory, then sends them and my email address to the notification microservice for delivery.  And I receive the email a few seconds later, very nice.

So the next steps...

I will be creating an "orchestrator" microservice, which does essentially what my testing program is doing.  It would receive a list of requested dice rolls and email addresses, and make the calls to each of the other two microservices to complete the request.

After that, I will build a website, so actual humans can enter their dice roll requests and email addresses.  Completing this would be the real, critical accomplishment for this thing running in a useful way.

Once I get this running, I'll get it working on a real web-address (not azurewebservices.net.) GoDaddy was having a sale on .xyz domains recently, so I purchased diceroller.xyz for $1, and will be using that.


After that, I will be adding a few niceties:  true random numbers generated from Random.org, and adding a digital signature to each set or rolls.  More details on these as I get to them.


p.s. the address for the dice rolls microserver has changed a little.  It's now at https://dicerollergeneratorapi.azurewebsites.net/dicerolls/  (e.g. https://dicerollergeneratorapi.azurewebsites.net/dicerolls/d20 ).


Tuesday, July 31, 2018

Gaming and Coding

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 aorchestrator 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.)