How to begin working on an AI in C

How to begin working on an AI in C

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

Moderators: hoijui, Moderators

Post Reply
Norli
Posts: 5
Joined: 16 Oct 2014, 02:32

How to begin working on an AI in C

Post by Norli »

Hi all,

I've deleted my old post and replaced it with this one. I realized my last message was a bit of a run-on sentence. Hopefully additional information may be able to clarify what I'm looking for.

First off, a quick explanation of what I'm trying to do. I'm currently trying to upgrade an AI developed by my school for a couple of theses. The bot was originally developed on Spring 91, but after our most recent graduate's work was done the computer we had installed everything on irrecoverably crashed. I have tried to rebuild everything on a separate computer but am having some problems. Here is what I have:
- ubuntu v 14.04
- spring 98, installed via ubuntu app manager
- balanced annihilation 8.03

The problem is that the old code seems to be built around a specific file structure, rts/ExternalAI/Interface. This structure is mentioned in the wiki and in various forum posts about AI development, but I cannot find it at all in any of the spring folders created by the v98 install. The old code also relies on a series of files located in the Interface folder, namely AISEvents.h, AISCommands.h, SSkirmishAICallback.h, and SSkirmishAILibrary.h. I have tried to search the entire hard drive for these files, but nothing shows up. I have also looked into the AAI bot files since the wiki states that the AAI bot also utilizes C code, but I haven't been able to find any leads in that area.

Does anyone know if the spring engine can still handle old spring code? If so, what needs to be done? I'm getting some conflicting information between the wiki and some other sources stating that the entire rts/ExternalAI/Interface file structure was made obsolete. Any help would be greatly appreciated.
lamer
Posts: 153
Joined: 08 Mar 2014, 23:13

Re: How to begin working on an AI in C

Post by lamer »

The easiest way to compile C AI is to use spring source. Files you mentioned are there:
https://github.com/spring/spring/tree/d ... /Interface

This is how i did it:
1) git clone https://github.com/spring/spring.git
2) place your bot into spring/AI/Skirmish directory
3) cd spring && cmake . && make <AIname>

Tested with RAI (LegacyCpp), though i'm using new C++ wrapper for my project.

http://springrts.com/wiki/AI:Development
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Re: How to begin working on an AI in C

Post by PauloMorfeo »

Norli wrote:...
- ubuntu v 14.04
- spring 98, installed via ubuntu app manager
- balanced annihilation 8.03
...
Same as me, and I'm also starting to play around with AI development, except that I'm working on a Java AI. This tutorial (for Java) is not too outdated and worked fine for me:
http://springrts.com/wiki/AI:Development:Lang:Java
Norli wrote:...
The problem is that the old code seems to be built around a specific file structure, rts/ExternalAI/Interface. This structure is mentioned in the wiki and in various forum posts about AI development, but I cannot find it at all in any of the spring folders created by the v98 install. The old code also relies on a series of files located in the Interface folder, namely AISEvents.h, AISCommands.h, SSkirmishAICallback.h, and SSkirmishAILibrary.h. ...
Sounds like you are trying to compile a C/C++ AI!? In order to do that of course you have to compile the code linking to spring's source code (at least including the header files).

What you described above - "spring 98, installed via ubuntu app manager" - would have installed the binaries and the game data, it would not have installed any of spring's source files. Did I misunderstood something?

You have here a working tutorial on how to download and compile the source code of Spring:
http://springrts.com/wiki/Building_Spring_on_Linux
Norli wrote:...
Does anyone know if the spring engine can still handle old spring code? If so, what needs to be done? I'm getting some conflicting information between the wiki and some other sources stating that the entire rts/ExternalAI/Interface file structure was made obsolete. Any help would be greatly appreciated.
Those files you mention are still indeed part of the source:
https://github.com/spring/spring/tree/d ... /Interface
And as far as I've read since I've recently came back to Spring from many years ago, the old AI system of SpringRTS should have been kept without change.
Norli
Posts: 5
Joined: 16 Oct 2014, 02:32

Re: How to begin working on an AI in C

Post by Norli »

Thanks for the responses. I've been away from Internet for the past few days, but I'll test all of your suggestions asap.

Thanks again for trying to help me figure this out.
Norli
Posts: 5
Joined: 16 Oct 2014, 02:32

Re: How to begin working on an AI in C

Post by Norli »

So the good news is that I have been able to use your suggestions to build Spring from source and all of the files necessary to build the game now exist. Thank you again! I can build the old agent, but now the game crashes whenever I implement it. The first couple of times I tried to test this agent the game actually froze on the "Loading Skirmish AI" status on the spring load bar, but now the game just exits to desktop.

So far I have AIInfo.lua, AIOptions.lua, and libSkirmishAI.so in the /usr/lib/spring/AI/Skirmish/... folder. I have all fo the bot's source code in the /usr/share/games/spring/AI/Skirmith/... folder. There is no data in the /home/.config/spring/AI/Skirmish/... folder.

Does anyone know if the crash is due to some other required file being queried but not existing? The AIOptions.lua file is the same as the version in NullAI, and removing it from the folder did not have any effect.
Post Reply

Return to “AI”