I’ve been working on a generator for Knives, a 2d6 based Fantasy Traveller game. You can look at it, download it, use it offline, and replace the tables with your own tables. The table format is similar to the tables Hex Describe uses.
Knives is based on Halberts, which is in turn a translation of Helmbarten, and that game has a generator for characters and mini-settings. The only drawback for many people is that it generates German output. Yay! 😆 Better yet, I was trying to prove a point so the JavaScript itself uses German function names and German variables. Double plus yay! 😄
Anyway, I tried to use it as the basis for a new generator that’d be easy to adapt, without any special code written in JavaScript and failed. So I determined to do the next best thing: Rewrite the code such that it was generic and still capable enough to handle such tricky tasks as character generation.
Give it a try!
Save it to your disk, open it with a text editor and make changes. I’d love to see that!
This is the important explanation in a comment of the file:
# As this data needs to be valid HTML, you need to replace < & > in the tables with < & > (less than, ampersand, greater than). # '#' begins a comment # ';' begins a table, followed by a name, no space # A number and a comma begin a weighted entry for the current table # /re/to/ at the end replaces regular expression "re" with "to" # '[2d6]' or '[1d6+3]' are replaced by dice rolls # '[a]' gets replaced with a lookup of table 'a' # '[a|b]' gets replaced with 'a' or 'b' # '[x?a:b]' evaluates x as JavaScript and if "true" it is replaced with 'a' else with 'b' # '[a@b]' stores 'a' as variable 'b' (usage example: [[table]@b]) # '[a@@b]' does a lookup of table 'a' and appends it to the list 'b' # '[a++@b]' increments the key 'a' by one for the map 'b' # '[@b]' uses the value of variable 'b' # If b is a list, return a comma-separated list. # If b is a map, return a sorted, comma-separated list of key-value pairs # '[@++b]' gets replaced by the key with the highest value in map b
Some examples!
Here’s a table that returns a short female name:
;short female name 1,Ada 1,Anna 1,Berta
Here’s a weighted table that only returns a short female name in ⅙ of the cases:
;female name 1,[short female name] 5,[long female name]
Here’s how long female names are computed: ⅔ of the cases use a unisex prefix and a female suffix and ⅓ of the cases use a male suffix and append either “a” or “e”:
;long female name 2,[name prefix][female suffix] 1,[name prefix][male suffix][a|e]
The tables look like the first example above:
;name prefix 1,Adal 1,Albe 1,Amal ;female suffix 1,berga 1,burg 1,fled ;male suffix 1,ald 1,bart 1,boge
Thus potential results would be Adalberga, Adalburg, Adalalda, Adalbarte, and so on… I love it already! 😍
Anyway, those were the easy tables. If you decide to look into it and run into the complicated nightmare tables, feel free to contact me and I’ll be happy to help out.
#RPG #Knives
(Please contact me if you want to remove your comment.)
⁂
I’m a little confused on how the Name/City link thing works. I’ve messed with the code a bit, but I end up breaking it.
I’m also wondering if there ways to do a bit more complex algorithms, like:
A, B, C
if A then.. D if B then.. E etc..
– sean carter 2023-03-07 18:51 UTC
---
The code calls “map names” which assigns a “settlement name” to each letter from A to J (the letters are used as documented in the comments lines 461 to 475).
The `[x?a:b]` construct can be used for if-then-else but it’s tricky to get right because both beaches are evaluated first, including all the side effects!
– Alex 2023-03-07 22:04 UTC
---
Myrkheim now has interactive documentation.
– Alex 2023-04-29 12:53 UTC