Better Teams Interface for AI

Better Teams Interface for AI

Requests for features in the spring code.

Moderator: Moderators

Post Reply
aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Better Teams Interface for AI

Post by aeonios »

Currently the AI interface (at least java, but I suspect it isn't much different for the others) sucks horribly when it comes to teams. There are callins for enemyCreated, enemyFinished, enemyDestroyed etc, but none for allies (and the normal unitCreated etc callins don't apply to allies). It's also currently difficult to tell whether the AI has allies or whether it's alone.

Given that bots are very frequently expected to play on teams (ie coop vs ai games) it's kind of important that programming them to do so shouldn't be extra tedious. It's also extremely inefficient to have a bot sort through every allied unit just to find out if an ally has some unit x or not, or some unit near position x or not (as in no we don't need more static defenses here).
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Better Teams Interface for AI

Post by gajop »

Help clean it up.
aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Better Teams Interface for AI

Post by aeonios »

Arg. K.
aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Better Teams Interface for AI

Post by aeonios »

Hm, well it uses some weird iterator stuff over the ais that I don't really understand but was more or less able to work around.

So far I added the new allyevents to the following files:
AISEvents.h
SkirmishAIWrapper.h/.cpp
EngineOutHandler.h/.cpp

as well as shifted around the defs used in EngineOut a bit to clean them up and to include a new def for allyevents (ie, send allyevents to allies of team x but not to team x).

Is there anything else that I need to change for this to work properly with non-cpp interfaces? I didn't find anything particularly intelligible regarding how those are generated.
lamer
Posts: 153
Joined: 08 Mar 2014, 23:13

Re: Better Teams Interface for AI

Post by lamer »

awk scripts are responsible for generation of newOO wrappers (for any language). Search for *.awk inside spring/AI/.
As long as you followed naming conventions with some specific comments new events should be autogenerated.
Don't forget to test it!
lamer
Posts: 153
Joined: 08 Mar 2014, 23:13

Re: Better Teams Interface for AI

Post by lamer »

I have concerns about ongoing work. Developed implementation:
a) Add new Ally(Created|Finished|Destroyed|Damaged) events.
I think it brings inconsistency: Unit(Given|Captured) is already sent to allies.

My opinion about proper implementation:
b) New Ally(Created|Finished|Destroyed|Damaged) events and decoupling Ally(Given|Captured) from Unit(Given|Captured).
c) Use existing Unit(Created|Finished|Destroyed|Damaged|Given|Captured) and send them to whole AllyTeam, add teamId param into those event structs, and fix few official legacy AIs (ignore event if event.teamId != ourTeamId).
I'd prefer (c).

HALP! What option is better? Other opinions/suggestions/options?
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Better Teams Interface for AI

Post by gajop »

I'd do:
d) Use existing Unit(Created|Finished|Destroyed|Damaged|Given|Captured) and send them to whole AllyTeam, and fix few official legacy AIs (ignore event if callback.GetUnitTeamID(teamId) != ourTeamId). (don't add extra params)
or e) Use existing Unit(Created|Finished|Destroyed|Damaged|Given|Captured) and send them to whole AllyTeam, and add all the params to match the Lua callins, e.g. in the case of UnitCreated it would be (unitID, unitDefID, unitTeam, builderID), do the filtering as in c)
Post Reply

Return to “Feature Requests”