BAI
Moderators: hoijui, Moderators
Re: BAI
Why isn't the poll working? Admin, fix, plz, thx.
@Jazcash yes but I found BAI to be more punny.
@hughperkins too bad you got a job you had some good things going.
@AF Ive already finished university and am working full time. It has been on the side for a while but Im hoping to get back into it soon.
@cranphin use what ever code you want, just give me a mention somewhere.
@Forboding Angel Spring is not TA, and in that sense there is no BAI for Spring, so your comment is irrelevant.
Any way, check out the update, and BUMP!
@Jazcash yes but I found BAI to be more punny.
@hughperkins too bad you got a job you had some good things going.
@AF Ive already finished university and am working full time. It has been on the side for a while but Im hoping to get back into it soon.
@cranphin use what ever code you want, just give me a mention somewhere.
@Forboding Angel Spring is not TA, and in that sense there is no BAI for Spring, so your comment is irrelevant.
Any way, check out the update, and BUMP!
Re: BAI
It runs \./
Tweaked it a lil to make it a simple build.xml build like my ai, just cause I use eclipse ^.^
Do you intend to ever add the org.petah.common.jar code somewhere? :)
Hmm, now to figure out how to turn on the GUI :D
Found it ^_^
So tempted to do some gui stuff, just it tends to blow up on fullscreen and XP, back when I still ran XP :)
I guess with a command it's not so bad, only shows if an experienced user asks for it :)
Tweaked it a lil to make it a simple build.xml build like my ai, just cause I use eclipse ^.^
Do you intend to ever add the org.petah.common.jar code somewhere? :)
Hmm, now to figure out how to turn on the GUI :D
Found it ^_^
- '-savesettings'
'-showgui'
'-hidegui'
'-dir'
'-hi'
'-allcheat'
So tempted to do some gui stuff, just it tends to blow up on fullscreen and XP, back when I still ran XP :)
I guess with a command it's not so bad, only shows if an experienced user asks for it :)
Re: BAI
Yea I suppose I can add it, its mostly just very generic stuff though.cranphin wrote: Do you intend to ever add the org.petah.common.jar code somewhere? :)
http://github.com/Petah/org.petah.common
Good point Ill mention that in the main post.cranphin wrote:Hmm, now to figure out how to turn on the GUI :D
Yea I always run Spring in window mode.cranphin wrote:So tempted to do some gui stuff, just it tends to blow up on fullscreen and XP, back when I still ran XP :)
Re: BAI
hey! nice! :D
now usable on linux too with you changes, great!
i forked it and made two branches (engineint = Engine integration):
http://github.com/hoijui/BAI/tree/engineint
http://github.com/hoijui/BAI/tree/engineint_cleanup
the first one consists of changes that i think you could merge into your master branch as is. the second one (cleanup) removes a lot of files that are only needed for you, while developing, and also moves some files to other dirs, where the engine expects them.
i am currently using the second one as a submodule in spring master, and it compiles & runs fine
i did not yet reference it as a submodule in spring master (for others to get it), because the file handling (log, cache, ...) you are using is not spring conform (will write to the wrong dirs under linux). that should not be too big of a change, i think (and hope). worst thing would be, if it conflicts with the way you want to use it (with your settings/options classes), but i think both should work together, when we just set the defaults to the spring conform dirs. i did not check how your system really works; whether it caches the defaults, but i guess it does.. have to check then.
i also tried making a branch of it compatible with spring pureint, but .. too many changes required, lost mood
did two test games, BA 7.12, Brazillian Battlefield, 1vs1:
lost vs KAIK
won vs RAI
cooping with the AI seems to work nicely
building placement is not really its strengths, but it is enough
so..
nice! :D one more AI, and even in Java!
join other AI devs in #ai in the lobby, if you like
now usable on linux too with you changes, great!

i forked it and made two branches (engineint = Engine integration):
http://github.com/hoijui/BAI/tree/engineint
http://github.com/hoijui/BAI/tree/engineint_cleanup
the first one consists of changes that i think you could merge into your master branch as is. the second one (cleanup) removes a lot of files that are only needed for you, while developing, and also moves some files to other dirs, where the engine expects them.
i am currently using the second one as a submodule in spring master, and it compiles & runs fine

i did not yet reference it as a submodule in spring master (for others to get it), because the file handling (log, cache, ...) you are using is not spring conform (will write to the wrong dirs under linux). that should not be too big of a change, i think (and hope). worst thing would be, if it conflicts with the way you want to use it (with your settings/options classes), but i think both should work together, when we just set the defaults to the spring conform dirs. i did not check how your system really works; whether it caches the defaults, but i guess it does.. have to check then.
i also tried making a branch of it compatible with spring pureint, but .. too many changes required, lost mood

did two test games, BA 7.12, Brazillian Battlefield, 1vs1:
lost vs KAIK
won vs RAI
cooping with the AI seems to work nicely

building placement is not really its strengths, but it is enough

so..
nice! :D one more AI, and even in Java!
join other AI devs in #ai in the lobby, if you like
Re: BAI
@hoijui Ive manually merged your changes in, just one question though, does
include version number?
Code: Select all
String modSpecifier = callback.getMod().getHumanName().replaceAll("[^0-9a-zA-Z_-.]", "_");
Re: BAI
added your AI here:
http://springrts.com/wiki/AI:Skirmish:L ... evelopment
with a basic template, in case you want to extend it.
also made this list a bit more color full
http://springrts.com/wiki/AI:Skirmish:L ... evelopment
with a basic template, in case you want to extend it.
also made this list a bit more color full
Re: BAI
Pureint is the awesome thing hoijui has been working on, a refactoring of the interface (so some code changes needed), but also a change from JNA to JNI, which does a lot of good for performance :)Petah wrote:@hoijui
And what is this pureint thing?
He needs to get it into the next release I think ;) Right now it's a branch only :) He says he needs a Harem for motivation ^_^ Know any ? :)
For my test muck Java AI I have a branch against pureint, and it works really well :) (I already got several issues resolved for you in advance with that ^_^)
Ohyeah :)
http://github.com/spring/spring/tree/pureint
http://code.google.com/p/crans-java-ai/ ... es/pureint
Re: BAI
yep that.. harem would be good!
The main changes for you, in pureint:
not pureint related:
you should use Mod.getHumanName() or Mod.getShortName(), and never Mod.getFileName() (is @deprecated in master and pureint). of course it is not very important for cache files, but still better. there is a new archive format in spring, which is called rapid, and works a bit like git. archives (mainly mods) are downloaded not as one file, but each file (zipped) is downloaded separately. on mod update, only changed files get downloaded, and you can use both versions of the mod with 30MB + 100KB bandwidth + file-system usage, instead of 60MB.
the file names of these archives are hashes though, while the human- and short-name stay the same.
changes needed in your AI for engine conformance:
spring can have multiple data-directories, and these days, it is used on all platforms by default. only one of these directories is writable though. on windows, this is not really a problem for AIs, as all their files will be in the same data dir, which is also the writable one.
under linux though, this is often/usually not the case.
with the result that your SkirmishAI.jar will be here:
/usr/shared/games/spring/AI/Skirmish/BAI/0.1/SkirmishAI.jar
and cache & log files should be here:
/home/user/.spring/AI/Skirmish/BAI/0.1/logs
The AI interface has helper methods for this.
How you should create the log file path, for example:
writeable file needs to be writable; this should be false for config files eg. if you do not need to write to them
create the directory should be created, if it does not yet exist.
dir whether the path is to a directory (in contrast to a file)
common if true, will look for BAI/common/<relPath>, instead of BAI/<version>/<relPath>; also mainly useful for config files, in case the format does not change, the user can have them in common, and does not have to copy them around when a new version of the AI comes out.
i know your AI does not use config files, but well..
The main changes for you, in pureint:
- commands are integrated into the callback -> no more callback.getEngine().handleCommand(new UnitMoveAICommand(dest)), but instead callback.getUnits()[0].moeTo(dest)
(that is the change which seemed too much work for me in BAI, cause of your CommandUtil) - minor package changes (can be solved by about 3-5 find&replace over all source files)
- all callback classes (Unit, UnitDef, Resource, ...) come in these flavors:
- interface (Unit) implemented by the other 3
- abstract (AbstractUnit) is used by wrapper and stub
- wrapper (WrapUnit) OO wrapps the C style Java callback; so this so what you will usually get when calling the callback
- stub (StubUnit) has a setter for each getter. i think this could be useful for you, as you have something like UnitDefCache, which does do about this. though... maybe you will not need this anymore, as cranphin reported the JNA -> JNI move helped performance a lot.
not pureint related:
you should use Mod.getHumanName() or Mod.getShortName(), and never Mod.getFileName() (is @deprecated in master and pureint). of course it is not very important for cache files, but still better. there is a new archive format in spring, which is called rapid, and works a bit like git. archives (mainly mods) are downloaded not as one file, but each file (zipped) is downloaded separately. on mod update, only changed files get downloaded, and you can use both versions of the mod with 30MB + 100KB bandwidth + file-system usage, instead of 60MB.
the file names of these archives are hashes though, while the human- and short-name stay the same.
changes needed in your AI for engine conformance:
spring can have multiple data-directories, and these days, it is used on all platforms by default. only one of these directories is writable though. on windows, this is not really a problem for AIs, as all their files will be in the same data dir, which is also the writable one.
under linux though, this is often/usually not the case.
with the result that your SkirmishAI.jar will be here:
/usr/shared/games/spring/AI/Skirmish/BAI/0.1/SkirmishAI.jar
and cache & log files should be here:
/home/user/.spring/AI/Skirmish/BAI/0.1/logs
The AI interface has helper methods for this.
How you should create the log file path, for example:
Code: Select all
DataDirs dataDirs = callback.getDataDirs();
//allocatePath(String relPath, boolean writeable, boolean create, boolean dir, boolean common)
String absPath = dd.allocatePath("logs/main.txt", true, true, false, false);
create the directory should be created, if it does not yet exist.
dir whether the path is to a directory (in contrast to a file)
common if true, will look for BAI/common/<relPath>, instead of BAI/<version>/<relPath>; also mainly useful for config files, in case the format does not change, the user can have them in common, and does not have to copy them around when a new version of the AI comes out.
i know your AI does not use config files, but well..

Re: BAI
http://springrts.com/phpbb/viewtopic.php?f=15&t=19583
Please modify your entry or add a new one to this thread to keep track of your current AI development.
Please modify your entry or add a new one to this thread to keep track of your current AI development.
Re: BAI
Is this playable yet?
Coz I've tried to play against it on DeltaSiegeX but the game crashes when the 3second countdown at the start ends.
- Copied the data folder to get AI\data\0.1\
Doesn't sound like a BAI problem but that's the first time I've seen that error message.
Coz I've tried to play against it on DeltaSiegeX but the game crashes when the 3second countdown at the start ends.
- Copied the data folder to get AI\data\0.1\
Misspelling is there in the message.Error initializing AI Interface library from file
"E:\Root\Games\Spring\AI\Interfaces\Java\0.1\AIInterface.dll".
The call to initStatic() returned unsuccessfuly.
Doesn't sound like a BAI problem but that's the first time I've seen that error message.
Re: BAI
I think I've figured out the problem. The data\0.1 folder is empty.
The entire thing is in .java files in the other folders that I apparently have to compile first. >.>
Except that what I know of java involves compling .java files into .class files. Is this right? Do I need to do that?
EDIT: furthermore, I've no idea which file goes into which folder once I've compiled it. (dling a java complier and running it is no problem)
EDIT2: comparing the null java AI and the lib folder makes me think I'm supposed to make a .jar file somewhere...
Perhaps I should wait until an actual release. >.>
The entire thing is in .java files in the other folders that I apparently have to compile first. >.>
Except that what I know of java involves compling .java files into .class files. Is this right? Do I need to do that?
EDIT: furthermore, I've no idea which file goes into which folder once I've compiled it. (dling a java complier and running it is no problem)
EDIT2: comparing the null java AI and the lib folder makes me think I'm supposed to make a .jar file somewhere...
Perhaps I should wait until an actual release. >.>
Re: BAI
it is setup to be compiled together with spring as a whole (the CMakeLists.txt file is used for that). if you want to only compile the AI, then an ant build setup would be useful for that. the AI does currently not come with one (there was one, but it was system dependent). The other Java AIs shoudl have system independent Ant build files. They consist of build.xml and some *.properties files. You could copy them over from AI/Skirmish/NullOOJavaAI/bin/ eg, and if you are lucky, you will only have to change the properties file (one of them)...
well.. maybe it is too complicated for you, if you are not familiar with Ant.
well.. maybe it is too complicated for you, if you are not familiar with Ant.
Re: BAI
@jseah I uploaded a compiled version just for you.
http://github.com/downloads/Petah/BAI/BAI.zip
Extract it to: C:\Program Files\Spring\AI\Skirmish\ or what ever you installation path may be.
http://github.com/downloads/Petah/BAI/BAI.zip
Extract it to: C:\Program Files\Spring\AI\Skirmish\ or what ever you installation path may be.
Re: BAI
Thanks but it doesn't seem to run.
Spring exits immediately when the start game timer reaches 0. No errors, no logs generated in the AI folder. Infolog.txt indicates everything went well with no errors.
Last infolog lines are:
BA712.sd7
DeltaSiegeDry.smf
1 BAI against nothing, 1 BAI against 1 E323AI, 3 BAI against 3 E323AI.
All generate the same behaviour.
Spring exits immediately when the start game timer reaches 0. No errors, no logs generated in the AI folder. Infolog.txt indicates everything went well with no errors.
Last infolog lines are:
Played on:[ 0] -> Version: 0.81.2.1 (0.81.2.1-0-g884a107{@}-cmake-mingw32)
[ 0] -> connection established (given id 0)
[ 0] Spectator invalid finished loading and is now ingame
[ 0] GameID: 4012f54bcb629dec2b0bf38d4b4826ae
BA712.sd7
DeltaSiegeDry.smf
1 BAI against nothing, 1 BAI against 1 E323AI, 3 BAI against 3 E323AI.
All generate the same behaviour.
Re: BAI
maybe have a look at the log file(s) under AI/Interface/Java/log/.
post through pastebin.com if you can not get anything out of them.
as this has not been very widely tested, i can not guarantee it has no bugs, but under windows it should work if you have a recent JRE or JDK installed. it should find it through registry. if you have it installed, but it does not find it anyway, then you might set the JAVA_HOME env var.
post through pastebin.com if you can not get anything out of them.
as this has not been very widely tested, i can not guarantee it has no bugs, but under windows it should work if you have a recent JRE or JDK installed. it should find it through registry. if you have it installed, but it does not find it anyway, then you might set the JAVA_HOME env var.
Re: BAI
Hmm... I don't think it needs pastbin since it's 5 lines long.
Only the last line seems to be important.
Only the last line seems to be important.
I'm reinstalling my Java runtime environment and trying again. Got to wait for a download to finish in order to do so however. Perhaps in a few hours time.05/20/10 11:43:12 / NORMAL(5): Unable to find common read-only native libs data-dir (optional).