AI Interface pureification (pureint)

AI Interface pureification (pureint)

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

Moderators: hoijui, Moderators

Post Reply
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

AI Interface pureification (pureint)

Post by hoijui »

The long awaited merge of the pureint branch into master has finally happened! :D
This means, it will be in the next mayor release (0.83) of spring.

changes:
  • Skirmish AIs are now indexed by skirmishAIId, instead of teamId
  • former OO part of the Java-AIInterface is now the JavaOO-AIWrapper
  • Java-AIInterface uses only pure JNI (instead of JNA) -> speed & less dependencies
  • Java-AIInterface wraps all commands through functions: handleCommand(UnitMoveCommand(unit, pos)) -> unit.moveTo(pos)
  • JavaOO-AIWrapper has an interface, wrapper-, stub- and abstract-class for each callback OO part.
  • JavaOO-AIWrapper allows the base AI class to have either one function per event, or to use a handleEvent(OOEvent) approach
  • Cpp-AIWrapper has an interface, wrapper-, stub- and abstract-class for each callback OO part.
  • Cpp-AIWrapper wraps all commands through functions: handleCommand(UnitMoveCommand(unit, pos)) -> unit.moveTo(pos)
  • C AI Interface API headers use comments for meta info, instead of integrating it into function names
  • C AI Interface API does not use structs anymore (SAIFloat3 -> float[3])
  • lots of engine internal minor logic tweaks & bug fixes
  • more stuff compiled in parallel (at least with CMake + make)
  • practically zero unneeded recompiles (at least with CMake + make), while before, all non native sources were always recompiled
  • probably more stuff i forgot
Null*AI's, AAI, KAIK, RAI, E323AI, HughAI & Shard are already ported (for the submodule AIs, see the pureint branches). Same applies for all the officially maintained AI Interfaces and Wrappers, except the Python-AIInterface, which is being worked on.
If you need help in porting your AI to work with the changes, feel free to ask for help here or in the lobby in channel #ai.

sadly, most mods are currently incompatible with current spring master, due to the removal of SetLineage().
Known to work:
  • rapid pin ca:test (8509+)
  • S44 SVN version (that is, after 1.5, Market Garden release)
to get S44 through SVN, do:

Code: Select all

cd ~/.spring/mods/
svn co https://spring1944.svn.sourceforge.net/svnroot/spring1944/trunk/S44LiteRelease.sdd/
the mod will then show up as Spring 1944 ${VERSION} or similar.

Known to fail:
  • BA 7.19
to fix a mod, remove all calls to SetLineage() from its Lua files.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: AI Interface pureification (pureint)

Post by AF »

How long do you think it will be before a release with this in is made?

Also won't we need to update the version field in our AI info lua files?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Interface pureification (pureint)

Post by hoijui »

:D
the version field...
well, it basically is only cosmetics as of now. it never changed, even though there were constant changes to the interface and engine...
i do not plan to change the versions of interfaces.. as old interfaces wont be usable anymore with the engine, the only effect it would have, is that all AIs had to change the version info field.

the next release with this in... i do not know, but i would assume as usual: 3-6 months from now.
you should probably just go on developing for the current release (in your master branch), and from time to time, merge your master branch into your pureint branch. if you want, i can also do that.
anyway though, it would be good if you had a look at your pureint branch now at least, so you know what to expect, and where it does not make sense to change too much.
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Re: AI Interface pureification (pureint)

Post by slogic »

Good that you've created separate branch but i wonder why so many changes. I could not even detect what you've really changed concerning pureint. Have to compare it on my local drive when i got some time.

What skirmishAIId does change?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Interface pureification (pureint)

Post by hoijui »

for you, not much yet.
it is a step that allows future extension to make AIs and players share common base classes engine internally, which will make stuff easier, and eg allow to fix drawing for AIs. it is also a prerequisite for multiple AIs per team. in short: cleaner structure.

yeah.. in spring master, the merge somehow turned out strange :/
you might just look at the pureint branch instead (eg, using gitk). but its a few hundred commits all in all.
yet an other way it so use git diff on pureint and master (before the merge).
.. or are you referring to changes in E323AI?
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Re: AI Interface pureification (pureint)

Post by slogic »

hoijui wrote:.. or are you referring to changes in E323AI?
This :)
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Interface pureification (pureint)

Post by hoijui »

Code: Select all

gitk origin/master origin/pureint
then search for 3cafb5b1117b6da42d09723c8d14776ffa049920
it is only this and the following commit ("compile- and (dynamic-)link-time fixes"). the other 2 commits there are already in master.
cranphin
Posts: 136
Joined: 13 Jun 2005, 16:37

Re: AI Interface pureification (pureint)

Post by cranphin »

Awesome! :)

hoijui: I've been / am a bit distracted from my Java AI for a bit, but I'm sure I'll get back to it, I'll certainly have to make it work on pureint when it's released, it'll be great! ^_^

And there seems enough other Java ai's also still alive or new, so this should help them lots too :)
User avatar
LoidThanead
Posts: 58
Joined: 27 Feb 2008, 16:16

Re: AI Interface pureification (pureint)

Post by LoidThanead »

This sounds exactly like what I've been waiting for. If the AI drawing has been fixed, I can finally debug my building placement algorithm.

I know this is probably a silly question, but is there a test build available somewhere that I could pluck off the web and use, or should I go ahead and try to finally figure out once and for all how to build Spring out of the repository?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Interface pureification (pureint)

Post by hoijui »

hoijui wrote:it is a step that allows future extension to make AIs and players share common base classes engine internally, which will make stuff easier, and eg allow to fix drawing for AIs.
This means, it is a first step towards fixing drawing, engine wise, but needs more fixes still. two big re-factors, one for AI+Player handling, and one of the drawing system.

as pureint changes are in master, and master is built by the build-bot (each push with relevant commits), you do not have to compile yourself anymore (for windows). compiling under linux is magnitudes easier.

to answer some things from an other thread: we can not write down all info that might ever be possibly interesting/related to one topic in one place. that is what we have links for, and a brain. if neither of these help, one has to ask, and learn general/abstract concepts. like in this case, that projects sometimes have build-bots, so you may search for one, and look!
Development -> Compiling -> Buildbot
0bliter8or
Posts: 7
Joined: 05 Jul 2011, 07:16

Re: AI Interface pureification (pureint)

Post by 0bliter8or »

I'm currently looking at E323AI source to see if I can replace some of the components to test a task allocation solution that I'm exploring for for my PhD research.

So has E323AI been ported to the new C++ interface or is it still running on the Legacy interface?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Interface pureification (pureint)

Post by hoijui »

it is still using the legacy one, and as both its maintainers have vanished, it will also stay that way, most definitely, except someone else feels brave... which is unlikely.
Post Reply

Return to “AI”