Java AI Interface for Spring - Page 21

Java AI Interface for Spring

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

Moderators: hoijui, Moderators

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

Re: Java AI Interface for Spring

Post by hoijui »

i am alreayd using maven. it is possible to have a maven build file for an AI being used by CMake. it works, but.. i would not recommend it. Maven is nice for a very standardised thing, eg.. if oyu have only java sources, no generated sources, need no special config files, ...
my AI (which is more a proof of concept thing, and does not yet do a single move or build or anything ingame) uses maven, but i can not recommed it. it is much slower, as it always checks the dependencies. build with pure CMake is 1sec, if nothing changed, with Maven its about 30 seconds. also.. just installing as we need it for AIs here in spring, is alreayd quite ugly with Maven, and the internal variables/properties stuff works really badly, as in.. in some places in the file they get replaced with the value i set, and in other with the default value...
baeh!
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Java AI Interface for Spring

Post by hughperkins »

hoijui wrote:i am alreayd using maven. it is possible to have a maven build file for an AI being used by CMake. it works, but.. i would not recommend it. Maven is nice for a very standardised thing, eg.. if oyu have only java sources, no generated sources, need no special config files, ...
Ah ok, fair enough! Interesting!
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java AI Interface for Spring

Post by hoijui »

Soo.. finnally, a first.. alpha/beta quality version of the refactored AI Interface can be seen.

what it has:
* C part done
* Legacy Wrapper adjusted
* Java interface done, now JNA replaced by JNI
* Java OO Wrapper done 95%
* all the non submoduled AIs + HughAI are adjusted

what is missing:
* Java interface done will need bug fixing most likely
* propper interfaces for Java OO Event classes
* new C++ wrapper (missing 100%)

new for AI devs:
* the identity number of an AI is not its teamId, but a skirmishAIId now

new for Java AI devs:
* there are no AICommands anymore, they got integrated into the callback, eg.: Unit.stop(), Engine.sendTextMessage(String msg)
* you can now choose between two different basig interfaces for your AI: IOOAI or IEventOOAI (see description below)
* callback should be faster now (i hope!), as this was one of the main reasons for the refactor ;-)
* no more AIFactory
* the AI needs a no-arg constructor now, the one with (int teamId, AICallback) is not used anymore

IOOAI and IEventOOAI
the difference between them is, that IOOAI is a class with events as methods (nearly 100% the same as it was now), while IEventOOAI has only one method: handleEvent(AIEvent).

The 5% that are still missing by now from the OO Java Wrapper, are meta event interfaces for the AIEvent's. For example, the UnitCreatedAIEvent, UnitFinnishedAIEvent and UnitDestroyedAIEvent events will all implement the UnitLifeStateAIEvent interface (no methods). I would like feedback for these events from you (preffereable AI devs). best way to see them is looking at the INTERFACES meta comments in rts/ExternalAI/Interfaces/AISEvents.h. Tell me which of the ones i have are useless, better names to use, and what more i could add.

Testing
get branch pureint from spring main github repo (git://github.com/spring/spring.git).
if you want to test HughAI:

Code: Select all

cd AI/Skirmish
git clone -n git://github.com/hoijui/HughAI.git
cd HughAI
git checkout -b pureint origin/pureint
cd ../../..
use one of the following to configure:

Code: Select all

cmake -DAI_EXCLUDE_REGEX="CppTestAI|Cpp|NTai|E323AI"
cmake -DAI_TYPES="JAVA"
this is needed to exclude the new C++ from the build process. The later of the two lines is more restrictive (neither builds the legacy C++ AIs).
the rest should go as usual.

keep in mind this is still alpha/beta state, so you may not yet start to port your AIs over ;-).
i would like lots of feedback now, as this is the best time to change stuff, expecially for doing big changes.

edit: fixed link to repo with pureint branch. DOH!
edit: copied pureint branch to spring main repo.
Last edited by hoijui on 27 Dec 2009, 16:23, edited 2 times in total.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java AI Interface for Spring

Post by hoijui »

pureint HEAD now has usable Java OO AI Event interfaces. (eg, the missing 5%)
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java AI Interface for Spring

Post by hoijui »

edit: removed (was obsolete)
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java AI Interface for Spring

Post by hoijui »

finnally, with help of Tobi, it builds on buildbot!!
installer: http://tiny.cc/JQnjl

edit: some more fixes

edit2: more fixes (mainly one making WeaponMounts not crash the engine when fetched)
Post Reply

Return to “AI”