Page 12 of 23

Re: Interface Redesign

Posted: 13 Jul 2008, 14:20
by zenzike
Great work hoijui!

I think that the first option:

Code: Select all

struct SMoveUnitCommand { int unitId, ...};
struct SBuildUnitCommand { int unitId, ...};
struct SAttackUnitCommand { int unitId, ...};
is more sensible; each one of these is bound to a particular commandID; exactly like the Events I implemented. That way there's no guessing how things work, since it is self explanatory in the code. I don't advise a CustomUnitCommand though, since that would lead us away from having a Command for each action.

I can't wait to see what you've been up to :)

Re: Interface Redesign

Posted: 13 Jul 2008, 14:37
by hoijui
ok. then ill go on that way :-)

i agree that an SCustomCommand would be ugly. if we will not have one, it will be impossible for AIs to use custom mod commands. the question there is how bad would that really be.
i will not have one for now, as it would be easy to add one later anyway, if requested by a modder or AI dev.

Re: Interface Redesign

Posted: 14 Jul 2008, 13:16
by hoijui
the commands are done and working too now. everything in IAICallback is done now, now i will do IAICheats. As it is nearly exclusively copy & paste, it should not take long.

when i am done with that, i will do some cleanup, and then some simple performance tests/comparisons between the normal C++ and the wrappped C++ interface.

Re: Interface Redesign

Posted: 14 Jul 2008, 13:20
by Agon
hoijui wrote:the commands are done and working too now. everything in IAICallback is done now, now i will do IAICheats. As it is nearly exclusively copy & paste, it should not take long.

when i am done with that, i will do some cleanup, and then some simple performance tests/comparisons between the normal C++ and the wrappped C++ interface.
Great work, so this can be in 0.77 release?

Re: Interface Redesign

Posted: 14 Jul 2008, 13:30
by hoijui
well...
they said they do not want experimental stuff, and i woudl say this is experimental. also.. are we ready on the how to load/package AIs thread? we may should release/integrate this two things at the same time, or not?

Re: Interface Redesign

Posted: 14 Jul 2008, 13:37
by Agon
hoijui wrote:well...
they said they do not want experimental stuff, and i woudl say this is experimental. also.. are we ready on the how to load/package AIs thread? we may should release/integrate this two things at the same time, or not?
Hm, right. But in the next time we try to test the svn versions, so we could test AIs, too.
If RAI, NTAI and AAI are ported to the new interface and if they work then they not including it in the release?

Re: Interface Redesign

Posted: 14 Jul 2008, 17:05
by zenzike
We're still at the very early stages of development here. I expect it will be another month before this is "production ready".

This AI interface isn't an important part of the next release since the current won works fine, so I don't expect we'll be done for 0.77. I'd rather we had the interface well tested before we have it pushed into the official release.

Re: Interface Redesign

Posted: 15 Jul 2008, 00:16
by AF
There are usually release followed by bug fix release, i think this is a very important thing and we should not push it back unnecesarily.

Run this alongside the existing interface until its tested enough that we can remove the old interface entirely.

Re: Interface Redesign

Posted: 15 Jul 2008, 09:05
by hoijui
..yeah, also a good point! as there will be lots of ppl testing it, it would be good to have it in the release. how would we do it? have all the current AIs (AAI, KAIK, RAI, ...) as normal, plus all of them with the new wrapped interface? (this again interferes with the naming/packaging,dir configuration and loading)

Re: Interface Redesign

Posted: 15 Jul 2008, 10:21
by zenzike
Well once you're happy with what you've done, let me take a look at what you've got. I'll merge it into the SVN with whatever changes might be required so that we can get testing.

Re: Interface Redesign

Posted: 15 Jul 2008, 23:21
by Forboding Angel
As a point to note, I have a very vested interest in making sure that AI's perform well. To that end, when you guys talk about testing you mean essentially playing games vs AI's right? If that's the case, let me know and I'll help out with testing.

Re: Interface Redesign

Posted: 18 Jul 2008, 23:14
by hoijui
hello...
i am kind of finished. most that we need should be in there now. its only for GlobalAI so far.
i am very tired right now, so i can just hope that i included everything that is needed in this patch, if not, tell me please. the contents of it are described next to the file link below.
it is a diff made against r6201.

it compiled and ran for me.
when you applied the patch, you can only use NullAI or RAI afterwards, the other AIs wont work.
i tested with XTA 9.44 on the map Brazilian Battlefield. it seemed to perform like before.

to apply the patch:
cd <directory where you have springSVN6201> # with dir or ls you should see: rts, game, AI, ...
patch -p 0 < caiinterface.txt

i had to zip it cause it was too big for the forum oterwise

Re: Interface Redesign

Posted: 20 Jul 2008, 18:39
by hoijui
..if anyone is doing somethign with the code, or thinks somethign has to be done, please let us others know, so we wont work on the same thing in parallel.

Re: Interface Redesign

Posted: 20 Jul 2008, 19:50
by AF
tbh I think this sort of work should be done in the svn, perhaps in a branch or in code that doesn't affect the current workings

Re: Interface Redesign

Posted: 21 Jul 2008, 11:02
by hoijui
r6208 contains the branch caiinterface, which has the diff from above applied. lets go on there with changes (right AF, it is better that way).

Re: Interface Redesign

Posted: 21 Jul 2008, 11:46
by hoijui
question mainly to tobi:
for the callback function pointers, i did nto specify a calling convention specificly. Should this be done or not?

i compiled r6208 with mingw (gcc version 4.2.1) for windows. if anyone uses an other compiler and wants to exchange the RAI dlls, to test if we can use them with engines compiled with different compilers, let me know by pm, or post a link to your RAI dll here.
mine is here:
C AI interface RAI r6208 MinGW 4.2.1

Re: Interface Redesign

Posted: 24 Jul 2008, 11:58
by hoijui
hmm.. as nobody seems to do anything...
we could make all AIs currently in SVN use the wrapper C++ interface (in the C AI interface branch only fo course). Therefore, i think we should take the whole wrapper code currently under RAI, to a subfolder in rts/ExternalAI/, eg rts/ExternalAI/CppWrapper/. Cause the way it is now, we had to copy that code to each AI, and maintain it separately. If no one has anythign against it, i would start doing that.

Re: Interface Redesign

Posted: 30 Jul 2008, 19:06
by hoijui
just to let you know.. i am working on it.
what i am doing now is:
* simplifying the engine -> AI interface/intercommunication code
* adding in support for interface libraries as a middleware between Engine and AI

i guess i am the onlyone currently workign on the C AI branch.. if so, then i recommend you not t ostart anything there before my next submit, as it will be huge and change a lot.

Re: Interface Redesign

Posted: 31 Jul 2008, 23:38
by hughperkins
Cool to see stuff happening. Looking forward to see how this goes!

Re: Interface Redesign

Posted: 02 Aug 2008, 16:57
by AF
This is good, Im glad some progress is happening and the whole AI community here will benefit greatly because of it.