I was wondering if someone can explain how the standard warzone AI is able to build defences on gateways points without using the function:
getNearestGateway() to become aware of the gateways positions.
This would be nice to know.
defending gateways
Re: defending gateways
By calling skDefenseLocation() and skDefenseLocationB().
Re: defending gateways
skDefenseLocation() is not used.Per wrote:By calling skDefenseLocation() and skDefenseLocationB().
How does skDefenseLocationB() works? from the AI manual (referred to skDefenseLocation() ):
Code: Select all
bool skDefenseLocation (ref int x, ref int y, STRUCTURESTAT defenceStat, STRUCTURESTAT wallstat, DROID unit, int player)
Given a starting x and y, make unit unit belonging to player build either a defenceStat or a row of wallStat. Returns modified x and ys.
What happens when all gateways are fortified?
Valid gateways are within which range of x,y?
Re: defending gateways
Yes, the nearest gateway is fortified, and the passed in droid is given a linebuild order to construct the entire gateway in one order. It is a rather ugly hack, and it is full of bugs. I fixed some of the bugs in trunk while testing semperfi, but more bugs remain (if gateway goes into map border then gateway building is cancelled, it doesn't usually understand that a gateway is already built, etc). When all gateways are fortified, it returns false and does nothing. There is no range limitation, so droids can be sent on quite a journey in odd cases.
The difference between the two versions is that the B version will skip gateways unless it can preserve at least two empty tiles in the middle of the gateway for traffic. Probably any use of the non-B version is a bug.
If you have your own gateway building code, I am sure it is better than this.
The difference between the two versions is that the B version will skip gateways unless it can preserve at least two empty tiles in the middle of the gateway for traffic. Probably any use of the non-B version is a bug.
If you have your own gateway building code, I am sure it is better than this.
Re: defending gateways
thanks for the clarification.Per wrote: If you have your own gateway building code, I am sure it is better than this.
Yes I am using my code but it is also using skDefenseLocationB(), I pass to that function up to three gateways coordinates (I check for the number of def buildings built in that range before pasing that coordinates to that function).