"Ok, ok, you convinced me, it has its uses (even if it does seem needlessly complicated). So what do I have to do to get it to actually work?"
Great question! Lets do a step by step walkthrough!
Files you will need to change:configuration.txt
templates_BIOME.txt
templates_BODY_MATERIALS.txt
templates_BODY_PARTS.txt
templates_CASTE.txt
templates_EXTRACT.txt
templates_INTERACTION.txt
templates_TYPE.txt
Files you will not need to change:random_creatures.py
rc_functions.py
STEP 1: TemplatesThe first step is to read through all the templates_*.txt files and get a feel for how each one works. I have included several different templates in each of the files, there should be more than enough examples for you to figure out how to create your own templates. You can freely add or subtract any of the templates that you want, just make sure the general naming convention is followed.
STEP 2: Template tokens and argumentsNow that you have a feel for the templates and have made a couple of your own, its time to look at tokens and arguments, and how to effectively use them. Let's start with an example already included in the current templates. Look at this template from the templates_EXTRACT.txt file:
[TEMPLATE:VENOM_1]
{#DESCRIPTION;It has a painful venom.}
{#ARGS;#SEV,#END}
{#TOKENS;#VENOM}
[USE_MATERIAL_TEMPLATE:VENOM:CREATURE_EXTRACT_TEMPLATE]
[STATE_NAME:ALL_SOLID:frozen #NAME venom]
[STATE_ADJ:ALL_SOLID:frozen #NAME venom]
[STATE_NAME:LIQUID:#NAME venom]
[STATE_ADJ:LIQUID:#NAME venom]
[STATE_NAME:GAS:boiling #NAME venom]
[STATE_ADJ:GAS:boiling #NAME venom]
[PREFIX:NONE]
[ENTERS_BLOOD]
[REACTION_CLASS:VENOM]
[SYNDROME]
[SYN_NAME:#NAME venom]
[SYN_INJECTED]
[SYN_CONTACT]
[CE_PAIN:SEV:#ARG1:PROB:100:RESISTABLE:SIZE_DILUTES:LOCALIZED:VASCULAR_ONLY:START:0:PEAK:10:END:#ARG2]
[EXTRACT:LOCAL_CREATURE_MAT:VENOM]
You will note that it has two arguments and one token. The arguments are then labeled as #ARG1 and #ARG2 inside of the raws portion of the template (you may also notice #NAME, that is a special argument which will always pass the creatures name). Another thing you may notice is that there is no reference to the token in the raws portion. This is because the token merely specifies which type of template this is. Now that we have made this template, we need to come up with a way to add it to creatures, or in other words, we need to 'activate' it.
STEP 3: Activating tokens and defining argumentsNow we move on to the configuration.txt file, there you will look for two sections. The first is the arguments section where (in the release as of the time of this writing) you will find;
args = {'#SHELL': 'random.randint(1,4)',
'#SCALE': 'random.randint(1,4)',
'#CHITIN': 'random.randint(1,4)',
'#TOOTH': 'random.randint(1,2)',
'#HOOF': 'random.randint(1,2)',
'#HORN': 'random.randint(1,2)',
'#NAIL': 'random.randint(1,2)',
'#SEV': 'int(random.triangular(1,max_venom_severity))', <-
'#END': 'int(random.triangular(1000,max_venom_length))', <-
'#MILK': '20000',
'#EGG_SIZE': 'int(size_r/1000)+1',
'#CLUTCH_MIN': 'random.randint(1,5)',
'#CLUTCH_MAX': 'random.randint(6,10)',
'#CAPACITY': 'int(size_r/200)',
'#DIVISOR': '1000'
}
I have pointed out our two arguments from the extract template. This means that your venom template will be created with a severity of between 1 and the variable max_venom_severity and it will have a duration of between 1000 and the variable max_venom_length.
These variables are added by yourself at the top of the configuration.txt file, in the current file they are;
max_venom_severity = 500 # Venom extracts will have a severity between 1 and this value with a triangular distribution function
max_venom_length = 10000 # Venom extract will have a length between 1000 and this value with a triangular distribution function
Now we have defined our arguments we need to activate the token. To do this we find the extract_token section in the configuration.txt file;
extract_token = {'#VENOM': 'random.randint(1,100) < venom_percent', <-
'#HIVE': '((random.randint(1,100) < hive_percent) and (size_r <= vermin_size))'
}
This shows you that currently the percentage of creatures which will have the #VENOM flag set true, and thus pick an extract that has the #VENOM token is venom_percent (again defined by you at the top of the configuration file).
So for a recap;
Arguments - These are all handled in one place, and allow for individual customization inside of a template, so that two creatures that pick the same template will have different values.
Tokens - These specify which templates a creature can pick from. When the creature is generated it will analyze each token group separately and set the corresponding flags to True or False. Each flag that is set True means that the creature can choose only from those with the corresponding token.
NOTE:
- Castes, Extracts, Interactions, and Types all require tokens and if there are not provided and activated as shown in the above two steps, they will not be included in the randomly generated creatures.
- Biome tokens are set when the biome is chosen and can be used in other flags (e.g. in the type tokens '#WATER': 'biome_token_flag["#WATER_ONLY"]')
- Body Part tokens are handled differently, they are only used when determining what is required to link to
- Body Material function in the same manner as biome tokens.
STEP 4: Configuration file wrap upTwo sections of the configuration file that have not been talked about yet are the body_detail_template declarations and the raw_token declarations.
1. body_detail_template
These are for use in the templates_BODY_MATERIALS.txt file. Namely, wherever you see #MATERIALS it will randomly be replaced by one of these material templates, correspondingly any #TISSUES will be replaced by the associated tissue template. (In vanilla you would simply have STANDARD_MATERIALS and STANDARD_TISSUES)
#'!BODY_DETAIL_TEMPLATE': '!DESCRIPTION MODIFIER',
material = {'MATERIALS_LEVEL_1': 'This creature has weak materials',
'MATERIALS_LEVEL_2': '',
'MATERIALS_LEVEL_3': 'This creature has strong materials',
'MATERIALS_LEVEL_4': 'This creature has very strong materials'
}
tissue = {'MATERIALS_LEVEL_1': 'TISSUES_LEVEL_1',
'MATERIALS_LEVEL_2': 'TISSUES_LEVEL_2',
'MATERIALS_LEVEL_3': 'TISSUES_LEVEL_3',
'MATERIALS_LEVEL_4': 'TISSUES_LEVEL_4'
}
2. raw_tokens
Here's where all the extra miscellaneous tokens you might want to add to a creature go. Note that you can add these tokens in the templates themselves, but this allows for more variability within individual creatures as well. From the current configuration.txt;
#'!ACTIVITY TAG': '!DESCRIPTION MODIFIER', <- A section just for activity tags, add or remove as you desire. The script will pick one for the creature.
active = {'CREPUSCULAR': 'at dawn and dusk',
'NOCTURNAL': 'at night',
'DIURNAL': 'during the day',
'MATUTINAL': 'at dawn',
'VESPERTINE': 'at dusk',
'ALL_ACTIVE': 'all the time'
}
#'!TAG': '!PREFSTRING', <- A section for the various quirks of an animal. These will be chosen at random (in a random, but configurable amount). And will provide the creature with prefstrings
misc = {'ADOPTS_OWNER': 'loyalty',
'AMBUSHPREDATOR': 'ability to stalk prey',
'BENIGN': 'benign nature',
'BONECARN': 'like of bones',
'CARNIVORE': 'taste for meat',
'CAVE_ADAPT': 'adeptness underground',
'COMMON_DOMESTIC': 'ability to domesticate',
'CURIOUSBEAST_EATER': 'curiosity',
'CURIOUSBEAST_GUZZLER': 'curiosity',
'CURIOUSBEAST_ITEM': 'curiosity',
'EXTRAVISION': 'ability to see at night',
'FLEEQUICK': 'ability to run away',
'HUNTS_VERMIN': 'ability to hunt vermin',
'LIKES_FIGHTING': 'ferocious attitude',
'MEANDERER': 'random behaviour',
'MISCHIEVIOUS': 'mischieviousness',
'MOUNT': 'use as a mount',
'MOUNT_EXOTIC': 'use as a mount',
'NO_AUTUMN': 'autumnal hibernation',
'NO_DIZZINESS': 'resistance to dizziness',
'NO_DRINK': 'ability to go long periods without drink',
'NO_EAT': 'ability to go long periods without food',
'NO_FEVERS': 'lack of fevers',
'NO_SLEEP': 'no need of sleep',
'NO_SPRING': 'spring hibernation',
'NO_SUMMER': 'summer hibernation',
'NO_WINTER': 'winter hibernation',
'NOBREATHE': 'no need to breath',
'NOEMOTION': 'lack of emotion',
'NOEXERT': 'incredible endurance',
'NOFEAR': 'lack of fear',
'NONAUSEA': 'resistance to nausea',
'NOPAIN': 'resistance to pain',
'NOSTUN': 'resistance to being stunned',
'PARALYZEIMMUNE': 'resistance to paralysis',
'TRANCES': 'ability to enter martial trances',
'TRAPAVOID': 'ability to avoid traps',
'UBIQUITOUS': 'over abundentness',
'VERMINHUNTER': 'expert vermin hunting',
'WEBIMMUNE': 'ability to slip out of webbing'
}
Lastly, in your configuration file, you will find a group of variables that are not connected to any templates. These are the various size, speed, age, population number, etc... variables. These can be changed to suit your needs and are labeled with what each one does.
Now that you have completed modifying the templates and made the necessary changes to your configuration file, you are ready to generate some creatures!
STEP 5: RunSimply run random_creatures.py and when it asks you for how many creatures you would like to generate type in your desired number. And PRESTO! You now have a group of random creatures!
So at the end what do you get? Something like this; (Note that this still has the 34x speed system and no attacks, currently in the process of updating)
[CREATURE:MUNDANE_0000]
[NAME:nas-emar]
[CREATURE_TILE:'M']
[COLOR:0:5:0]
[PET][PETVALUE:130]
[NOCTURNAL]
[FREQUENCY:100]
[POPULATION_NUMBER:1:78]
[CLUSTER_NUMBER:1:6]
[PREFSTRING:lack of fevers]
[PREFSTRING:expert vermin hunting]
[PREFSTRING:over abundentness]
[PREFSTRING:use as a mount]
[BODY_SIZE:0:0:770]
[BODY_SIZE:1:0:7709]
[BODY_SIZE:2:0:77091]
[CHILD:1]
[MAXAGE:61:74]
[SPEED:2079]
[SWIMS_INNATE][SWIM_SPEED:2500]
[NO_FEVERS]
[VERMINHUNTER]
[UBIQUITOUS]
[MOUNT]
[BIOME:GLACIER]
[BIOME:TUNDRA]
[BIOME:OCEAN_ARCTIC]
[BIOME:TAIGA]
[BODY:TORSO_1PART:HEAD_NORMAL:LIMBS_LEGS_4TENTACLES:LIMBS_ARMS_2ARMS:FACE_EYES_8EYES:FACE_MOUTH_BILL:FACE_NOSE_SNOUT:FACE_EARS_LARGEEARS:ORGANS_STANDARD:SKELETAL_STANDARD:LIMBS_HANDS_CLAWSARM:LIMBS_FEET_CLUBSTENTACLE]
[USE_MATERIAL:CLAW:CREATURE_MAT:ANIMAL:NAIL_2]
[USE_TISSUE_TEMPLATE:CLAW:CLAW_TEMPLATE_LEVEL_2]
[BODY_DETAIL_PLAN:MATERIALS_LEVEL_2]
[REMOVE_MATERIAL:HAIR]
[REMOVE_MATERIAL:BONE]
[BODY_DETAIL_PLAN:TISSUES_LEVEL_2]
[REMOVE_TISSUE:HAIR]
[REMOVE_TISSUE:BONE]
[BODY_DETAIL_PLAN:MOLLUSC_TISSUE_LAYERS:SKIN:FAT:MUSCLE]
[BLOOD:CREATURE_MAT:ANIMAL:ICHOR:LIQUID]
[PUS:CREATURE_MAT:ANIMAL:PUS:LIQUID]
[SET_TL_GROUP:BY_CATEGORY:ALL:SKIN]
[TL_COLOR_MODIFIER:BUFF:1]
[TLCM_NOUN:skin:PLURAL]
[NATURAL]
[MUNDANE]
[MEANDERER]
[LARGE_ROAMING]
[LIKES_FIGHTING]
[LARGE_PREDATOR]
[TRAINABLE_WAR]
[CASTE:FEMALE]
[DESCRIPTION:(Max Size = 78, Value = 130) A common animal found in the wilderness. A hairless and boneless creature with a single part body, a head with eight eyes, a snout, a large bill, and large ears. It has two arms with claws, and four lower tentacles with clubs. Is only found in freezing biomes. Active at night It roams around. It is a vicious predator. It can be trained to fight.]
[CASTE_NAME:nas-emar:nas-emars:nas-emar]
[FEMALE]
[POP_RATIO:100]
[CASTE:MALE]
[(Max Size = 78, Value = 130) A common animal found in the wilderness. A hairless and boneless creature with a single part body, a head with eight eyes, a snout, a large bill, and large ears. It has two arms with claws, and four lower tentacles with clubs. Is only found in freezing biomes. Active at night It roams around. It is a vicious predator. It can be trained to fight.]
[CASTE_NAME:nas-emar:nas-emars:nas-emar]
[MALE]
[POP_RATIO:100]
[SELECT_CASTE:ALL]
[EXTRA_BUTCHER_OBJECT:BY_TYPE:THOUGHT]
[EBO_ITEM:SMALLGEM:NONE:INORGANIC:SOUL_GEM_ONE]
CURRENT ISSUES:Here is a list of the current issues with generated creatures;
- Name generation is basically non-existent, oh it will generate a random name for your creatures, but it will just pick between 1 and 3 random words from the dwarf language file and name your creature that. Not exactly useful. I will be adding support for naming conventions based on the various templates and tokens a creature uses.
- Graphics are also non-existent. I am not sure what to do with that, but for now its all ascii