Epic sim: Difference between revisions

From Adam Colton
Jump to navigation Jump to search
No edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 9: Line 9:


Governments rule lands and people. Religions influence people and governments. Governments collect taxes, religion collect tithes. Governments also have military's. Military's enforce laws, protect citizens and fight wars (conquer or protect territory).
Governments rule lands and people. Religions influence people and governments. Governments collect taxes, religion collect tithes. Governments also have military's. Military's enforce laws, protect citizens and fight wars (conquer or protect territory).
https://mewo2.com/notes/terrain/
https://github.com/esimov/triangle/blob/master/delaunay.go


== Goal ==
== Goal ==
Line 36: Line 40:


Each tile contains one "plant", though that may be a single tree or a few meters of grass (I need to decide how big a tile is). I need to figure out plant rules.
Each tile contains one "plant", though that may be a single tree or a few meters of grass (I need to decide how big a tile is). I need to figure out plant rules.
==== Species ====
Everything has a species - a string that represents what they are. When there's a mutation, there's a chance of the species string changing. Two creatures can only mate if the species string is close.


==== Grass ====
==== Grass ====
Line 50: Line 57:


==== Ruminants ====
==== Ruminants ====
These eat grass. Any tile with a ruminant on it has both a higher chance of death and a higher chance of spreading. Ruminants will have a lot of evolutionary knobs. Size, armaments (antlers), gestation, sociability. Each will also have a "species" represented by a string and can only mate with ruminants of a closely related species.
These eat grass. Any tile with a ruminant on it has both a higher chance of death and a higher chance of spreading. Ruminants will have a lot of evolutionary knobs. Size, armaments (antlers), gestation, sociability.


==== Birds ====
==== Birds ====
Line 69: Line 76:
Has a virulence, a species key (can affect certain species) and mortality and survival rate. These are different. Mortality is the chance of dying when something is sick and survival is the chance of getting better.
Has a virulence, a species key (can affect certain species) and mortality and survival rate. These are different. Mortality is the chance of dying when something is sick and survival is the chance of getting better.


== Terrain ==
=== Structures ===
Will have a number of qualities. Soil quality will determine what can grow, if the quality is none, nothing can grow, in low quality soil, only sparse grass, in higher quality soil crops or prairies can grow. A plant that grows, dies and decays will raise the quality of the soil slightly. Animal waste will also raise the quality. But an animal eating the plant will carry it away.
Here we place and grow structures. Any of these structures can take up multiple tiles, but at least one of the tiles needs to touch a "road" tile. Each structure is part of a trade network. So a farm will be connected directly to any bakery or market nearby.
 
Start by placing some production - farms, mines, logging and hunting grounds. Then we start placing industry based on what's around; each has high value and a low value industry. The idea is that trading for primary needs is too expensive, but it's ok for secondary needs. Also, there's a penalty to being to close to competition, but that can be overcome with enough resources and demand.
 
We will also start developing trade routes. We can simulate trade based on need and run my roads algorithm. We can also develop naval travel by developing docks and adding that to the algorithm.
 
From here we can start adding higher culture. Religion, trade and government. Religion will build templates, government will build courts and military bases. Trade will build markets and docks. Markets will form a [https://en.wikipedia.org/wiki/Voronoi_diagram Voronoi diagram] so that each market controls a region and will establish trade routes with all adjacent markets.
 
* Farm: Grasslands based on soil quality
* Foraging grounds: animal life, trees and shrubs
* Logging: trees
* Mines: metal ores
* Bakery: Farms, hunting grounds
* Blacksmith: Mines
* Carpenter: Logging
* Workshop: blacksmith, carpenter
* Markets: roads
* Docks: special parts of road system where roads transition to water
* Temples: markets
* Government: markets and temples
* Military: government
 
Roads are developed from local and trade travel. Local travel represents direct transit like a farm taking goods to either a market or a bakery. It develops roads very slowly. Trade represents travel between markets and produces a much higher rate of development.
 
All structures value bakery, workshop and all cultural buildings because everyone needs food, things and culture.
 
Need a way to asses "value" and abandon structures that are not valued in proportion to their surroundings.
 
So if this works correctly, it will iterate developing city states. The first passes will create production, then industry. As the local roadways develop, markets will develop and then trade routes and finally higher culture.
 
Perhaps to add later
* University
* Entertainment
 
=== Specialization ===
At this level we start adding specialization to the structures. Farms start planting specific crops, loggers start cutting down trees, mines produces specific ore and foragers are interacting with animals and plants. There will also be a species like evolution to strategy. So one farm may choose aggressive farming practices and another more conservative and if one goes bankrupt, the other can spread. Or loggers can develop an ideal forest density.
 
Each farm needs one tile for the "farm" and then each additional tile can be an animal or crop.
 
Bakeries, carpenters and blacksmiths can produce any goods, but based on their tools and what their skill, they will produce different quality goods.


There will also be a rating for underground metals which will decrease as the area is mined.
This is also where we'll introduce traders. Each market will have some value for goods based roughly on my old formula. Markets will trade with all the surrounding industry and with all adjacent markets. Locally, this will also inform production.


== Governments ==
This is also where government and religion are established. Religion is established first with a smoothing algorithm. Something like 1 religion for every 10 temples, each gets a random religion and each will switch to the dominant nearby religion. Each city state has a government. We can compute the military strength based on resources and policies. One city state can rule another based on strength and distance (from the capital city). It should balance that as more city states are taken in, the capital gains more power, but it's trying to control ever more distant cities. Religion and trade will also influence this. It's easier to for the capitol to control a city with similar religions and with more trade routes to controlled cities (by trade volume).
Governments control all people living withing a region they rule. Initially, the only government will be monarchy, but later I'd like to bring in theocracy, military rule, aristocracy and republic.


A lot of this is taken from Civ. A government may be aligned with a religion. The benefits are that citizens with that religion are happier, but citizens with other religions are persecuted (and taxed higher). It also reduces the likely hood of war with another country of the same religion.
== The Big Show ==
At this point we have everything but people. So we populate everything. Now we're pretty much running the same simulation but on a smaller time scale and attributing specific actions to individuals with some additions.


A government will set a number of laws - inheritance, draft. They will also set tax rates on income and exchange.
Each unit belongs to some number of institutions. So a farmer belongs to their farm and possibly market, religion or state. Each of these will influence their actions. The farm will compel them to tend to the fields, the market to bring goods for trade, the religion to pay a tithe or celebrate festivals, the state to pay taxes and join militias.


Governments will have a sort of genetic code describing all this. When a new government forms, or citizens demand change, two nearby successful governments will be used as 'parents'.
=== Tech ===
There will be a tech tree. When something is discovered it can spread directly with in a region or between regions via a trade route.


The goal of the government is to control more land. They must balance their investment between placating citizens, protecting the borders and attempting to expand.
=== Crime ===
I'll add bandits, highway men and raiders. Military personnel are used for peace keeping.


=== Duchies ===
Raiders can also form a horde and eventually conquer city states.
Just a thought. Large governments could be divided into duchies. This would allow for more local control and could potentially reduce the overhead costs but at the risk that a duchy may declare itself independent. Also, if the government is overthrown the duchies all become independent nations.


== People ==
=== War ===
People are the base unit. The higher order constructs must act through people.
The military is an abstract concept, it sets strategy. Soldiers belong to the military, but citizens can become militia. Each unit has military prowess and armaments. Things like hunting increase military prowess, though military drilling increases more. A military may go to war, guiding the individuals that belong to it to take action. Units will then fight. The outcome of a fight is that each unit takes some degree of damage. Damage has immediate and long term consequences. So one wound may prevent a unit from further fighting but heal with no consequences while another wound may allow them to keep fighting, but prove fatal.


=== Farmers ===
There also needs to be a military hierarchy. The state is at the top, branches within the military form from there. Some aspect of the state will determine how the military is shaped. Those ideas can spread culturally. So a country may decide to invade another territory (city-state), it will then assign some of it's divisions to invade. It needs to be able to make a reasonable choice about which divisions to use, it needs to first group and maneuver them, then execute the attack.
Owns a farmhouse and some land. Family members work the farm, can also hire farm hands. Certain goods provide a bonus. One person can till one tile per day. But for every work-animal + plow, they can till 10 tiles. I want to throw in a number of concepts - crop rotation, blight, fertilizer. Different crops will have different times to mature, so farmers need to plant different things at different times otherwise they won't grow or the farmer won't have enough time.


=== Miners ===
A defending region may call up a militia. A militia may have a training regimen.
A mine will produce some quantity of ore when it's started, and that quantity will drop asymptotically over time. Mines will also occasionally produce gems.


=== Lumber Jack ===
==== Conquest ====
They will buy and clear land producing wood and when the land is cleared, sell it to farmers. Farmers can also hire lumber jacks to remove trees from their land.
One country can decide it wants to conquer another and will have to invade and take over the capital building


=== Crafters ===
==== Rebellion ====
Produce goods. This include smelters producing iron bars, blacksmiths producing goods, carpenters, builders. Gem carvers. Basically all the DF stuff.
A city state can rebel against it's capitol and form an independent state.


=== Rulers ===
=== Religion ===
Needed to run a government
Religions will have different aspects.
* liberal/conservative; more liberal benefits markets, more conservative benefits military
* orthodox/non-conform; tweaks the rate of cultural mutation


=== Priests ===
=== Government ===
Needed to run a religion
Issues currency. Taxes trade. Uses taxes to buy goods to support government and military.


== Monuments ==
== Roads and Travel ==
Increases happiness/pride for citizens. A monument can be a building, a statue or something functional (wall or damn). And will receive bonuses based on that.
This is used at three different stages.


== Military ==
Any tile that isn't a structure can be traveled on. Travel can turn tiles into roads and more travel increases the quality of a road until it reaches "trail". From there, governments need to undertake paving the road. Different types of travel happen at different speeds on road. So walking speed is the same on a trail as on a paved road, but horses go a little faster and wagons go much faster.
A military belongs to a government. Later, I may want religious military's and mercenaries, but not initially. A military will have a type - foot, archer, cavalry and Civ type bonuses. It will have some number of units assigned to it. The most senior member will be the leader. Over time, members will more and more resemble their leaders, this should leave a legacy in the squads.


Military's are given assignments from their government. They can be set to patrol an area or attempt to sack a tile. If they sack the tile in which the capital is located, the entire government is overthrown.
Water travel is different. There's a cost for transitioning between land and sea. Current and wind determine how fast one can travel.

Latest revision as of 19:49, 28 December 2017

Base Units

  • people
  • governments
  • military's
  • religions
  • goods
  • Monuments
  • terrain

Governments rule lands and people. Religions influence people and governments. Governments collect taxes, religion collect tithes. Governments also have military's. Military's enforce laws, protect citizens and fight wars (conquer or protect territory).

https://mewo2.com/notes/terrain/

https://github.com/esimov/triangle/blob/master/delaunay.go

Goal

The idea I've had is to build a large scale simulator and let it run through a few hundred years. Then go through and extract interesting story lines. This provides the outline of a story. Further, it provides a database of exquisite detail. You can follow a sword starting with the iron that is mined, to the smelter, the weapon-smith, the seller, who carried, which swords were forged before and after, who was slain by it and who was slain while carrying it.

Finally, this outline and these tools can be provided to a few authors and editors. They can add details (like character descriptions). Then each paragraph can be written independently a few times, then those drafts can be combined.

Pipeline

The pipeline allows each pass to be simple and I can replay making sure each improves the process.

Tectonics

Creates the base grid, lays down minerals and igneous rock. Then it creates tectonic plates and shifts the rocks around. Finally it does a rough diamond smoothing pass.

Hydrology

Sets the ocean level so that 1/2 the land is covered by water.

Air currents are established, this can be refined over time to take geography into account, but initially just set alternating bands. Each square has moisture and temperature. If the moisture is less than 100% and the tile has water on it, enough water will evaporate to move 50% of the way to 100%. If the moisture is more than 100%, it will precipitate down to 100%.

The water on the tiles flows and carries sediment. Each tile looks at the previous iteration for inflow. The flow is reduced by a fixed amount (~10%). Then the slope of the tile is used to increase the flow. Tile height is computed by the top of the water, not the top of the land. Outflow can go to 3 tiles at most.

Sediment is determined by flow rate. There's a linear relationship to how much sediment can be carried and how fast the water is moving. Just like humidity, if the rate is too high, sediment is deposited. If it's too low, it's picked up. The sediment composition is also tracked.

I think this is where I should add soil development as well. I won't simulate organisms, but I can use light (at the land surface to exclude deep sea), temperature water and mineral diversity to convert some percent of the surface mineral deposit to soil and track the soil quality. I could add a basic "plants" mechanism to simulate the root systems resisting erosion. I need to think about how to do this, but I think it's something like have a plant mass based on soil, water and temperature. Plant mass absorbs water, reduces flow and reduces erosion. When plant mass decreases, it's translated directly to high quality soil.

Ecosystem

At this level detailed plant growth is tracked and so are individual animals and some evolution.

Each tile contains one "plant", though that may be a single tree or a few meters of grass (I need to decide how big a tile is). I need to figure out plant rules.

Species

Everything has a species - a string that represents what they are. When there's a mutation, there's a chance of the species string changing. Two creatures can only mate if the species string is close.

Grass

Grass trades (evolution) hardiness for ability to spread. There are dials for moisture, temperature and soil quality. A grass tile has a chance to die based on it's hardiness and it's conditions. It also has a chance to spread to any adjacent barren tile. So one species of grass may not be hardy but can spread through temperate climates fast. Another species may be very hardy, but will be slow to spread only dominating the harsher climates. Any time it spreads there is a small chance of mutation.

Shrubs

Shrubs produce berries and the seeds are spread by animals. When a seed lands on a barren or grass tile, it has some chance to spread. It also has a hardiness rating that determines it's odds to grow. The rate of berry production is both genetic and based on light and water. There will be an actual berry count on the shrub, with a max.

Trees

Similar rules to shrubs, but they go through a life cycle. A sapling can easily be killed. An adult tree cannot. Only an adult tree can produce nuts. Trees can hold on to large reserves of nutrients and water, allowing them to survive through brief, harsh weather.

Bee hive

A bee hive increases the reproduction rate of all plants within X tiles. A bee hive will not form within Y tiles of another bee hive. Bee hive has tolerance and random chance of death, it's health is determined by how many plants are near by.

Ruminants

These eat grass. Any tile with a ruminant on it has both a higher chance of death and a higher chance of spreading. Ruminants will have a lot of evolutionary knobs. Size, armaments (antlers), gestation, sociability.

Birds

Similar to ruminants in species and evolution. Birds eat berries from shrubs and nest in trees. A bird cannot nest on a tile with a bee hive. It will eat randomly from berries in range of its nest and deposit seeds randomly in the same range.

A nesting pair will occasionally produce offspring. Once the offspring is grown, it will either seek a nesting spot or a mate (a single with a nest).

Squirrels

Similar to ruminants. A squirrel moves tiles, always staying on tree tiles. It can eat from any tree within X and will can randomly (~1%) plant a tree within the same distance.

Fox

Will eat birds and squirrels

Wolf

Will eat ruminants and foxes.

Disease

Has a virulence, a species key (can affect certain species) and mortality and survival rate. These are different. Mortality is the chance of dying when something is sick and survival is the chance of getting better.

Structures

Here we place and grow structures. Any of these structures can take up multiple tiles, but at least one of the tiles needs to touch a "road" tile. Each structure is part of a trade network. So a farm will be connected directly to any bakery or market nearby.

Start by placing some production - farms, mines, logging and hunting grounds. Then we start placing industry based on what's around; each has high value and a low value industry. The idea is that trading for primary needs is too expensive, but it's ok for secondary needs. Also, there's a penalty to being to close to competition, but that can be overcome with enough resources and demand.

We will also start developing trade routes. We can simulate trade based on need and run my roads algorithm. We can also develop naval travel by developing docks and adding that to the algorithm.

From here we can start adding higher culture. Religion, trade and government. Religion will build templates, government will build courts and military bases. Trade will build markets and docks. Markets will form a Voronoi diagram so that each market controls a region and will establish trade routes with all adjacent markets.

  • Farm: Grasslands based on soil quality
  • Foraging grounds: animal life, trees and shrubs
  • Logging: trees
  • Mines: metal ores
  • Bakery: Farms, hunting grounds
  • Blacksmith: Mines
  • Carpenter: Logging
  • Workshop: blacksmith, carpenter
  • Markets: roads
  • Docks: special parts of road system where roads transition to water
  • Temples: markets
  • Government: markets and temples
  • Military: government

Roads are developed from local and trade travel. Local travel represents direct transit like a farm taking goods to either a market or a bakery. It develops roads very slowly. Trade represents travel between markets and produces a much higher rate of development.

All structures value bakery, workshop and all cultural buildings because everyone needs food, things and culture.

Need a way to asses "value" and abandon structures that are not valued in proportion to their surroundings.

So if this works correctly, it will iterate developing city states. The first passes will create production, then industry. As the local roadways develop, markets will develop and then trade routes and finally higher culture.

Perhaps to add later

  • University
  • Entertainment

Specialization

At this level we start adding specialization to the structures. Farms start planting specific crops, loggers start cutting down trees, mines produces specific ore and foragers are interacting with animals and plants. There will also be a species like evolution to strategy. So one farm may choose aggressive farming practices and another more conservative and if one goes bankrupt, the other can spread. Or loggers can develop an ideal forest density.

Each farm needs one tile for the "farm" and then each additional tile can be an animal or crop.

Bakeries, carpenters and blacksmiths can produce any goods, but based on their tools and what their skill, they will produce different quality goods.

This is also where we'll introduce traders. Each market will have some value for goods based roughly on my old formula. Markets will trade with all the surrounding industry and with all adjacent markets. Locally, this will also inform production.

This is also where government and religion are established. Religion is established first with a smoothing algorithm. Something like 1 religion for every 10 temples, each gets a random religion and each will switch to the dominant nearby religion. Each city state has a government. We can compute the military strength based on resources and policies. One city state can rule another based on strength and distance (from the capital city). It should balance that as more city states are taken in, the capital gains more power, but it's trying to control ever more distant cities. Religion and trade will also influence this. It's easier to for the capitol to control a city with similar religions and with more trade routes to controlled cities (by trade volume).

The Big Show

At this point we have everything but people. So we populate everything. Now we're pretty much running the same simulation but on a smaller time scale and attributing specific actions to individuals with some additions.

Each unit belongs to some number of institutions. So a farmer belongs to their farm and possibly market, religion or state. Each of these will influence their actions. The farm will compel them to tend to the fields, the market to bring goods for trade, the religion to pay a tithe or celebrate festivals, the state to pay taxes and join militias.

Tech

There will be a tech tree. When something is discovered it can spread directly with in a region or between regions via a trade route.

Crime

I'll add bandits, highway men and raiders. Military personnel are used for peace keeping.

Raiders can also form a horde and eventually conquer city states.

War

The military is an abstract concept, it sets strategy. Soldiers belong to the military, but citizens can become militia. Each unit has military prowess and armaments. Things like hunting increase military prowess, though military drilling increases more. A military may go to war, guiding the individuals that belong to it to take action. Units will then fight. The outcome of a fight is that each unit takes some degree of damage. Damage has immediate and long term consequences. So one wound may prevent a unit from further fighting but heal with no consequences while another wound may allow them to keep fighting, but prove fatal.

There also needs to be a military hierarchy. The state is at the top, branches within the military form from there. Some aspect of the state will determine how the military is shaped. Those ideas can spread culturally. So a country may decide to invade another territory (city-state), it will then assign some of it's divisions to invade. It needs to be able to make a reasonable choice about which divisions to use, it needs to first group and maneuver them, then execute the attack.

A defending region may call up a militia. A militia may have a training regimen.

Conquest

One country can decide it wants to conquer another and will have to invade and take over the capital building

Rebellion

A city state can rebel against it's capitol and form an independent state.

Religion

Religions will have different aspects.

  • liberal/conservative; more liberal benefits markets, more conservative benefits military
  • orthodox/non-conform; tweaks the rate of cultural mutation

Government

Issues currency. Taxes trade. Uses taxes to buy goods to support government and military.

Roads and Travel

This is used at three different stages.

Any tile that isn't a structure can be traveled on. Travel can turn tiles into roads and more travel increases the quality of a road until it reaches "trail". From there, governments need to undertake paving the road. Different types of travel happen at different speeds on road. So walking speed is the same on a trail as on a paved road, but horses go a little faster and wagons go much faster.

Water travel is different. There's a cost for transitioning between land and sea. Current and wind determine how fast one can travel.