yep that.. harem would be good!
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.
also.. if you are missing something in pureint still, tell me, and if it makes sense to have it, and it not utterly difficult or ugly, i will likely do it.
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);
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..
