Suggestions to the AI interface
Posted: 13 Nov 2005, 04:29
This is long, so I grouped suggestions by type and then documented what the actual API requests would be.
Coordination with other AI, or a human player:
Although we can get the damage done to the AI's unit with UnitDamaged() this appears untrue for Ally units. If an AI is assisting another player, we would need a way for them to communicate or get information from ally units. Getting information on ally units would probably be the simplest method, and AI's can be programmed to respond using GotChatMsg to things like "help defend" or "assist attack 5" "help metal" based on getting ally info. For the first command all that is necessary is knowing when ally troops are damaged, and their unit ID. For the second command, assisting an attack would involve knowing the GetFriendlyUnits() for allies, but it would not know which units to assist. If the ally could share group listings, and the position of each unit in a group could be reference, the AI could send troops to assist. I did not see the ability to share metal for "help metal" but it could possibly be done by calling the same function that the UI uses.
Calculating Combat effectiveness:
UnitDamaged returns the attacker, but not the weapon type. If we know the weapon type it would allow us to estimate which unit armor is more effective versus which weapons. For example, Lasers vs Mavericks in OTA.
The AI interface does not have a means to know how much damage its units do to the enemy, which unit they are, or information about the unit. The targeted unit may be different from the damaged unit.
We can calculate range by radar, line of sight, etc, but not hit or miss. For all we know, we are shooting terrain.
Movement:
InitPath returns the path from one point to another, and estimates could be gathered from the rate of movement (barring changes in velocity from collisions) so that appropriate lead time could be used for artillery, rockets, nukes.
GetElevation may be used to identify chokepoints, but in practice we would need to know the difference between submarine, ship, kbot and vehicle chokepoints. This may be a lack of knowledge on my part, but I don't know if the paths are flagged for specific unit types or not. If it is, then we could determine vehicle chokepoints vs kbot chokepoints using path information. Also, the width of the available path may also be important. The AI may want to select a wider vehicle only path for all troops so they don't get killed one by one. (side path in Hells Path)
Suggested API calls:
Coordination
AllyUnitDamaged() return unit data on ally when ally unit damaged (toggle this on/off for performance reasons?)
GetAllyGroups() return a list of each players groups, one array per ally.
GetAllyUnitGroup() Return the int ally group id for a unit
GetUnitByAllyGroup() return an array of units belonging to a group, so the AI can fetch location information
Combat Efficiency
UnitDamaged() add int weaponID to the list, or some other more appropriate mechanism that can be referenced by unit data. If the AI tracks this information separately that is fine, but how will a unit that fired, but was destroyed before the attack hit be referenced? I don't know when the unitIDs are removed.
UnitDoesDamage() An optional (for performance) callback that returns damage done, weapon id (or better), damage, location of unit damaged, etc. One array per unit damaged.
? UnitMiss, UnitAttack? How can we determine hit or miss? The time it takes from weapon firing to weapon hit? We can lookup weapon reload time, but not weapon fire to hit time. This is important if we calculate lead times for weapons. We could also assume that if we had a unit fire event per weaponid, that we could just wait until the UnitDamaged returned, and count the time. If the time exceeds a certain value, count it as a miss. This approximation may create problems for rapid fire weapons, and I doubt we want tracking numbers for each bullet fired in the AI. A UnitMiss(or UnitDamaged with 0 damage) and UnitAttack should be sufficient to get the information we want.
Movement
Uncertain how paths work at this time, this information may already be provided.
Engine
I noticed that the game could be recorded, and we can set whatever time value we wanted up to 50x game speed. Could we have a UI-less game for testing purposes? That way we could script games to run all night long for testing, scan the logs for exceptions, win vs loss and so on without actually watching. If we want to watch how one game crashed, we could view the recorded game.
These are my initial reactions to reading the API, I don't know if this is the current API because I have not verified it in CVS. I am reading some code from CVS now, but I didn't research this to that point yet. Please treat mistakes leniently, and I am open to all suggestions and criticism.
Coordination with other AI, or a human player:
Although we can get the damage done to the AI's unit with UnitDamaged() this appears untrue for Ally units. If an AI is assisting another player, we would need a way for them to communicate or get information from ally units. Getting information on ally units would probably be the simplest method, and AI's can be programmed to respond using GotChatMsg to things like "help defend" or "assist attack 5" "help metal" based on getting ally info. For the first command all that is necessary is knowing when ally troops are damaged, and their unit ID. For the second command, assisting an attack would involve knowing the GetFriendlyUnits() for allies, but it would not know which units to assist. If the ally could share group listings, and the position of each unit in a group could be reference, the AI could send troops to assist. I did not see the ability to share metal for "help metal" but it could possibly be done by calling the same function that the UI uses.
Calculating Combat effectiveness:
UnitDamaged returns the attacker, but not the weapon type. If we know the weapon type it would allow us to estimate which unit armor is more effective versus which weapons. For example, Lasers vs Mavericks in OTA.
The AI interface does not have a means to know how much damage its units do to the enemy, which unit they are, or information about the unit. The targeted unit may be different from the damaged unit.
We can calculate range by radar, line of sight, etc, but not hit or miss. For all we know, we are shooting terrain.
Movement:
InitPath returns the path from one point to another, and estimates could be gathered from the rate of movement (barring changes in velocity from collisions) so that appropriate lead time could be used for artillery, rockets, nukes.
GetElevation may be used to identify chokepoints, but in practice we would need to know the difference between submarine, ship, kbot and vehicle chokepoints. This may be a lack of knowledge on my part, but I don't know if the paths are flagged for specific unit types or not. If it is, then we could determine vehicle chokepoints vs kbot chokepoints using path information. Also, the width of the available path may also be important. The AI may want to select a wider vehicle only path for all troops so they don't get killed one by one. (side path in Hells Path)
Suggested API calls:
Coordination
AllyUnitDamaged() return unit data on ally when ally unit damaged (toggle this on/off for performance reasons?)
GetAllyGroups() return a list of each players groups, one array per ally.
GetAllyUnitGroup() Return the int ally group id for a unit
GetUnitByAllyGroup() return an array of units belonging to a group, so the AI can fetch location information
Combat Efficiency
UnitDamaged() add int weaponID to the list, or some other more appropriate mechanism that can be referenced by unit data. If the AI tracks this information separately that is fine, but how will a unit that fired, but was destroyed before the attack hit be referenced? I don't know when the unitIDs are removed.
UnitDoesDamage() An optional (for performance) callback that returns damage done, weapon id (or better), damage, location of unit damaged, etc. One array per unit damaged.
? UnitMiss, UnitAttack? How can we determine hit or miss? The time it takes from weapon firing to weapon hit? We can lookup weapon reload time, but not weapon fire to hit time. This is important if we calculate lead times for weapons. We could also assume that if we had a unit fire event per weaponid, that we could just wait until the UnitDamaged returned, and count the time. If the time exceeds a certain value, count it as a miss. This approximation may create problems for rapid fire weapons, and I doubt we want tracking numbers for each bullet fired in the AI. A UnitMiss(or UnitDamaged with 0 damage) and UnitAttack should be sufficient to get the information we want.
Movement
Uncertain how paths work at this time, this information may already be provided.
Engine
I noticed that the game could be recorded, and we can set whatever time value we wanted up to 50x game speed. Could we have a UI-less game for testing purposes? That way we could script games to run all night long for testing, scan the logs for exceptions, win vs loss and so on without actually watching. If we want to watch how one game crashed, we could view the recorded game.
These are my initial reactions to reading the API, I don't know if this is the current API because I have not verified it in CVS. I am reading some code from CVS now, but I didn't research this to that point yet. Please treat mistakes leniently, and I am open to all suggestions and criticism.