Interface Redesign
Moderators: hoijui, Moderators
Re: Interface Redesign
Nah they aren't loaded only from there, otherwise AIs would never have worked in e.g. ubuntu packages, where they are installed in a read only system wide data directory.
The chdir call is just there to accomodate legacy (AI) code that does not call the right functions to "calculate" the absolute path where it should load files from / save files to.
The chdir call is just there to accomodate legacy (AI) code that does not call the right functions to "calculate" the absolute path where it should load files from / save files to.
Re: Interface Redesign
yeah.. that never can have worked then, cause AIs are loaded only from {cwd}/AI/Bot-libs/.
the code responsible for loading AIs (Spring SVN trunk rev. 6631):
GlobalAIHandler.cpp (parameter dll would be something like "AI/Bot-libs/KAIK-0.13.dll")
GlobalAI.cpp
SharedLib.cpp
SoLib.cpp
the code responsible for loading AIs (Spring SVN trunk rev. 6631):
GlobalAIHandler.cpp (parameter dll would be something like "AI/Bot-libs/KAIK-0.13.dll")
Code: Select all
bool CGlobalAIHandler::CreateGlobalAI(int teamID, const char* dll)
{
// irelevant code here
ais[teamID] = SAFE_NEW CGlobalAI(teamID, dll);
// irelevant code here
}
Code: Select all
CGlobalAI::CGlobalAI(int team, const char* botLibName)
{
LoadAILib(team, botLibName, false);
}
void CGlobalAI::LoadAILib(int team, const char* botLibName, bool postLoad)
{
// irelevant code here
lib = SharedLib::Instantiate(botLibName);
// irelevant code here
}
Code: Select all
SharedLib *SharedLib::Instantiate(const char *filename)
{
#ifdef _WIN32
return SAFE_NEW DllLib(filename);
#else
return SAFE_NEW SoLib(filename);
#endif
}
Code: Select all
SoLib::SoLib(const char *filename)
{
// filename is still the same like dll: "AI/Bot-libs/KAIK-0.13.dll"
// therefore, it is searched only in CWD:
// "{cwd}/AI/Bot-libs/KAIK-0.13.dll"
so = dlopen(filename,RTLD_LAZY);
if (so == NULL)
logOutput.Print("%s:%d: SoLib::SoLib: %s", __FILE__, __LINE__, dlerror());
}
Re: Interface Redesign
it is in this thread and it is not that far back but the more you post about other people findign ti the further back int he thread it will become =p
also since all AIs will be specified via lua scripts which deal with what options are available etc etc maybe we should just specify a lua script as an identifier? Rather than an AI name requiring the engine to poll the AIs. This way we can remove the interface tag too aswell as the version tag etc as any lua script requiring those can use them as AI options.
also since all AIs will be specified via lua scripts which deal with what options are available etc etc maybe we should just specify a lua script as an identifier? Rather than an AI name requiring the engine to poll the AIs. This way we can remove the interface tag too aswell as the version tag etc as any lua script requiring those can use them as AI options.
Re: Interface Redesign
Ah ok, interesting.
Well it did work because lobbies on linux generally pass absolute path to AIs. (Which they may do cause they found relative path didn't work
)
Well it did work because lobbies on linux generally pass absolute path to AIs. (Which they may do cause they found relative path didn't work

Re: Interface Redesign
ok, i take this as: use all data directories.
and cuase it is easier for me, i will not restrict the search of libs to the data directory the lua files are found in, for now.
and cuase it is easier for me, i will not restrict the search of libs to the data directory the lua files are found in, for now.
Re: Interface Redesign
I think i never mentioned it so far, so i do now:
One of the two main reasons why we want to have hte C interface is to be able to use different compilers for the engine and the AIs. I was able to run Intel compiled AIs (KAIK and RAI) with a MinGW compiled spring, so it works! :D
something else:
the current directory scheme looks like this:
But in my eyes, the impls dir does not make much sence. The impls dir (before: AI/Bot-libs) made sense cause unitsync and the engine could just scan that dir for dlls and they knew which AIs were available. but now, as neither the engine nor unitsync will scan impls, it makes the whole thing just more complicated.
Scenario for installing a minimal AI, consisting of a DLL and an AIInfo.lua file:
part of the AI is here: AI/Skirmish/impls/MyAI-0.1.dll
and an other part is here: AI/Skirmish/data/MyAI/AIInfo.lua
Proposal:
putting everything of an AI into its data directory, like this:
AI/Skirmish/data/MyAI/myLib-0.1.dll
AI/Skirmish/data/MyAI/AIInfo.lua
+ no difference for unitsync
+ cleaner appearence of AIs in the fielsystem (in my eyes)
* extracting a single dir adds an AI
* deleting a single dir removes an AI
-> less confusion
well.. I think you get it now
ps: same proposal for AI Interfaces:
AI/Interfaces/data/MyInterface/myLib-0.1.dll
AI/Interfaces/data/MyInterface/InterfaceInfo.lua
One of the two main reasons why we want to have hte C interface is to be able to use different compilers for the engine and the AIs. I was able to run Intel compiled AIs (KAIK and RAI) with a MinGW compiled spring, so it works! :D
something else:
the current directory scheme looks like this:
Code: Select all
{spring-data-dir}/AI/Interfaces/impls/C-0.1.dll
{spring-data-dir}/AI/Interfaces/impls/Java-0.1.dll
{spring-data-dir}/AI/Interfaces/data/C/InterfaceInfo.lua
{spring-data-dir}/AI/Interfaces/data/Java/InterfaceInfo.lua
{spring-data-dir}/AI/Skirmish/impls/KAIK-0.13.dll
{spring-data-dir}/AI/Skirmish/impls/hoijuiAI-0.1.jar
{spring-data-dir}/AI/Skirmish/data/KAIK/AIInfo.lua
{spring-data-dir}/AI/Skirmish/data/hoijuiAI/AIInfo.lua
Scenario for installing a minimal AI, consisting of a DLL and an AIInfo.lua file:
part of the AI is here: AI/Skirmish/impls/MyAI-0.1.dll
and an other part is here: AI/Skirmish/data/MyAI/AIInfo.lua
Proposal:
putting everything of an AI into its data directory, like this:
AI/Skirmish/data/MyAI/myLib-0.1.dll
AI/Skirmish/data/MyAI/AIInfo.lua
+ no difference for unitsync
+ cleaner appearence of AIs in the fielsystem (in my eyes)
* extracting a single dir adds an AI
* deleting a single dir removes an AI
-> less confusion
well.. I think you get it now
ps: same proposal for AI Interfaces:
AI/Interfaces/data/MyInterface/myLib-0.1.dll
AI/Interfaces/data/MyInterface/InterfaceInfo.lua
Re: Interface Redesign
+1 Sounds much cleaner.
Edit:
By the way I'm working on the Mono AI interface.
It will take some time to get it working because I need to learn everything except C# from the beginning.
Edit:
By the way I'm working on the Mono AI interface.
It will take some time to get it working because I need to learn everything except C# from the beginning.
Re: Interface Redesign
i dont understand, the whole point of seperate interface libraries was that we did not have the problem of being forced to code a pure c api in a dll, because sometimes we do not have dll files at all.
What do we do when confronted with a .jar file? Are we going to implement the java interface inside spring itself? Does this not invoke yet another slew of issues?
If we're talking about supporting AIs using the C interface and only the C interface then this makes sense. But we're not, because we've already discussed C# and java AIs. Nor should we needlessly duplicate the bindings code inside each and every file, having 5 implementations of the java interface sitting in our AI folders for 5 java AIs is wasteful and introduces complexity.
I get the impression you have lost sight of something or you have failed to communicate your intentions clearly.
What do we do when confronted with a .jar file? Are we going to implement the java interface inside spring itself? Does this not invoke yet another slew of issues?
If we're talking about supporting AIs using the C interface and only the C interface then this makes sense. But we're not, because we've already discussed C# and java AIs. Nor should we needlessly duplicate the bindings code inside each and every file, having 5 implementations of the java interface sitting in our AI folders for 5 java AIs is wasteful and introduces complexity.
I get the impression you have lost sight of something or you have failed to communicate your intentions clearly.
Re: Interface Redesign
the interface dll is what allows you to load .jar AI without a helper dll written by yourself.
Re: Interface Redesign
AFAICS and IIRC, what he made is exactly what he communicated long time ago in this thread.
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Interface Redesign
To save me from reading through 17 pages, if I wanted to play with java AIs:
- to what extent should I wait for this to be completed?
- to what extent is it usable already? what is the appropriate wiki page to read to find out how to use it?
Note that this is far from a commitment to do more than read the reply to this, but if it's sufficiently easy to do something and play... well, who knows, maybe one more new AI
Hugh
- to what extent should I wait for this to be completed?
- to what extent is it usable already? what is the appropriate wiki page to read to find out how to use it?
Note that this is far from a commitment to do more than read the reply to this, but if it's sufficiently easy to do something and play... well, who knows, maybe one more new AI

Hugh
Re: Interface Redesign
so far.. it is not possible to write a java AI.
i started working on the Java interface again a few days ago. if we are lucky, you may find something usable in two weks from now, but that is neither a commitment
i started working on the Java interface again a few days ago. if we are lucky, you may find something usable in two weks from now, but that is neither a commitment

Re: Interface Redesign
If you can work bit by bit in the svn branch rather than there being a big commit in 2 weeks perhaps mr.perkins could contribute?
Re: Interface Redesign
you seem to like talking about stuff you dont know hae? .. you remind me on my mum.. first insult. if you were wrong, someone will tell you and you can still say: "ups"
i was committing quite every day the last two weeks, and i do not need any help right now on the Java interface.
i was committing quite every day the last two weeks, and i do not need any help right now on the Java interface.
Re: Interface Redesign
It wasnt an insult at all just encouragement *flutters eyes*
Re: Interface Redesign
specially as it is you... you should work on your encouraging technique i think 
then again, of course i should know that encouraging from you may sound like an insult, and just asume it to be the nicer of the two.. sorry. .. again, like with my mum...
in fact it was just her fault.
maybe also a little my bad mood these days.
at third place.. maybe your not too happy life?

then again, of course i should know that encouraging from you may sound like an insult, and just asume it to be the nicer of the two.. sorry. .. again, like with my mum...
in fact it was just her fault.
maybe also a little my bad mood these days.
at third place.. maybe your not too happy life?
Re: Interface Redesign
Ah that is only AFs image.hoijui wrote:specially as it is you... you should work on your encouraging technique i think
then again, of course i should know that encouraging from you may sound like an insult, and just asume it to be the nicer of the two.. sorry. .. again, like with my mum...
in fact it was just her fault.
maybe also a little my bad mood these days.
at third place.. maybe your not too happy life?
Btw. I created a Mono cmake module to find Mono, currently only tested on my machine. I also needed Glib2 but there I found a cmake module online from KDE repository which should work for Linux and Windows I think, maybe even Mac OS.
So yeah the Mono AI interface will require Mono and Glib2 (because Mono requires).
But I will setup it that if Mono or Glib2 are not found Mono packages are disabled so normal build without Glib2 and Mono is possible

Oh and I have already some code but nothing that could make it possible to code an CLI AI.
Could I get SVN access or if the switch to Git (hopeful soon) happens Git access.
I don't want to lose my code if my HD breaks.....
Should I upload a patch which proves my bad coding style?

Re: Interface Redesign
I gain nothing from insults, and have long held the view that the AI forum is a safe haven from that sort of thing!
Re: Interface Redesign
Sorry, I could not resistAF wrote:I gain nothing from insults, and have long held the view that the AI forum is a safe haven from that sort of thing!


Lets get to the topic.
I have already a person who is interested in the Mono AI interface

Will the interfaces be shipped with a release or release independent?