Civilizations and You!
Today I will be talking about the Civilization system (Note: Everything talked about here-in is for NPC entities, not your fort)
Have you ever thought to yourself, "Man, these goblins are just no challenge no that I have my full steel clad army", or "I wish the game could change while I play"? If so, then this is for you!
The Civilization system allows you to customize the advancement of any entity you would like, and have them advance during game play!
Types of advancement include:- Add/Remove Available Inorganics (Metals/Stones/Gems)
- Add/Remove Available Organics (Leather/Wood/Cloth/Silk/Plants)
- Add/Remove Available Creatures (Pets/Minions/Pack Animals/Mounts/Wagon Pullers)
- Add/Remove Available Items (Weapons/Armor/Toys/Tools/etc...)
- Add/Remove Available Refuse (Bones/Shell/Ivory/Pearl/Horn)
- Add/Remove Noble Positions (DO NOT REMOVE THEM! IT WILL CAUSE THE GAME TO CRASH)
All of these will effect the the various stuff that an entity would bring for trade AND for attacks. You can even add Adamantine and other SPECIAL materials, so be careful!
Advancement is handled separately for each instance of an entity. That means that if you have 3 different Human entities placed, each one will be treated as it's own unique Civilization, but they will all follow the same advancement system.
Methods of advancement include:- Time Based (Daily/Weekly/Monthly/Seasonly/Yearly) - as a probability of triggering at each selected timescale
- Kill Based - triggers when they kill a certain number of your units
- Invasion Based - triggers after they commit a certain number of invasions with your fort
- Trade Based - triggers after they commit a certain number of trades with your fort
- Counter Based - for the advanced users that use my counters script
All of the non-Time Based methods check for advancement at the start of every new season. Advancements can occur as many times as you would like. Each Civilization "level" counts as one advancement.
All of this means that you can have a lot of customization in your game! So let's start by going over what you will need.
- Dwarf Fortress
- DFHack
- My Script Collection
The files in my script collection that are related to the Civilization System:
- hack/lua/civilizations/establish-civ.lua
- hack/lua/civilizations/read-file.lua
- hack/scripts/civilizations/level-up.lua
- hack/scripts/civilizations/noble-change.lua
- hack/scripts/civilizations/resource-change.lua
- hack/scripts/base/civilizations.lua
- raw/objects/civilizations.txt
So now that we know what it does, and we know what we need. How do we get started? Well for virtually everything you want to do, the only file you will need to modify is the civilization.txt file.
So let's take a look at civilization.txt
[CIV:PLAINS]
#Base Tokens
[NAME:humans from the north]
[LEVELS:1]
[LEVEL_METHOD:YEARLY:100]
#Level Tokens
[LEVEL:0]
[LEVEL_NAME:started in the stone age]
#Resource Tokens
## Creature Tokens
[LEVEL_REMOVE:CREATURE:PET:ALL:ALL]
[LEVEL_REMOVE:CREATURE:WAGON:ALL:ALL]
[LEVEL_REMOVE:CREATURE:MOUNT:ALL:ALL]
[LEVEL_REMOVE:CREATURE:PACK:ALL:ALL]
[LEVEL_REMOVE:CREATURE:MINION:ALL:ALL]
[LEVEL_REMOVE:CREATURE:EXOTIC:ALL:ALL]
[LEVEL_REMOVE:CREATURE:FISH:ALL:ALL]
[LEVEL_REMOVE:CREATURE:EGG:ALL:ALL]
## Item Tokens
[LEVEL_REMOVE:ITEM:WEAPON:ALL]
[LEVEL_REMOVE:ITEM:SHIELD:ALL]
[LEVEL_REMOVE:ITEM:AMMO:ALL]
[LEVEL_REMOVE:ITEM:HELM:ALL]
[LEVEL_REMOVE:ITEM:ARMOR:ALL]
[LEVEL_REMOVE:ITEM:PANTS:ALL]
[LEVEL_REMOVE:ITEM:SHOES:ALL]
[LEVEL_REMOVE:ITEM:GLOVES:ALL]
[LEVEL_REMOVE:ITEM:TRAP:ALL]
[LEVEL_REMOVE:ITEM:SIEGE:ALL]
[LEVEL_REMOVE:ITEM:TOY:ALL]
[LEVEL_REMOVE:ITEM:INSTRUMENT:ALL]
[LEVEL_REMOVE:ITEM:TOOL:ALL]
## Inorganic Tokens
[LEVEL_REMOVE:INORGANIC:METAL:ALL]
[LEVEL_REMOVE:INORGANIC:STONE:ALL]
[LEVEL_REMOVE:INORGANIC:GEM:ALL]
## Organic Tokens
[LEVEL_REMOVE:ORGANIC:LEATHER:ALL:ALL]
[LEVEL_REMOVE:ORGANIC:FIBER:ALL:ALL]
[LEVEL_REMOVE:ORGANIC:SILK:ALL:ALL]
[LEVEL_REMOVE:ORGANIC:WOOL:ALL:ALL]
[LEVEL_REMOVE:ORGANIC:WOOD:ALL:ALL]
[LEVEL_REMOVE:ORGANIC:PLANT:ALL:ALL]
[LEVEL_REMOVE:ORGANIC:SEED:ALL:ALL]
## Refuse Tokens
[LEVEL_REMOVE:REFUSE:BONE:ALL:ALL]
[LEVEL_REMOVE:REFUSE:SHELL:ALL:ALL]
[LEVEL_REMOVE:REFUSE:PEARL:ALL:ALL]
[LEVEL_REMOVE:REFUSE:IVORY:ALL:ALL]
[LEVEL_REMOVE:REFUSE:HORN:ALL:ALL]
## Misc Tokens
[LEVEL_REMOVE:MISC:BOOZE:ALL:ALL]
[LEVEL_REMOVE:MISC:CHEESE:ALL:ALL]
[LEVEL_REMOVE:MISC:POWDER:ALL:ALL]
[LEVEL_REMOVE:MISC:EXTRACT:ALL:ALL]
[LEVEL_REMOVE:MISC:MEAT:ALL:ALL]
[LEVEL_REMOVE:MISC:GLASS:ALL:ALL]
# Expanded Level Tokens
[LEVEL:1]
[LEVEL_NAME:entered the copper age]
[LEVEL_CHANGE_METHOD:YEARLY:50]
# Noble Tokens
[LEVEL_ADD_POSITION:MONARCH2]
[NAME_MALE:great king:great kings]
[NAME_FEMALE:great queen:great queens]
[NUMBER:1]
[SPOUSE_MALE:great king consort:great kings consort]
[SPOUSE_FEMALE:great queen consort:great queens consort]
[SUCCESSION:BY_HEIR]
[RESPONSIBILITY:LAW_MAKING]
[RESPONSIBILITY:RECEIVE_DIPLOMATS]
[RESPONSIBILITY:MILITARY_GOALS]
[PRECEDENCE:1]
[SPECIAL_BURIAL]
[RULES_FROM_LOCATION]
[MENIAL_WORK_EXEMPTION]
[MENIAL_WORK_EXEMPTION_SPOUSE]
[SLEEP_PRETENSION]
[PUNISHMENT_EXEMPTION]
[FLASHES]
[BRAG_ON_KILL]
[CHAT_WORTHY]
[DO_NOT_CULL]
[KILL_QUEST]
[EXPORTED_IN_LEGENDS]
[DETERMINES_COIN_DESIGN]
[COLOR:5:0:1]
[ACCOUNT_EXEMPT]
[DUTY_BOUND]
[DEMAND_MAX:20]
[MANDATE_MAX:10]
[REQUIRED_BOXES:20]
[REQUIRED_CABINETS:10]
[REQUIRED_RACKS:10]
[REQUIRED_STANDS:10]
[REQUIRED_OFFICE:20000]
[REQUIRED_BEDROOM:20000]
[REQUIRED_DINING:20000]
[REQUIRED_TOMB:20000]
That includes all of the currently supported tokens for each civilization. Note that the X in [CIV:X] must be the same as the entity you are interested in modifying (i.e. PLAINS in Vanilla DF is Humans) Let's talk about what they do.
Base TokensThese tokens are mandatory for each civilization and should only occur once.
- [NAME] - What the civilization is called, not currently used for anything. This will make an appearance in the upcoming Journal project
- [LEVELS] - Number of levels that your civilization has
- [LEVEL_METHOD] - The method for leveling that the civilization starts with. Valid entries include:
- DAILY/WEEKLY/MONTHLY/SEASON/YEARLY - The number then specifies the probability for it to occur at each timestep
- KILLS - The number is the number of kills needed
- INVASION - The number is the number of invasions needed
- TRADE - The number is the number of trades needed
- COUNTER:X, where X is the name of the counter to check - The number is the number of the counter needed
Level Tokens:These are the tokens that defined each level
- [LEVEL] - The start of the level declaration, the number specifies the level
- [LEVEL_NAME] - The name of the level, currently appears in an in-game announcment, "Entity 1 has X", where X is the entered text
- [LEVEL_CHANGE_METHOD] - This allows the method of leveling to change as the civilization advances, valid tokens are the same as [LEVEL_METHOD]
Resource TokensThese are the tokens that will handle all of the adding and removing of availability to specific things. The basic syntax is [LEVEL_ADD] and [LEVEL_REMOVE]. I will split these into their various sub-types
-
Creature TokensTo add/remove creatures we start with the basic syntax [LEVEL_ADD]/[LEVEL_REMOVE] and add to it.
- [LEVEL_ADD:CREATURE:type] - valid types include
- PET:creature:caste - adds creature to the available pets of an entity
- WAGON:creature:caste - adds creature to the available wagon pullers of an entity
- MOUNT:creature:caste - adds creature to the available mounts of an entity
- PACK:creature:caste - adds creature to the available pack animals of an entity
- MINION:creature:caste - adds creature to the available minions of an entity
- EXOTIC:creature:caste - adds creature to the available exotic pets of an entity
- FISH:creature:caste - adds creature to the available fish of an entity
- EGG:creature:caste - adds creature to the available egg producers of an entity
- [LEVEL_REMOVE:CREATURE] - all of the same tokens as for [LEVEL_ADD] are valid for [LEVEL_REMOVE]
There is the special token ALL for both creature and class. For example creature:ALL would add all the castes of a particular creature, ALL:caste would add the caste of all the creatures in game, and ALL:ALL would add all the creatures and all their castes.
Item TokensTo add/remove items you follow a similar method to the creatures. Start with [LEVEL_ADD]/[LEVEL_REMOVE] and add to it
- [LEVEL_ADD:ITEM:type:subtype] - valid types include
- WEAPON
- SHIELD
- AMMO
- HELM
- ARMOR
- PANTS
- SHOES
- GLOVES
- TRAP
- SIEGE
- TOY
- INSTRUMENT
- TOOL
- [LEVEL_REMOVE:ITEM:type:subtype] - the same as available for [LEVEL_ADD:ITEM]
There is a special token ALL for the subtype. WEAPON:ALL will add all weapons to a given entity
Inorganic TokensTo add/remove inorganic materials you follow a similar method to the creatures. Start with [LEVEL_ADD]/[LEVEL_REMOVE] and add to it
- [LEVEL_ADD:INORGANIC:type:subtype] - valid types include
- [LEVEL_REMOVE:INORGANIC:type:subtype] - the same as available for [LEVEL_ADD:INORGANIC]
There is a special token ALL for the subtype. METAL:ALL will add all inorganics with the tag [IS_METAL] to the entity
Organic TokensTo add/remove organic materials you follow a similar method to the creatures. Start with [LEVEL_ADD]/[LEVEL_REMOVE] and add to it
- [LEVEL_ADD:ORGANIC:type] - valid types include
- LEATHER:creature:material
- FIBER:plant:material
- SILK:creature:material
- WOOL:creature:material
- WOOD:plant:material
- PLANT:plant:material
- SEED:plant:material
- [LEVEL_REMOVE:ORGANIC:type] - the same as available for [LEVEL_ADD:ORGANIC]
Organic tokens work a little differently than the other tokens. Some come from creatures and some come from plants. The first token (creature/plant) will either be something like SHEEP if it is a creature or MUSHROOM_HELMET_PLUMP if it is a plant. The second token (material) is the name you have given to the material in the raw. For vanilla it is just things like LEATHER, SEED, SILK, etc... but it doesn't have to be. You might have a mod that has TOUGH_LEATHER as the defined material.
There is a special token ALL:ALL for the creature:material pair. LEATHER:ALL:ALL will add all organics with the tag [LEATHER] to the entity
Refuse TokensRefuse tokens function the same as organic tokens, just with different types.
- [LEVEL_ADD:REFUSE:type] - valid types include
- BONE:creature:material
- HORN:creature:material
- SHELL:creature:material
- PEARL:creature:material
- IVORY:creature:material
- [LEVEL_REMOVE:REFUSE:type] - the same as available for [LEVEL_ADD:REFUSE]
Refuse tokens work just like organic tokens, but take different materials (and all come from creatures).
There is a special token ALL:ALL for the creature:material pair. BONE:ALL:ALL will add all materials with the tag [BONE] to the entity.
Misc TokensMisc tokens work just like organic and refuse tokens
- [LEVEL_ADD:MISC:type] - valid types include
- CHEESE:creature:material
- BOOZE:plant:material
- POWDER:creature:material
- EXTRACT:creature:material
- MEAT:creature:material
- [LEVEL_REMOVE:ORGANIC:type] - the same as available for [LEVEL_ADD:MISC]
Misc tokens are tricky because they don't always have to be from one source. But the same premise applies no matter where they are from.
Noble TokensAdding nobles requires a little bit more work than adding resources, but is just as straightforward as in the raws. To add a noble all you need to do is place
[LEVEL_ADD_POSITION:X], where X is some name you choose (e.g. MONARCH). Then everything after that, until a new [LEVEL_ADD_POSITION:X], or a non-position raws token will be attributed to the position. In our example above,
[LEVEL_ADD_POSITION:MONARCH2]
[NAME_MALE:great king:great kings]
[NAME_FEMALE:great queen:great queens]
[NUMBER:1]
[SPOUSE_MALE:great king consort:great kings consort]
[SPOUSE_FEMALE:great queen consort:great queens consort]
[SUCCESSION:BY_HEIR]
[RESPONSIBILITY:LAW_MAKING]
[RESPONSIBILITY:RECEIVE_DIPLOMATS]
[RESPONSIBILITY:MILITARY_GOALS]
[PRECEDENCE:1]
[SPECIAL_BURIAL]
[RULES_FROM_LOCATION]
[MENIAL_WORK_EXEMPTION]
[MENIAL_WORK_EXEMPTION_SPOUSE]
[SLEEP_PRETENSION]
[PUNISHMENT_EXEMPTION]
[FLASHES]
[BRAG_ON_KILL]
[CHAT_WORTHY]
[DO_NOT_CULL]
[KILL_QUEST]
[EXPORTED_IN_LEGENDS]
[DETERMINES_COIN_DESIGN]
[COLOR:5:0:1]
[ACCOUNT_EXEMPT]
[DUTY_BOUND]
[DEMAND_MAX:20]
[MANDATE_MAX:10]
[REQUIRED_BOXES:20]
[REQUIRED_CABINETS:10]
[REQUIRED_RACKS:10]
[REQUIRED_STANDS:10]
[REQUIRED_OFFICE:20000]
[REQUIRED_BEDROOM:20000]
[REQUIRED_DINING:20000]
[REQUIRED_TOMB:20000]
I just copied the MOUNTAIN entities MONARCH and made one that requires more things. Simple enough.
And there you have it, that is all that is needed to start making your game evolve and change while you play! Please post your custom civilizations here so that others can see all the fun things you can do!
Addendum 1: Custom LevelsYou can custom level a civilization through a reaction/interaction/command line by using
civilizations/level-up CIV_ID
The counters system also allows for a much more rigorous custom leveling structure. Especially when combined with [LEVEL_CHANGE_METHOD].