gavmor / Dunmanifestin

A verisimilitude generator.
3 stars 4 forks source link

DSL for designating correlated entity attributes #5

Open benchristel opened 11 years ago

benchristel commented 11 years ago

Users should be able to generate output like this:

charcter:
  name: Domi Erkthan
  race: dwarf
  profession: bodyguard
  hometown: Raaldeep
  str: 12
  int: 10
  wis: 11
  con: 10
  dex: 9
  cha: 8

From input like this:

name:
  - [humanNameGenerator]
  - [dwarfNameGenerator]
  - [elfNameGenerator]

race:
  - human
  - dwarf
  - elf

profession:
  - adventurer
  - farmer
  - miner
  - aristocrat
  - warrior
  - bodyguard

hometown:
  - Almodel
  - Korvo
  - Raaldeep

stats:
  - str:
    mean: 10
    stddev: 2
    min: 3
    max: 18
  - int:
    mean: 10
    stddev: 2
    min: 3
    max: 18
  - wis:
    mean: 10
    stddev: 2
    min: 3
    max: 18
  - con:
    mean: 10
    stddev: 2
    min: 3
    max: 18
  - dex:
    mean: 10
    stddev: 2
    min: 3
    max: 18
  - cha:
    mean: 10
    stddev: 2
    min: 3
    max: 18

dwarf -> mean str +1, mean con +1, stddev con -1
elf -> mean wis +1, mean int +1, mean dex +1, mean con -1

dwarf -> profession: miner +1, farmer -1
elf -> profession: aristocrat +1

dwarf -> hometown: Raaldeep +1
hometown: Raaldeep -> race: dwarf +1

elf -> hometown: Almodel +1
hometown: Almodel -> race: elf +1

human -> hometown: Korvo +1
hometown: Korvo -> race: human +1

The DSL needs some work... if the user wants to, for, example, change the name of a town, they also have to change all correlation rules that reference the name. There's also no obvious way to express two-way dependencies, e.g. dwarves are more likely to be miners, and miners are more likely to be dwarves. We basically need a GUI to manage this stuff... or a smarter DSL.

benchristel commented 10 years ago

Had a new idea for this that would fit into our existing system. We could add global variables to our DSL, which would be manifested only once for a given character generation, and then branch based on the values of those variables.

|$gender
10@male
10@female
unknown

|$race
human
elf
dwarf

|profession
[genericProfession]
$race = elf
2@[elfProfession]
$race = dwarf
2@[dwarfProfession]

|objectPronoun
$gender = male
him
$gender = female
her
$gender else
them
benchristel commented 10 years ago

Maybe we can use treetop.

benchristel commented 10 years ago

Rather than have the $ variables be global, we probably want to be able to scope them, so we can have multiple nodes with different values of the variables. For example:

|root
[person]; [person]; [person]

|person $race
[name], the [$race] [profession]

|$race
human
elf
dwarf

|profession
$race = human
fighter
cleric
$race = elf
ranger
wizard
$race = dwarf
miner
barbarian

This should generate output like:

Hele, the elf wizard; Kiyor, the dwarf miner; Pufkliir, the human cleric