CRS1 (Colony Renegades Starship 1)
Currently programming for this colony game is in progress.
The current verson of the colony is a LoS type. I am thinking about changing it entirely to CRL1.
Below is my progress of the AI, and some issues that need to be addressed might also be included. Feel free to comment.
----------------------------------------------------------------------------
The AI has a fixed research and building order, just like the default AI systems of OP2. There's 1 exception: the location where buildings are placed IS randomized. The AI has a list of predetermined locations, at which it can place structures. The items in this list state the maximum size of a building spot, so the AI can find a suitable location, since it "knows" the size of the building it wants to deploy.
At certain times it will wait for a research to be done, before continueing with building instructions. For example: the first GP has to wait until MicroWave or Laser has been discovered (for obvious reasons). This ensures that the AI can always build the structure.
Currently, the AI is set to what is called "AI mode" in Outpost2. This means, that morale has been deactivated, and the AI has 4096 workers, 4096 scientists and 256 children. It has the ability to construct any and all kinds of units at the factories, no matter if the required tech has been researched or not.
However, my AI code puts a limit on the number of scientists it uses for research, deducting scientists whenever the nursery and/or university are operational. The number of scientists slowly decreases as long there is no university. Once a university is active, the AI will ad 1 scientist after each second technology has been researched.
Likewise: there are checks to determine if the AI has researched the required technologies, before building any units, making sure all is fair.
Power and ore have no specific "AI mode" settings, which means if there is a power shortage, there will be buildings idled. Currently, there is no code in place to detect power shortages, but the AI does have code to repair damaged buildings, and it will replace lost buildings either due to disaster or by enemy forces.
Same goes for ore: if there is not enough ore available, it cannot construct units. Walls are contructed whenever there is enough ore to spare. Currently the treshold is at 8000 common ore. Whenever there is enough ore, the AI will build a wall section. These sections should be kept rather small, a dozen tiles at most to reserve as much ore as possible, but still building the walls. After each research is done, the AI will check the ore balance and will build a new section of wall, even if the previous one isn't finished yet.
Whenever the AI orders a building to be recorded (=placed into the building list for construction), it will check to see if the location has tube access. If it doesn't an earthworker will be sent to build a tube. Currently all tubes are predetermined. In later versions, the AI will try to make the shortest possible tube connection.
Every 5 time marks, the AI will check all buildings (except GPs) for damage. If a damaged building is found, the closest idle convec is located and sent to repair it. Currently the AI will only repair 1 building at any given time. If a structure kit is ready, any convec that is repairing a building can be interrupted to pick up the kit and start constructing the building. The repair will have to wait till a later time, when there is another convec idle. GuardPosts are not repaired, due to explosion danger.