This program generates a number of random characters based on a provided database.
You are free to use the provided databases and definition files in the db
directory for basic human parameters.
Not all generated values might make sense for now (for example it's possible to have a 2 years old have 3 children).
Just download/clone the repository on your machine.
You will need Python 3.10 (or more recent) in order to run this software.
Once python is installed, you can run pip
to install the requirements depicted in the requirements.txt
file.
pip install -r requirements.txt
Running it once should be enough, and from time to time regarding library updates.
If not installed as a python module, you can run the software with the given command from the parent directory of the python module:
python -m character-generator <definition-file> <db-files..>
You can also run python -m character-generator --help
for full usage description.
Example with samples:
python -m character-generator character-generator/db/character_definition.yaml character-generator/db/db.yaml
The database is split in different documents, where each document is a "trait" that can be generated. Some trait may trigger the generation of other traits or may cascade into sub-categories of traits.
trait-name:
name: display name of the trait
type: [types]
values:
- values...
Values is according to the trait types. See trait types or values definition underneath.
trait-name:
keys:
- key 1
- key 2
- ...
- key n
default_key: key x (one of 1 to n)
trait key 1 definition:
...
trait key 2 definition:
...
...
trait key n definition:
...
percent
: the caracteristic is determined based on a percentage.stack
: the presented odds are provided in a stacked value, usually used withpercent
.based
: the result of this can be based on actual statistics, only the actual result will be shown if there's no base value (ex: percentage if alsopercent
type). If a value is provided, then the proportion will be made compared to its maximum.either
: one key out of multiple has to be chosen. Keys are defined underneath, need to usekeys
attribute to list them and provide a default withdefault_key
(see example upward).oneof
: picks a random entry from the values, which should be a list.
key
: a reference key for the value or its text if no "text" key is provided.text
(opt): a text to be displayed for this value instead of the key.chances
: chances of it happening (in %, or written "XX%")factor
(opt):
The following definitions entries are all optional and are mutually exclusive:
cascade
: if this value is selected, triggers another generation for a given db entry, under the form: { db_key: number of times to be triggered }. A cascading entry will be appended after the current entry.cascade_all_after
: similar tocascade
, except this marks all following stack to cascade the db entries.cascade
overrides acascade_all_after
for this given value.trigger
: similar tocascade
, except this will add a new entry to the generated character.trigger_all_after
: similar totrigger
, except this marks all following stack to trigger the db entries.trigger
overrides atrigger_all_after
for this given value.
All the help is here. You can find sample files in the db directory.
- Sylvain Domenjoud aka "Sylordis" (creator and maintainer)
This project is licensed under the Apache License v2 - see the LICENSE file for details
Project website: https://github.com/Sylordis/character-generator/
Issues are reported here: https://github.com/Sylordis/character-generator/issues