What do you need to build an AI

What do you need to build an AI

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

Moderators: hoijui, Moderators

Post Reply
User avatar
munch
Posts: 311
Joined: 26 May 2005, 20:00

What do you need to build an AI

Post by munch »

Hi Guys,

I've been meaning to do some coding for ages. What do I need in order to build an AI in terms of tools? I already have the GNU C++ compiler installed and I'm using Eclipse as an editor, which works out the build dependencies etc. So say I wanted to modify JCAI, would do I need to build it apart from the JCAI source?

Thanks in advance

Munch
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

Unfortunately you can't compile current windows spring version on GNU C++ right now. However I recently submitted a patch for linux port to get it compiled on Visual Studio. Meaning the linux port at the moment will compile on Windows with both GCC and VS, but I couldn't get it to run because of a crash somewhere in minizip code.
To cut a long story short you can:

-get Visual Studio + boost to compile the clan SY version and JCAI.

-use GNU C++ and get the OpenAL, libjpeg, zlib and boost libraries to try to get the port running on windows, fix the global AI dll loading port code and build JCAI...

I think option number one is the easiest :)
User avatar
munch
Posts: 311
Joined: 26 May 2005, 20:00

Just the AI

Post by munch »

Hi Zaphod,

Thanks - that's helpful, are you saying that the whole of Spring can't be built with GNU tools or the AI dll? It's only the AI that I want to build.

I'm hoping that thought the main body of the Spring code might contain some unpleasant proprietary MS stuff that the interface to the Global AI is clean?

I'm (perhaps naively) hoping to be able to build an AI DLL against a given API, so that I don't have to compile the whole of spring, but instead just drop the DLL into the right folder and hey presto it picks up my DLL at runtime instead of the default one.

All this is based on the assumption that since the AI is entirely self contained, it doesn't contain any proprietary anything and can just be written in standard C++... which may not be a valid assumption!

Cheers

Munch
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

The problem is that you need to use the same STL implementation and same structure alignment rules as the spring exe, because the AI needs to access STL structures that are created by spring. In practice this means that you just have to use VS for the AI when VS is used for spring...
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

Maybe you could fix that now that you are in charge of the ai interface Zaphod, just implement your own minimal vector like container and use to transfer values between spring and the AI.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

In that case, I could be changing the std::map for the list of buildoptions, all the use of std::string and the other std::vector usage in the UnitDef and FeatureDef. But then it would still depend on structure alignment and how RTTI is implemented by the compiler.
Another option would be to implement a sort of IUnitDef and IFeatureDef interface. That's the best solution I guess.
However for the next 2 weeks I have to learn for exams so I do not have time for my AI or the AI interface...
User avatar
munch
Posts: 311
Joined: 26 May 2005, 20:00

Post by munch »

OK Zaphod, well I'll look forward to whatever you come up with =) For my money you always want structs to be padded to the correct alignment - apart from being portable, it gives you more speed. Also you want a clean API that doesn't have any dependencies on the rest of the code. But then I'm not doing the work so I really appreciate anything that lets me get compiling!

Thanks again and all the best with the zams.

Munch
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

Sorry, but I think it's too much trouble for what you get. Aside from creating an IUnitDef and IFeatureDef interface, which is quite a lot of work already, you also need to modify the rest of the interface to stop using STL. That is GetCurrentUnitCommands(), Command class and a bunch of IGroupAICallback stuff. All the current AI code depends on that so you have to change that as well.
If anyone wants to go through all this trouble and implement this, ok. I personally will not do this, the linux port is being worked on and when this is ready you can you use that to create an AI for. Sorry if I sound a little harsh, but I don't want to keep you waiting on nothing either.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Why couldnt the linux porters have simply worked directly on the windows CVS code, afterrall anythign widnows ro linux specific can be turned on and off using if and define statements cant it?
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

For one, the SY are very restrictive in giving away SF accounts, and also because of all the changes required, the porting would leave the codebase unusable for a working window version for quite some time. It wasn't just adding linux code, it was removing all the windows code and replacing it with portable code using SDL,OpenAL and boost::thread
Also some of the linux devs really hated CVS and wanted to use subversion.
So because it had to be a seperate branch anyway, they decided to use a subversion repository.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

fairdo, though I think it would still be a good idea to let spring for windows have the option of using non directx sound media, and more independance, and we're usign boost libraries now anyways for luabind.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

when the linux build is stable/playable I have the feeling it will be a much better candidate for re-integration into the main windows project
User avatar
munch
Posts: 311
Joined: 26 May 2005, 20:00

Post by munch »

Zaphod wrote:Sorry, but I think it's too much trouble for what you get.... Sorry if I sound a little harsh, but I don't want
to keep you waiting on nothing either.
Hey no worries - thanks for letting me know. Appreciated.

Cheers

Munch
Post Reply

Return to “AI”