Project: Chargen

2020-04-20
chargen screenshot

I built this OSRIC™ compatible random character generator, not because there isn’t one or another already, but because none of them is my own 😁. It is a bit limited right now, because it only generates characters’ attributes, alignments, class-race combinations and randomized levels. Maybe I will extend it by making generation of names, items, small descriptions and such possible in the future.

I wrote the back-end in Haskell and front-end in Elm, which both are functional programming languages. The back-end relies heavily on SQLite as I decided to codify game rules as such so that they could also be used easily from other programming languages (maybe I’ll build more OSRIC related software). That didn’t turn out to be a bit problematical as SQL (or at least especially SQLite) has a bit peculiar behavior with generating random numbers in queries. So I had to write, for example, class and race restrictions in Haskell, which wasn’t too bad, because I got to “reuse” the code in the front-end.

This project also made me venture into serverless computing (as it’s hosted on Google Cloud Run) and Docker. I had some problems with getting the Docker builds to behave nicely. First I had the SQLite database as a data file, which Haskell stack places amongst the build files and the binary, of course, would use that weird path only. I had to change the program to take the database path as a command line argument, which wasn’t much of a hassle. Now it seems to work a-ok and the hosting won’t cost much at all.

Back to Projects