A screeps world is composed of many rooms. You start as the god of the room. What do you do ? You create a distopian democracy.
Sssh bby is ok.
The cruel world of screeps is ruled by the almighty tick. Which means that everything gets reconsidered every few seconds.
We will start by creating a Government. This Government will plan a set of Strategies that will be the base of how works the society.
This Main Strategy determines the minimum requirements for society to work. How many people (creeps) need to be born (spawned); Also what will their job be, what should they do. Also what institutions/buildings (structures) are needed for society to work a minimal speed.
Each tick, this Main Strategy will be ran and will adjust the population/structures/jobs accordingly to the plan (called a quota)
Each tick, the Government will also elect a Strategy to be run alongside the Main Strategy. Those Situational Strategies work the same as the Main Strategy, taking a quota to adjust the population/structures/jobs.
Once elected Situational Strategy will run for a minimal amount of tick during which no other strategy can override it (except during "War State"). Afterwards another election will occur, choosing the next strategy to be run. A strategy can be re-elected any number of times if need be.
How does a strategy gets elected ? First it needs to get onto the Election List (or queue).
Any structure, creep or even strategy can send a message through the Network. According to the signal, it will act as a vote for a desired Situational Strategy. For instance, if a structure sees ennemies getting near it can send a distress call through the Network, voting for the Defensive Situational Strategy. At the same time, maybe the Boot Situational Strategy that was running has finished and sent a vote for the Generic Expansion Situational Strategy
We have this Election List:
- Boot (Ran at the start of the game to boot things up. Currently running)
- Defensive (Adjust the population/structures and raises defenses against attacks. Not running)
- Generic Expansion (Adjust the population/structures to gather more and more energy, create extension, containers, create minimal defenses, attack forces, scouts, etc... . Not running)
So how is the choice between the candidates on the election list done ? Randomly as it should ? Hell no ! Not all strategies are born equal and some have more weight than others. Also some take longer to run, and some take more energy. Those criteria will help the system decide which strategy will be chosen, but the most important factor is the weight. Currently we could assign those weights :
- Boot : 10
- Defensive : 8
- Generic Expansion: 4
The chosen one would be Boot, because it is essential to have something on the field already so it has the highest weight. But as we said, Boot called upon Generic Expansion to take its place. Boot is done and will be disregarded. Instead Defensive will be chosen because its weight is much higher than Generic Expansion.
So next tick and for the ticks to come, the Defensive strategy will be ran alongside the Main strategy.
Each Strategy has a minimal energy requirement. This is the energy needed to perform its most simple action. It has also an energy limit which is a percentage of the total room available energy. It can only use energy up to this limit. Each tick, the government will give budget (energy) to each strategy, according to their demands/limits.
A strategy has an energy bucket in which it can store energy which can not be used by any other strategy. This bucket is used to save up energy to complete demanding tasks.
By default we have the following :
- Main Strategy : 20% of available energy or at least 300 Energy
- Situational Strategy : 80% of available energy - 300 (Main strategy reserved energy)
Add a newsfeed so that every citizen can now what has happened (we are under attack, we are missing people near the mines) to help with the decision making. Multiple substrat should be able to run at the same time, sharing resources.
Newsfeed contains events that needs to be coded.