Yes, it was the point of wander not being a goal is that it is never assigned to a hero or prioritized. So whatever goal AI has, it will decompose it before wandering.
Does conquer touch neutral towns and mines?
Yes it does. This is quite clear.
auto conquerable = [](const CGObjectInstance * obj) -> bool
{
if(cb->getPlayerRelations(ai->playerID, obj->tempOwner) == PlayerRelations::ENEMIES)
{
switch(obj->ID.num)
{
case Obj::TOWN:
case Obj::HERO:
case Obj::CREATURE_GENERATOR1:
case Obj::MINE: //TODO: check ai->knownSubterraneanGates
return true;
}
}
return false;
};
(Neutral player is also considered enemy here.)
Why build is not a subgoal of win?
Build is not a subgoal of win. Win is decomposed based solely on game rules. Game rules don’t tell that you win if you just build, unless there’s special win condition like build Grail.
The proper solution would be to make build a subgoal of Gather Army or Gather Resource, for instance, as this is according to game rules. Still, there are some buildings that don’t give you creatures or resources, and it’s nice to build them anyway - but not as a subgoal to Win.
Goals only analyze gamestate and produce tasks. Tasks do actual things. Goals never do anything, only analyze. For now if build decides to build something nobody can stop it.
This makes perfect sense to me, however how do you handle circular dependency? Gather army -> capture dwelling -> gather army or explore -> move to guarded tile -> gather army -> explore?
When a goal produces a task it assigns some priority 0…1 The parent goal also assigns priorities to child goals. When task pops up to the parent goal the priority is divided by 10 and the child goal’s priority is added. If the child goal has priority 0.7 and its task has 0.5 the final priority is 0.75 All the tasks produced by the child goal will be in range 0.7…0.8. Also I think to add scaling so that range can be any within 0…1
This is pretty interesting, however feels very arbitrary. Where do these values come from?
Now fuzzy handles only visit tile
Yes, however 99% of AI actions actually end up in visiting tiles. I would like to employ fuzzy logic more, but it may be tricky to evaluate completely different types of goals, such as build.
All the rest priorities are hardcoded, right?
As above, we would like to avoid hardcoded values whenever possible.