ylg_hke
Skirmisher
posted 09-11-18 10:08 AM
EDT (US)
176 / 406
hmm, not sure what you really meant by"because of the way they are handled after being generated", but I meant:
-all plans have no specific target types => very inefficient
-all troops are grouped in 1 group
-passing enemies by
-ignore enemies' forward barracks
-get outnumbered because they never perform all-out attack<--because of "rule defend0"
....and the list goes on.
[I thought we could find flaws and fix them before actually making anything new]
<==Exactly! Actually, its what we have been doing, haha.
* At some point there are negative percentage for resource gathering.
<== oops i didnt know.
* ES gave way too much importance to wood.
<== Its true for Dutch, but not so sure about other civs, I have to record a few more games to confirm this.
* Even when there are no more wood on the map
<== Yes, a well known problem, we have to fix it.
* On Ceylon they never get to the main island
<== hmm....I guess we have to worry about transport plan first, because we disabled opportunity destory...?
* When there are less than 200 animal food per gatherer....
<== I guess its from "foodbreakdown"? I havent study it throughly yet...
* Maintain plans can train any unit from any building, as long as both are enabled in the techtree.
<== What!? What about training factory wagons ?
BTW, I would like to learn the criteria of using something like XXXX();
the following is from "age2Monitor"
=====================================================
if (xsIsRuleEnabled("militaryManager") == false)
{
xsEnableRule("militaryManager");
aiEcho("Enabling the military manager.");
militaryManager(); // runImmediately doesn't work.
}
=====================================================
militaryManager is a rule, and I have made a rule named BarracksStableMonitor, but why only BarracksStableMonitor(); gives error?
AlistairJah
Skirmisher
posted 09-12-18 01:22 AM
EDT (US)
179 / 406
I'm not sure but I think I have seen in N3O AI multiple groups, which certainly means that several plans have been auto-generated. That's why I was sure it's possible to split armies into several groups... Gonna check it when I have time.
Would you mind writing all of your todo? I'm interested in your AI tbh
ylg_hke
Skirmisher
posted 09-12-18 03:38 AM
EDT (US)
180 / 406
Let me know if you find out, that could be pretty useful.
hmm..I think we have already listed out most todo, the rest are really strategies/rules for specific civ, eg: dance monitor for natives, also cards/deck.
Anyway, regarding shooting huntable, the biggest problem is the conflict between different tasks, after "aiTaskUnitMove", the villager will go back to the original duty within seconds, never reach the destination.
How do we release the villager from the original duty?
Also, actually "aiTaskUnitWork(HunterID, PreyID);" succeeded in assigning the villager to hunt
, without returning to the original duty.
so, I guess "aiTaskUnitMove" was being regarded as some sort of idling..?
=====================================================
int getUnitByLocationSorted(int unitTypeID=-1, int playerRelationOrID=cMyID, int state=cUnitStateAlive, vector location = cInvalidVector, float radius = 20.0, int order = 0)
{
int count=-1;
static int unitQueryID=-1;
//If we don't have the query yet, create one.
if (unitQueryID < 0)
{
unitQueryID=kbUnitQueryCreate("miscGetUnitLocationQuery");
kbUnitQuerySetIgnoreKnockedOutUnits(unitQueryID, true);
}
//Define a query to get all matching units
if (unitQueryID != -1)
{
if (playerRelationOrID > 1000) // Too big for player ID number
{
kbUnitQuerySetPlayerID(unitQueryID, -1);
kbUnitQuerySetPlayerRelation(unitQueryID, playerRelationOrID);
}
else
{
kbUnitQuerySetPlayerRelation(unitQueryID, -1);
kbUnitQuerySetPlayerID(unitQueryID, playerRelationOrID);
}
kbUnitQuerySetUnitType(unitQueryID, unitTypeID);
kbUnitQuerySetState(unitQueryID, state);
kbUnitQuerySetPosition(unitQueryID, location);
kbUnitQuerySetMaximumDistance(unitQueryID, radius);
kbUnitQuerySetAscendingSort(unitQueryID,true);
}
else
return(-1);
kbUnitQueryResetResults(unitQueryID);
int numberFound=kbUnitQueryExecute(unitQueryID);
if (numberFound > 0)
return(kbUnitQueryGetResult(unitQueryID, order));
return(-1);
}
rule ShootHuntable
active
minInterval 5
{
vector mainBaseVec = kbBaseGetLocation(cMyID, kbBaseGetMainID(cMyID));
vector PreyLocation = cInvalidVector;
int PreyID = -1;
int HowFar = -1;
PreyID = getUnitByLocationSorted(cUnitTypeHuntable, cPlayerRelationEnemy, cUnitStateAlive, mainBaseVec, 100, 9);
PreyLocation = kbUnitGetPosition(PreyID);
HowFar = distance(mainBaseVec, PreyLocation);
if(HowFar < 25)
{ return; }
int HunterID = -1;
HunterID = getUnitByLocationSorted(gEconUnit, cMyID, cUnitStateAlive, PreyLocation, 100, 0);
aiTaskUnitMove(HunterID, (PreyLocation + (PreyLocation * 0.3)));
//aiTaskUnitWork(HunterID, PreyID);
}
==========================================================
ylg_hke
Skirmisher
posted 09-12-18 03:08 PM
EDT (US)
184 / 406
Honesty, heavy cav not ignoring nearby troops is a huge problem in mid-late game, I mean most of us would simply ignore troops, and send gendarmes/hussars to kill factories and villagers...etc.
AlistairJah
Skirmisher
posted 09-12-18 11:00 PM
EDT (US)
185 / 406
Well you can flag the plan as "cavalry" or anything you want, using user plan variables, and make codes to decide when to focus on target and when to respond. You can make as many flags as you want, if you want to have further control. A random idea that I have is make at least two rules: the first one monitors plans (create/destroy) and the second one controls those plans' units in real time (more or less in real time). What do you think?
ylg_hke
Skirmisher
posted 09-12-18 11:15 PM
EDT (US)
186 / 406
A random idea that I have is make at least two rules..
<== good idea! I will do the same.
ylg_hke
Skirmisher
posted 09-13-18 00:58 AM
EDT (US)
188 / 406
All agreed!
Regarding econ, IMO one of the biggest problem is that villagers spend more time on walking than on working. IDK what to do about it yet.
* Building placement
=> IMO only wonders, factories, barracks , stable need special handling, the rest can simply rely on cBuildPlanInfluenceUnit around the TC.
* Escrows
=> No sure what u mean exactly...
* Determine when can the AI "go berserk
=> once they reach age2, as long as they can maintain villager production & market upgrades.
One of their biggest advantage is that they reach age2 eariler, it would be bad if we allow humans to boom/to mass their troops.
IMO it is more like when to stop AI being berserk, and how.
eg: to tell AI stop making anymore troops.
We probably have to set up something to prevent AI from easily reaching:
gAgeUpResearchPlan = createSimpleResearchPlan(politician, -1, cEmergencyEscrowID, 99);
* Switch between several bases if the AI is attacked.
=> No sure what u mean exactly...
But IMO:
check our mainbase first (if its not OK, destroy all attack plans)
if its OK then check the farthest ally's mainbase (if its not OK, destroy all attack plans)
if its OK then check forward barracks (if its not OK, destroy all attack plans)
if its OK then create attack plans
AlistairJah
Skirmisher
posted 09-13-18 01:11 AM
EDT (US)
189 / 406
> Escrows
Nevermind ^^'
Yeah, when to stop is a way better idea LOL. Settler maintain plan should have the highest priority on resources, and econ upgrades come after. Later on, their econ should be good enough to afford military upgrades without being led to starvation. It's not like they have anything else to spend resources on, anyway.
> Between bases
Avoid making buildings in attacked bases. Humans can easily find good places for buildings if they are under attack, but AIs...
I would really like to test the "micromanagement" plan asap, to be honest. But dunno, could turn out to be a bad idea...
AlistairJah
Skirmisher
posted 09-13-18 02:11 AM
EDT (US)
191 / 406
Gonna test it asap. Moving eco seems a little complicated but it's definitely worth trying.
I'm pretty sure it's possible to control AI's units in real time...
ylg_hke
Skirmisher
posted 09-13-18 04:03 AM
EDT (US)
192 / 406
I'm pretty sure it's possible to control AI's units in real time...
=>Good! Then we'll be able to make use of Unction & Tokugawa.
ylg_hke
Skirmisher
posted 09-13-18 07:25 AM
EDT (US)
194 / 406
Haha, we still have a lot of things to do, our todo is not even half-finished.
btw, we probably should add a new waypoint for the explorer, for maps like yukon
=========================================================
vector HomeLocation = kbBaseGetLocation(cMyID, kbBaseGetMainID(cMyID));
vector Offset1 = kbGetMapCenter() - HomeLocation;
vector Offset2 = kbGetMapCenter() + Offset1;
vector HeroWayPoint = cInvalidVector;
HeroWayPoint = xsVectorSetX(HeroWayPoint, xsVectorGetX(Offset2));
HeroWayPoint = xsVectorSetZ(HeroWayPoint, xsVectorGetZ(HomeLocation));
==========================================================