You must be logged in to post messages.
Please login or register

Modding Discussions
Moderated by Alexastor, MosheLevi, Mister SCP

Hop to:    
Welcome! You are not logged in. Please Login or Register.385 replies, Sticky
Age of Empires III Heaven » Forums » Modding Discussions » Idea: Let's start a "Better AI project"
Bottom
Topic Subject:Idea: Let's start a "Better AI project"
« Previous Page  1 ··· 8 9 10 11 12 ··· 16  Next Page »
murdilator
Skirmisher
posted 09-22-12 06:52 AM EDT (US)         
EDIT:

Here are links to The Beginner's Guide to AI Modification, written by me:

Part 1:

http://aoe3.heavengames.com/cgi-bin/forums/display.cgi?action=ct&f=14,38878,,10

Part 2:

http://aoe3.heavengames.com/cgi-bin/forums/display.cgi?action=ct&f=14,38885,30,100


------------------------------

Original Post (9-22-2012, 06:52 AM)

I have an idea that we can significantly improve the AOE3 AI. This will of course build from the Drauger AI. I have made a decent AI in my mod N3O Fan Patch, but it currently uses some techs that I have added to the game, so it won't work yet for an unmodified Age of Empires III. Yet I can easily remove those techs with some testing (to make sure it works) so that it can be played on an unmodified AOE3 and furthermore be a base rubric for further AI improvement.

http://aoe3.heavengames.com/downloads/showfile.php?fileid=3363

Mandorex also has an improved version of the Drauger AI:

http://aoe3.heavengames.com/downloads/showfile.php?fileid=3222


I also noticed another Drauger AI improvement uploaded for Vanilla AOE3 which makes the computer build forward bases. This would be interesting to look into, but I do say that this is quite a job for one coder. However, what I suggest is that we make it a community project to sort of build off an already improved AI and (for those who have time) fix various issues. I myself am pressed for time otherwise.


Anyone for an idea such as this!


Feel free to discuss and share your ideas! Its best if we discuss before we actually decide anything big.



best of regards to all here,




murdilator

[This message has been edited by murdilator (edited 06-23-2013 @ 10:35 AM).]

AuthorReplies:
ylg_hke
Skirmisher
posted 09-16-18 10:05 AM EDT (US)     226 / 385       
Then what will happen if we assign multiple building IDs to a train plan?

I mean, can we get the queue size of each building?


Anyway, our last resort is one train plan for one building, at best we will have like 6 train plans, i hope it wont be a CPU hogger.

[This message has been edited by ylg_hke (edited 09-16-2018 @ 10:26 AM).]

AlistairJah
Skirmisher
posted 09-16-18 10:27 AM EDT (US)     227 / 385       
Why would we assign multiple building IDs for a train plan? Wouldn't that mess things up?

1 plan = 1 unit type = 1 building type (but 1 building ID can be used by several plans)

With this, counting units should be super easy.

If numberBuildings > numberPlans, just make sure that those buildings have their own plan too, and destroy plans if buildings are destroyed.

EDIT:
Anyway, our last resort is one train plan for one building, at best we will have like 6 train plans.
That's what I was trying to tell you since 3 posts earlier...

[This message has been edited by AlistairJah (edited 09-16-2018 @ 10:36 AM).]

ylg_hke
Skirmisher
posted 09-16-18 10:55 AM EDT (US)     228 / 385       
If it has variable indexes, theoretically assigning multiple building IDs should be fine?


That's what I was trying to tell you since 3 posts earlier...
==>
yea you mentioned in Post217 but honestly that could be a bit ambiguous, just to make sure we are on the same page, I meant:

Lets say, we have 5 barracks, they all have their own train plan, and 4 of them are training longbows, the last one is training muskets.
ie: 4 longbow train plans, 1 musketeer train plan.


EDIT:

ok, it seems train plan is very different from what i expected, i thought cTrainPlanNumberToTrain is the queued number of troop at the moment, but now i think it is the total number of troop will be trained in that plan.

EDIT2:

I have just tested a bit more about using cPlanExplore as a part of raiding.

It tends to have issues with aiTaskUnitMove, well, at least on my end.

Lets say, 2 cavs are assigned to an explore plan:

=> when we aiTaskUnitMove (without aiPlanDestroy the explore plan)
result = unit 1 moves as told, unit2 tends to continue to "explore", and i tested both ways,
(ie: tell unit1 unit2 to go to the same location, as well as two different locations), so the destinations make no difference
and then almost immediately, a 3rd cav will be dragged into that particular explore plan

=> when we aiTaskUnitMove (with aiPlanDestroy the explore plan)
result = they always idle (frozen?) for 1-2 seconds when we destroy the plan connected to them, even with aiTaskUnitMove. the order makes no difference, eg:

case1:
aiPlanDestroy(gRaidPlanID);
aiTaskUnitMove(gRaidPlanRaiderID2, RaidLocation);
case2:
aiTaskUnitMove(gRaidPlanRaiderID2, RaidLocation);
aiPlanDestroy(gRaidPlanID);

we always get the same end result.

Maybe we should just aiTaskUnitMove them all the way, without any plan...

[This message has been edited by ylg_hke (edited 09-17-2018 @ 05:38 AM).]

AlistairJah
Skirmisher
posted 09-17-18 10:36 AM EDT (US)     229 / 385       
Meeehh my workaround is completely busted. I give up on this and I'll get into another idea... Nah we'll figure it out sooner or later!

Yes I agree totally with using aiTaskUnitMove. Performance will be tested later. I really hope it's not like aiTaskUnitTrain! If you didn't discard the raiding idea, then I guess it's not a bad idea? You are a more competent player than I could ever be, I basically rely on your experience as a player...
ylg_hke
Skirmisher
posted 09-17-18 12:29 PM EDT (US)     230 / 385       
Currently I cant help but think there is no authentic way to increase "queue size" flawlessly.
The best we can do is probably combining aiTaskUnitTrain + alternate for loop.
ie:
1st round
aiTaskUnitTrain building1
aiTaskUnitTrain building2
aiTaskUnitTrain building3
aiTaskUnitTrain building4

2nd round
aiTaskUnitTrain building4
aiTaskUnitTrain building3
aiTaskUnitTrain building2
aiTaskUnitTrain building1

3rd round
aiTaskUnitTrain building1
aiTaskUnitTrain building2
aiTaskUnitTrain building3
aiTaskUnitTrain building4

Raiding is a must haha.
What about randomly generating 2 numbers for vector X,Y values (ok..it is X Z in this game)
, plus normalize it and then maybe *20, and use it as the destination for aiTaskUnitMove

Also when the raiders are too close to our own tc, sned them to somewhere far enough.

Well..You are a more competent programmer than I could ever be =], but seriously i was only a normal mid-range player at the time, not good not bad. Thats very very different from now, i mean nowadays with pr33 you are already top 200 or so.
AlistairJah
Skirmisher
posted 09-17-18 12:54 PM EDT (US)     231 / 385       
Gonna try forcing a plan to run while units are already queued. I am 100% sure it will wait for the unit to spawn before beginning to train... but will try anyway.

There is aiRandLoc. We could combine it with some calculated vectors, yes, and also try to stay near enemy resource spots without forcing too much...

Still, since I'm in a modding team I spend most of the time finding ideas, implementing, testing, debugging, correcting, testing again, finding better alternatives, testing, debugging and so on... 80% of the playing time are spent on testing LOL.
Well I guess we are complementary XD. BTW Panmaster is a treaty player if I remember correctly... I wonder if I could contact him somehow

(PS: nah I'm not a programmer. Just a passionate guy, modder, about to be on vacation XD)
ylg_hke
Skirmisher
posted 09-17-18 10:50 PM EDT (US)     232 / 385       
Gonna try forcing a plan to run while units are already queued.
==> Let me know when you have any conclusion.

Good, aiRandLoc is really handy.

It will be wonderful if he can be active again in this forum, provided that hes still interested in aoe3 AI scripting.

I guess part of the reason he left was that very few people had participated in this project, also participants were a bit inactive. (hmm...I mean at this rate we are going to make more posts within 1 month than they did in years.)

Yea we really are complementary=]

BTW, is levy broken for AI?

Regarding performance, would it be better if we merge some rules with another? IDK but kind of get the feeling that more rules = lag.
ie: Lets say houseMonitor & RaidMonitor both have minInterval 3, would it be better if we put them under the same rule?

[This message has been edited by ylg_hke (edited 09-17-2018 @ 10:52 PM).]

AlistairJah
Skirmisher
posted 09-18-18 12:49 PM EDT (US)     233 / 385       
So... Train plans actually wait for the building to finish the previous training before starting another one, whether or not the previous training was started by the plan itself or by another plan or aiTaskUnitTrain. I wonder if there are some other ways to count (and even better: update) queue...

Panmaster has posted once or twice on the Wars of Liberty forum. Perhaps if I PM him... Nah, I mean, he has done ssooo many crazy things alone and has been in the (modding) community for more than 2 years (way more), it's kinda impossible to imagine he would give up at this point (I mean, without releasing what he has done so far). Probably he'll come back eventually...

I guess we could say Levy is broken. Levy is not a tech, it's a "spawn" command that is tied to bin\data\protounitcommand(s).xml and the tech is just for setting the cost and researching it has no effect except outputting "PlayerX has called levies!" or something like that. The "real" job, i.e. spawning minutemen, is done by the command. AI cannot use protounit commands, just like how they cannot use repairUnit()...

I can't be sure yet, but yes I think calling several smaller rules is slower than calling a single bigger rule (slower as in bad for performance). The only (and good!) reasons for separating rules are for letting you use xsEnableRule, xsDisableRule, xsSetRuleMinInterval, etc, without messing up with other parts of the rule's codes. For example you may decide to disable raids or house building at some point (just an example). And the other reason is that certain codes must not be executed at the same time. It's super important. But basically, those kind of codes are only executed once or twice during the whole match so I don't think they're problematic.
ylg_hke
Skirmisher
posted 09-18-18 09:40 PM EDT (US)     234 / 385       
Probably no, as far kbUnitQuery cant detect queued units, if it could then we may try kbGetPopulationSlotsByQueryID.

Indeed, the AI reference was already a crazy project in its own right.

thanks for the explanation, now we can simply disable the rule.


OK, I will merge some forever running rules under some bigger rules.

btw, is gDelayAttacks enough for preventing oppor.destory from auto-generating?

EDIT:
OK we have another troublesome problem, how do we exclude raiding units from attack/defend plans ?

EDIT2:
cTrainPlanNumberTrained only count the number from the train plan.
eg: a train plan put 2 xbows in queue, cTrainPlanNumberTrained will forever be 2, disregard any increment from aiTaskUnitTrain.

The best you can do with trainplan is probably to set the cTrainPlanNumberToMaintain to 5, then keep creating + destroying the trainplan when they reach 5.
if cTrainPlanNumberTrained < 5, count resource + unit cost to determine how many aiTaskUnitTrain we need. Hell, its so awkward....

[This message has been edited by ylg_hke (edited 09-19-2018 @ 04:35 AM).]

Panmaster2014
Skirmisher
posted 09-19-18 08:30 PM EDT (US)     235 / 385       
Surprised to see fresh activity here. I thought everyone had died of old age.

kbLookAtAllUnitsOnMap() is cpu intensive than fairness.
ES said it is the most costly function.

You can't watch railroad units, simply because there is no guarantee the queries return a valid unit ID when you search for railroad units.
Querying railroad units is the entire crux of my trading post and wall building operations.

runImmediately doesn't work.
This applies to a lot of things. It needs "time" to update or homecity hc functions return -1 for example.

Eh, I'm not really fond of cheating. But yes you can train anything as long as it's in the techtree. Try this if you want to laugh:
Are you sure? Task Train works for settler wagons without townfarmers but that's it.

How do we release the villager from the original duty?
Destroy the plans.

Units are still passing by
Do you mean armies?

A fix should be developed, either by Panmaster himself or by one us (by "us" I mean everyone who participate (or willing to) to this "better AI project").
That was literally the last thing we fixed using transport plans.

Also, we will have to fix the late game very laggy issue as well, the game became very laggy by 25 mins(once Ivan reached age4, u can see the pic above), i wonder if thats related to opportunities
Building placement seems to be the primary cause of lag. Performance improvements are hard to gauge.

BTW, I have just found that aiTaskUnitTrain can dynamically increase the queue size.
But there's no way to determine which production building has the queue since queued units aren't detected.

Well of course. But it can't decrease that number and can't be canceled. Train plans too, even destroyed, don't cancel trainings.
What if you set the batch size, max queued... all to 0 for the plan?

Which one is better ? or they are the same?
You need to ignore settlers assigned to plans and aiTaskBuild() settlers.

Do you know how to get id of a queued unit?
Queued units have no ID.

Eh, basically you are trying to do exactly like Panmaster. Panmaster is also trying to balance queue between buildings, to avoid cases like
I got the plans to train units using the nearest buildings to the battlefront. BaseID's might also work.

If it has variable indexes, theoretically assigning multiple building IDs should be fine?
Multiple variables only work for some plan variables. Train plan buildingID's work just fine.

Raiding is a must haha.
What about randomly generating 2 numbers for vector X,Y values (ok..it is X Z in this game)
, plus normalize it and then maybe *20, and use it as the destination for aiTaskUnitMove

What if the destination is walled off? The one saving grace of attack-plans is they can "see" walls.

A lot of the problems could be fixed by Microsoft in the Definitive Edition in 5 mins in c++ adding aitaskRepair(), aiTaskUseAbility()...
AlistairJah
Skirmisher
posted 09-19-18 09:59 PM EDT (US)     236 / 385       
Surprised to see fresh activity here. I thought everyone had died of old age.
Oh nice, the savior finally came!
ES said it is the most costly function.
Ouch... How come?
Querying railroad units is the entire crux of my trading post and wall building operations.
Yeah I've seen it. However I made 4-5 tests on scenario and with each test only one of the Travois had the right ID... Had a lot of super big numbers which returns "Unknown" when I use "get protounit name".

Are you sure? Task Train works for settler wagons without townfarmers but that's it.
Yes. I tested with explorers and covered wagons. You can even train musketeers in stables or town centers.
Destroy the plans.
Ugh.. I mean, other units are in the plan too...
That was literally the last thing we fixed using transport plans.
Perhaps BaseUnderAttack is enough for Zen, but it definitely is not enough for Supremacy. How to determine if a certain location is under attack? If we count units per "attack" action, would that be enough ?
Building placement seems to be the primary cause of lag. Performance improvements are hard to gauge.
Speaking of "build", have you managed to fix the settler freezing caused by multiple build plans? Or did it turn out to be a whole different thing?
What if you set the batch size, max queued... all to 0 for the plan?
Aww I didn't think about that! Will try
I got the plans to train units using the nearest buildings to the battlefront. BaseID's might also work.
Oh so the "update plan" script actually works..
A lot of the problems could be fixed by Microsoft in the Definitive Edition in 5 mins in c++ adding aitaskRepair(), aiTaskUseAbility()...
That implies that they will use the aoe3 engine for DE, which could be pretty cool
ylg_hke
Skirmisher
posted 09-19-18 10:29 PM EDT (US)     237 / 385       
Oh..Panmaster finally came!

Units are still passing by
Do you mean armies?
==> Yes.

Building placement seems to be the primary cause of lag.
==> Do you mean kbBuildingPlacement ? and why it causes lag? can we make use of kbBuildingPlacementDestroy to improve it?

What if the destination is walled off?
==> Can we make use of kbCanPath2?
but honestly i would say currently the biggest problem is that I cant figure out how to exclude raiding units from attack&defend plans.
I have 4 separate attack plans, each for hand cav(light inf), ranged cav, heavy inf, inf, so aiPlanAddUnitType(xx, xx, 0,0,0) doesnt work.
Panmaster2014
Skirmisher
posted 09-21-18 08:28 PM EDT (US)     238 / 385       
What if the destination is walled off?
==> Can we make use of kbCanPath2?
No it always returns true.
but honestly i would say currently the biggest problem is that I cant figure out how to exclude raiding units from attack&defend plans.
I have 4 separate attack plans, each for hand cav(light inf), ranged cav, heavy inf, inf, so aiPlanAddUnitType(xx, xx, 0,0,0) doesnt work.
There seems no other option than aiPlanAddUnit(plan,unitID) with aiPlanAddUnitType(planID,unitType,0,0,99), then use aiPlanSetNoMoreUnits() to stop it adding units randomly.
AlistairJah
Skirmisher
posted 09-22-18 10:14 AM EDT (US)     239 / 385       
Alright now I know what is aiPlanSetNoMoreUnits for!
ylg_hke
Skirmisher
posted 09-22-18 09:30 PM EDT (US)     240 / 385       
==>No it always returns true.
Oh shit...again screw you ES.


I have a rather newbie question, what the difference between return; & return();?
I know that usually return() is to return a value, but there's no value to return in void findEnemyBase(void).

examples of return; (from original TAD AI)
======================================
void startTCBuildPlan(vector location=cInvalidVector)
{
if (cvOkToBuild == false)
return;



examples of return(); (from original TAD AI)
======================================
void findEnemyBase(void)
{
if ( (cRandomMapName == "caribbean") || (cRandomMapName == "ceylon") )
return(); // TODO...make a water version, look for enemy home island?

if (cvOkToExplore == false)
return();



BTW,
Quoted from Panmaster2014:
What if you set the batch size, max queued... all to 0 for the plan?
Aww I didn't think about that! Will try
==> how's it going?

[This message has been edited by ylg_hke (edited 09-22-2018 @ 09:32 PM).]

AlistairJah
Skirmisher
posted 09-22-18 10:10 PM EDT (US)     241 / 385       
I don't have my PC right now so I can't look at it just yet.

return; in void functions means "exit/stop here". Void functions never return values since it's a void. return; and return(); are the same IIRC.

void TownBell(void)
{
if (kbUnitCount(cMyID, cUnitTypeAbstractVillager, cUnitStateAlive) == 0)
{
return; // We have no villagers. Stop here. Ignore the rest of the function.
}

// If we're here it means we have at least one villager
// Write the function's body here
}

If the function has several "return", it always exits at the first one:

bool iAmPlayer2(void)
{
if (cMyID==2)
return(true);
return(false);
}

Yeah sorry, I'm stating the obvious. It only returns one value at one call.
ylg_hke
Skirmisher
posted 09-22-18 10:41 PM EDT (US)     242 / 385       
Thanks!

I have just finished this (based on panmaster's script), all abstract wagons are addressed
, let me know if I missed anything/as well as ideas to improve it. I don't know if cUnitTypeypTradingPostWagon works in this way or not though.
=========================================================

void CheckAbstractWagon(void)
{
int AbstractWagonCount = -1;
AbstractWagonCount = kbUnitCount(cMyID,cUnitTypeAbstractWagon,cUnitStateAlive);
if(AbstractWagonCount < 1)
{ return; }

int AbstractWagonID = -1;
int GoalBuilding = -1;
int Order = 0;

for(Order = 0; < AbstractWagonCount)
{
AbstractWagonID = getUnitSorted(cUnitTypeAbstractWagon, cMyID, cUnitStateAlive, Order);

if(kbUnitGetPlanID(AbstractWagonID) >= 0)
{ continue; }

switch(kbUnitGetProtoUnitID(AbstractWagonID))
{
case cUnitTypeOutpostWagon:
{
GoalBuilding = gTowerUnit;
break;
}
case cUnitTypeFortWagon:
{
GoalBuilding = cUnitTypeFortFrontier;
break;
}
case cUnitTypeFactoryWagon:
{
GoalBuilding = cUnitTypeFactory;
break;
}
case cUnitTypeYPVillageWagon:
{
GoalBuilding = gHouseUnit;
break;
}
case cUnitTypeYPRicePaddyWagon:
{
GoalBuilding = gFarmUnit;
break;
}
case cUnitTypeypArsenalWagon:
{
GoalBuilding = cUnitTypeypArsenalAsian;
break;
}
case cUnitTypeYPCastleWagon:
{
GoalBuilding = gTowerUnit;
break;
}
case cUnitTypeYPDojoWagon:
{
GoalBuilding = cUnitTypeypDojo;
break;
}
case cUnitTypeypShrineWagon:
{
GoalBuilding = gHouseUnit;
break;
}
case cUnitTypeYPBerryWagon1:
{
GoalBuilding = cUnitTypeypBerryBuilding;
break;
}
case cUnitTypeYPDockWagon:
{
GoalBuilding = gDockUnit;
break;
}
case cUnitTypeYPGroveWagon:
{
GoalBuilding = cUnitTypeypGroveBuilding;
break;
}
case cUnitTypeYPStableWagon:
{
GoalBuilding = gStableUnit;
break;
}
case cUnitTypeypMarketWagon:
{
GoalBuilding = gMarketUnit;
break;
}
case cUnitTypeypTradingPostWagon:
{
GoalBuilding = cUnitTypeTradingPost;
break;
}
case cUnitTypeypChurchWagon:
{
GoalBuilding = cUnitTypeypChurch;
break;
}
case cUnitTypeYPMonasteryWagon:
{
GoalBuilding = cUnitTypeypMonastery;
break;
}
case cUnitTypeypBankWagon:
{
GoalBuilding = cUnitTypeypBankAsian;
break;
}
case cUnitTypeYPCastleWagonIndians:
{
GoalBuilding = gTowerUnit;
break;
}
case cUnitTypeYPCastleWagonJapan:
{
GoalBuilding = gTowerUnit;
break;
}
case cUnitTypeYPSacredFieldWagon:
{
GoalBuilding = cUnitTypeypSacredField;
break;
}
case cUnitTypeypBlockhouseWagon:
{
GoalBuilding = cUnitTypeBlockhouse;
break;
}
case cUnitTypeYPMilitaryRickshaw:
{
GoalBuilding = gBarracksUnit;
break;
}
case cUnitTypexpBuilder:
{
if(kbGetAge() >= cAge3)
{ GoalBuilding = gPlantationUnit; }
else
{ GoalBuilding = gBarracksUnit; }
break;
}
case cUnitTypexpBuilderWar:
{
GoalBuilding = gBarracksUnit;
break;
}
case cUnitTypexpBuilderStart:
{
GoalBuilding = gHouseUnit;
break;
}
case cUnitTypeWarHutTravois:
{
GoalBuilding = gBarracksUnit;
break;
}
case cUnitTypeFarmTravois:
{
GoalBuilding = gFarmUnit;
break;
}
case cUnitTypeNoblesHutTravois:
{
GoalBuilding = gStableUnit;
break;
}
case cUnitTypeTradingPostTravois:
{
GoalBuilding = cUnitTypeTradingPost;
break;
}
}

if(GoalBuilding < 0)
{ continue; }

int planID = aiPlanCreate("AbstractWagonPlan"+AbstractWagonID, cPlanBuild);
aiPlanSetVariableInt(planID, cBuildPlanBuildingTypeID, 0, GoalBuilding);
aiPlanSetDesiredPriority(planID, 99);
aiPlanAddUnitType(planID, cUnitTypeAbstractWagon, 1, 1, 1);
aiPlanAddUnit(planID, AbstractWagonID);
aiPlanSetBaseID(planID, kbBaseGetMainID(cMyID));

if((GoalBuilding == gFarmUnit) || (GoalBuilding == gPlantationUnit) || (GoalBuilding == cUnitTypeypBerryBuilding))
{
aiPlanSetVariableFloat(planID, cBuildPlanBuildingBufferSpace, 0, 0.0);
aiPlanSetVariableInt(planID, cBuildPlanInfluenceUnitTypeID, 0, cUnitTypeTownCenter);
aiPlanSetVariableFloat(planID, cBuildPlanInfluenceUnitDistance, 0, 35);
aiPlanSetVariableFloat(planID, cBuildPlanInfluenceUnitValue, 0, 20.0);
aiPlanSetVariableInt(planID, cBuildPlanInfluenceUnitFalloff, 0, cBPIFalloffLinear);
}
else
{
aiPlanSetVariableFloat(planID, cBuildPlanBuildingBufferSpace, 0, 3.0);
aiPlanSetVariableInt(planID, cBuildPlanInfluenceUnitTypeID, 0, cUnitTypeTownCenter);
aiPlanSetVariableFloat(planID, cBuildPlanInfluenceUnitDistance, 0, 35);
aiPlanSetVariableFloat(planID, cBuildPlanInfluenceUnitValue, 0, -20.0);
aiPlanSetVariableInt(planID, cBuildPlanInfluenceUnitFalloff, 0, cBPIFalloffLinear);
}

if(kbUnitIsType(GoalBuilding, cUnitTypeMilitaryBuilding) == true)
{
aiPlanSetMilitary(planID, true);
aiPlanSetEconomy(planID, false);
aiPlanSetEscrowID(planID, cMilitaryEscrowID);
}
else
{
aiPlanSetMilitary(planID, false);
aiPlanSetEconomy(planID, true);
aiPlanSetEscrowID(planID, cEconomyEscrowID);
}

aiPlanSetActive(planID);
}
}
========================================================
Panmaster2014
Skirmisher
posted 09-22-18 11:50 PM EDT (US)     243 / 385       
Quoted from Panmaster2014:
What if you set the batch size, max queued... all to 0 for the plan?
Aww I didn't think about that! Will try
==> how's it going?
It doesn't work. Training plans don't want to cooperate very much.

Just wasted loads of time realising an array was being used before it was created.
Is there a way to select homecities in scenarios or must I keep having to open up folders and manually add xml files?

[This message has been edited by Panmaster2014 (edited 09-22-2018 @ 11:57 PM).]

AlistairJah
Skirmisher
posted 09-23-18 00:03 AM EDT (US)     244 / 385       
@ylg_hke
it seems okay.. You'll always see what's missing when you test.

@Panmaster2014
I am sure there is, because I remember I randomly got the WoME AI to make its own deck on scenario. Not sure how, it was just a luck I guess. Perhaps use the clear hc button and/or use CreateDeck (IIRC Deck 0 is always the default so perhaps using Deck 1 would make them ignore the default).
ylg_hke
Skirmisher
posted 09-23-18 01:19 AM EDT (US)     245 / 385       
it seems okay.. You'll always see what's missing when you test.
==> Well sure, just in case some of us have already tested TP wagon.


Training plans don't want to cooperate very much.
==> It seems to me that train plan was introduced from non-batch-training setting (i havent played AOM yet so IDK).

edit:
I am now sure that unitpicker uses train plans, because we can get the correct cTrainPlanNumberTrained.
=====================================================
int planID1 = -1;
int BuildingID = -1;
int NumberToTrain = -1;
int NumberTrained = -1;
int Freq = -1;

planID1 = aiPlanGetIDByTypeAndVariableType(cPlanTrain,cTrainPlanUnitType,cUnitTypeHussar);
BuildingID = aiPlanGetVariableInt(planID1,cTrainPlanBuildingID,0);
NumberToTrain = aiPlanGetVariableInt(planID1,cTrainPlanNumberToTrain,0);
NumberTrained = aiPlanGetVariableInt(planID1,cTrainPlanNumberTrained,0);
Freq = aiPlanGetVariableInt(planID1,cTrainPlanFrequency,0);
aiChat(1, "id hussar" + planID1 + " buildingID " + BuildingID + " NumberToTrain " + NumberToTrain + " NumberTrained " + NumberTrained + " Freq " + Freq);
======================================================

[This message has been edited by ylg_hke (edited 09-23-2018 @ 02:34 AM).]

AlistairJah
Skirmisher
posted 09-23-18 06:08 AM EDT (US)     246 / 385       
Even if that's true, unit picker's plan is never counted by aiPlanGetNumber()...
ylg_hke
Skirmisher
posted 09-23-18 10:42 PM EDT (US)     247 / 385       
True, probably aiPlanGetNumber() doesn't count child plans.


edit:


Is there a way to get plan name? (yes, name, not id not type)

[This message has been edited by ylg_hke (edited 09-23-2018 @ 10:51 PM).]

AlistairJah
Skirmisher
posted 09-24-18 00:34 AM EDT (US)     248 / 385       
Nope you can't and I don't see why would you.

Uh... IIRC cPlanAttack and cPlanGather are counted. Gotta test to see.

I've been so lethargic these last few weeks, didn't touch my trashy script since at least a month. Guess I will just sit there and wait for either of you guys to release your script.

EDIT:
Misread. I thought it was "edit plan name". Well you can get plan name. You can even get substring without knowing the starting/ending positions.

[This message has been edited by AlistairJah (edited 09-24-2018 @ 00:37 AM).]

ylg_hke
Skirmisher
posted 09-24-18 01:18 AM EDT (US)     249 / 385       
There's no competition, don't worry about lethargy =]

OK, there's a typo in AI Reference, so I didn't find it.

==> string aiPlanGetType( int planID )

should be => string aiPlanGetName( int planID )

I noticed that sometimes attack plans would accumulate, even with garbage plans killer running, that's why I asked about plan name.


BTW, panmaster said Building placement may be the cause of lag. Do you have any idea about what it is?

Speaking of positions, although not very helpful, but we can get unitpicker train plans' location (aiPlanGetLocation, however aiPlanGetInitialPosition = no result)

[This message has been edited by ylg_hke (edited 09-24-2018 @ 01:23 AM).]

AlistairJah
Skirmisher
posted 09-24-18 03:46 AM EDT (US)     250 / 385       
Dunno about that lag issue. I had fun playing treaty with Zen but didn't notice lags... Except right when the time is up, but it's understandable.

Here was my TODO list some time ago:

If the AI is based on the AI from Ensemble Studios:
* Hunt > Berries > Farms
* Market techs asap. Scratch the cPlanProgression
* At most 2-3 Mills early on
* 0.0 wood gatherer percentage after deforestation
* Towering+Artillery in Amazonia (?)
* Better army handling
* Capitol
* Multiple bases
* Populating forward bases (?) barracks, stables etc
* "Protect" Factories, Banks, etc
* Improve unit training, somehow
* Ceylon move to the big island
* Tribute all resources to allies before giving up LOL
* Split armies in cPlanDefend, to avoid human lures
* Fix the TownBell exploit
* Protect Fort Wagon (?)
* Better handling of Naval games (?)
* Improve card selection for building decks
* Improve card selection for spending cResourceShips
* Build Shrines near huntables, but not too far from base (?)
* Improve walling
* Improve towering (?)
* Never pathfind through impassable lands.
* Handle regicide
* (???)

Relatively easy...

If the AI is built from scratch:
* Well it's not really possible to make a complete list for this. You usually know what to do next, as you keep editing, testing and finding bugs...
* The most important here is to find out how to fix known limitations. Just look at Panmaster, once he found how to ungarrison units using transport plans, he didn't care whether GetBaseUnderAttack was enough or not, since that's not a matter of limitations but rather a scripter's mistake (before kangcliff's insight on aiSetWaterMap(), ungarrison was considered to be a limitation, but it's not really a limitation if you think about it... but I guess you know what I mean)

[This message has been edited by AlistairJah (edited 09-24-2018 @ 03:50 AM).]

« Previous Page  1 ··· 8 9 10 11 12 ··· 16  Next Page »
You must be logged in to post messages.
Please login or register

Hop to:    

Age of Empires III Heaven | HeavenGames