Siesta, pls tell us every now and then how you progress with plans and making the new AI+...
You know, some short "developer's notes/diary"... on a weekly dose...
Sure, why not. Well, maybe not weekly, but I can give you one now.
Basically right now I'm still in the exploratory and infrastructure phase of the new version.
The newly discovered lua possibilities have a lot of potential power, but it's as of now still uncertain how much control they give exactly. There are basically two main things I can now explore. I can make cities build things based on lua code, and I can use unit 'operations'.
These operations are used in vanilla civ to send groups of units to enemy cities, and to settle spots, as well as some other things. Luckily, these are very customizable thanks to the 'behaviortrees' system, and because I can now both start operations at will, along with target coordinates, and with the exact units it should contain, I can actually hijack this system and do things with it that were probably never really intended.
What I'm attempting to do, is to use these operations to control individual units instead of groups. Because they support target coordinates, a move command, an attack command, a settle command, as well as some others, I can now order individual units around the map. This allows me to fully take over all macro movement of units, as well as some part of the micro.
Unfortunately, the way operations are executed leaves some room for the inbuild AI to make decisions. These operations could be seen as 'guidelines' that I can now give the AI. But since it doesn't listen perfectly, it causes some issues. For example, if I tell the AI to move a unit one tile using these operations, the AI can decide after that to move its unit back to the tile it came from. Similarly, I can give an 'attack' guideline, but it might still decide to attack another unit, or might be too scared to attack.
It's also impossible (not sure yet?) for me to order moves in any way, which makes micro unpredictable. A common ingame scenario might be to have these units: -RM-E where R is a ranged unit of mine, M is a melee unit of mine, E is an enemy, and '-' are empty spots. It tends to be wise to first move the melee unit to the empty tile, then move the ranged unit and shoot, and then attack with the melee unit.
But unfortunately, since I can't order things as I want them to, it might up trying to walk with the ranged unit first, and since the intended tile is blocked, the inbuild AI may then decide to actually move it somewhere else.
So instead of the intended result with a unit kill: --RM-
It may end up resulting in this instead: R--ME in which case I not only missed out on a kill, but leave my melee unit in a place it might die and my ranged unit useless.
Because of stuff like this, most of my efforts so far are in two areas:
- Find out how to maximize the amount of direct power I can assume without having the inbuild AI overrule me and without it doing weird stuff like double moves / stacking units that shouldn't be stackable.
- Build an infrastructure to allow me to make decisions. For example: writing a system to analyse where units can move based on terrain, or writing a system that allows me to easily access information and make high level decisions.
There's a lot of stuff that goes into civ, and since there are no tutorials or documentation for most of this, it's rather time intensive work, but it should pay off in the end. Exploration & infrastructure are generally the most important aspects of making a bot that works well and which can be easily maintained.
The next phase, which will start when I'm satisfied I've exhausted the possibilities, will be to start making some actually reasonable decisions. Right now all my heuristics are very simple and just to confirm that what I'm trying to get the units/cities to do is actually having the anticipated effect. It's currently still very far from even the vanilla civ in terms of capabilities because of it (except for the settling spot evaluation, which already seems better than the default).
I'm hoping that this phase will be relatively smooth sailing once I've got a proper architecture down and I should be able to quickly surpass the vanilla AI in several areas once I'm far enough to start tweaking this.
In later phases, I'll try exploring some additional areas. Like there seems there might be room to allow me to decide what improvements to prioritize, and something that might allow policy decision making, but I haven't really looked at these yet.
After that, I'm hoping to reintroduce unique behaviors for civs, unique strategies, etc.
While building this, I'm trying to keep mod compatibility in mind. For example, the way I handle units should be as generic as possible, to make sure the mod doesn't break upon introduction of some new UU. I do take a few shortcuts here and there where I don't really expect mods, or when it'd be too time draining to take everything into account (like all ways of making modded wonders).
Because the scale of possibilities here is much larger than in xml, I might consider trying to turn this project into a bit more of a community project if others are willing to help. I'll first set up a solid basis though so that people will have something to work with