Random Character Generator in Bash
Posted: Mon Feb 20, 2012 12:38 pm
I wrote a simple (incomplete) random character generator for BFRPG in Bash (as in UNIX Shell). I'm quite aware this isn't the most ideal way to do it, but it enabled me to do it quickly.
You can download it here:
http://files.pcode.nl/basicfantasy/bfrpggen/bfrpggen.sh
It should work fine on any modern UNIX machine, with Bash 4 and later. Windows users would need Cygwin or something like that.
However, I do have a set of 512 sample generated characters here (as plaintext files):
http://files.pcode.nl/basicfantasy/bfrpggen/samples/
The character generator has some heuristics to avoid boring/uninteresting characters to an extent:
1. It avoids same value characteristics.
2. All characteristics should total between 54 and 72 (all 3's or all 4's), to avoid too weak or powerful characters.
3. Single hit point character are avoided (D4 is at least 2 HP, D6 is at least 3 HP, D8 is at least 4 HP).
4. These heuristics can sometimes lockup the script (endless re-roll loop), fairly easily solved, but I've been too lazy.
The distribution of generated characters is fairly nice (from a set of 512):
HUMAN 130
DWARF 147
ELF 108
HALFLING 126
FIGHTER 141
CLERIC 134
MAGICUSER 77
THIEF 159
You can download it here:
http://files.pcode.nl/basicfantasy/bfrpggen/bfrpggen.sh
It should work fine on any modern UNIX machine, with Bash 4 and later. Windows users would need Cygwin or something like that.
However, I do have a set of 512 sample generated characters here (as plaintext files):
http://files.pcode.nl/basicfantasy/bfrpggen/samples/
The character generator has some heuristics to avoid boring/uninteresting characters to an extent:
1. It avoids same value characteristics.
2. All characteristics should total between 54 and 72 (all 3's or all 4's), to avoid too weak or powerful characters.
3. Single hit point character are avoided (D4 is at least 2 HP, D6 is at least 3 HP, D8 is at least 4 HP).
4. These heuristics can sometimes lockup the script (endless re-roll loop), fairly easily solved, but I've been too lazy.
The distribution of generated characters is fairly nice (from a set of 512):
HUMAN 130
DWARF 147
ELF 108
HALFLING 126
FIGHTER 141
CLERIC 134
MAGICUSER 77
THIEF 159