Monday 2 May 2022

What's the highest level cleric in this town?

Or: D&D meets Javascript

Without any further explanation (which will come in the next post), here's a bit of javascript which generates NPC levels based on an input (total) population:

Max level:

Click "Go"

Although I said that the explanation will come next time, here's a little bit of info. The numbers of characters are based on the NPC henchman class frequency (although I took ½% off fighter and thief to give to bards), with a poisson distribution around that mean, and the levels are based on the relative amount of xp needed to attain the given level, and also randomised using a poisson distribution.

Also note that population is expected to be the full population including the aged and children amounting to 50% of the total and who are assumed to not be of interest.


  1. Neat! Thanks for sharing! I might need to yoink this and modify to fit my campaign. Do you have the source code on git-hub or any place like that?

    1. I might put the original Perl version (one reason the JS is ropey is that JS is missing a few things Perl has out of the box) up next week, but of course you can grab the Javascript code by viewing page source.

      My next post will focus on the assumptions and what things you might want to alter for your individual needs.

    2. Awesome, thank you. (and yea, I could, but wanted to be polite and inquire first... courtesies and since you might still be developing/fine-tuning...)

  2. This comment has been removed by the author.