Building position/coverage

Building position/coverage

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
casperjeff
Posts: 51
Joined: 14 Aug 2008, 21:54

Building position/coverage

Post by casperjeff »

If I get an event say for example that a vehicle factory entered my line of site (or the line of site of a specific unit.....btw, there is no way to determine what unit actually 'spotted' another, is there?), I can get it's position and I can get it's x and z size from the unitdef.... but where is the position with relation to the x and z 'widths'? Is the position the upper left corner...and it extends X units right and z units down? Or is it (god forbid) centered on the position?
initram
AI Developer
Posts: 15
Joined: 07 Sep 2009, 14:28

Re: Building position/coverage

Post by initram »

As I understand it the position is the center of a unit and the x-size and z-size are the width and height of the building in map coodinates (1/8 of the position coordinates) and that is only given that the facing is 0.

If the facing is different (ranges from 0-3), the x-size and z-size changes its meaning from width to height and from height to width. I think 0 and 2 it is normal and 1 and 3 it has the other meaning.
casperjeff
Posts: 51
Joined: 14 Aug 2008, 21:54

Re: Building position/coverage

Post by casperjeff »

seems to match up with what I am seeing...thanks.....
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Building position/coverage

Post by SpliFF »

casperjeff wrote:btw, there is no way to determine what unit actually 'spotted' another, is there?)
possibly not directly but the lua api provides a GetClosestEnemy(unit) function which you could simply pass the factory id to. Of course there's no guarentee that the closest unit is actually the one that spotted it (due to los distance differences) but you'd probably find that's good enough for most practical purposes.
Post Reply

Return to “AI”