Boo AI Hello World

Boo AI Hello World

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

Moderators: hoijui, Moderators

Post Reply
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Boo AI Hello World

Post by hughperkins »

GlobalAI "Hello world" using Boo, a Python compiler for .Net.

http://manageddreams.com/csai/testbooai.zip

To use:

*copy bot-libs\booailoader.dll and bot-libs\booailoader.xml to taspring\ai\bot-libs
*copy Booai\csai.dll and booai\csai.pdb to taspring\ai\BooAI (new directory)
*create a multiplayer game and specify "booailoader.dll" as the bot dll

To rebuild, with booc in the path, type:
*booc -t:library CSAI.py -r:csaiinterfaces.dll
*copy the new csai.dll and csai.pdb into taspring\ai\BooAI directory, overwriting the old files
Torian
Posts: 2
Joined: 24 Jan 2007, 12:58

Post by Torian »

My first steps in playing around with an AI were written in C++, and it soon stops due to missing compilers, long round-trips, memory leaks, and so on...

so the idea of having a script language linked into spring as ai is great (at least from my point of view) and reloading of that ai would be even greater. I gave your Boo example a try, and: these thingies work! :o)
(I had to use the 0.73b1-version, the new 0.74b_ it gave an exception)

But now I have got a problem and three little questions for you:
a. Is a new csailoader for the actual spring version available?
b. What Boo version do you use?
c. (the actual problem): when using a Boo List object (like "b as List = List()"), the ai crashes! any ideas?

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

Post by jcnossen »

Nice to see you active again :)
Does this mean AI's are compiled from source when started? That would be pretty nice..
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Post by hughperkins »

Torian,

Good to see that this is being used!
But now I have got a problem and three little questions for you:
a. Is a new csailoader for the actual spring version available?
ermmmm, it's been a while.... there's a major change going from 0.73 to 0.74: the Spring compiler changed from msvc to gcc.

For C++, msvc and gcc are incompatible, they wont link. Thats a problem because the csailoader must be written in msvc to work.

There are two solutions to this, but you're going to have to poke around a little to get them to work:

- use a C-layer proxy between msvc and gcc. This was working at some point. The C-layer proxy was even integrated into Spring! It goes by the name of ABIC.

There's a csailoader that can link with ABIC.

- use Mono instead. There is a mono layer. This also passes through the ABIC layer.

The ABIC layer makes things quite complicated... you're going to have to be willing to dig around a little to get things to compile.
b. What Boo version do you use?
I dont ;-) Boo compiles to standard .Net ilsm code, and the csailoader can work with anything that compiles into standard .net ilsm code.
c. (the actual problem): when using a Boo List object (like "b as List = List()"), the ai crashes! any ideas?
No, my Python is very rusty. Isnt a List an abstract class? Does it work if you use ArrayList instead?
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Post by hughperkins »

jcnossen wrote: Does this mean AI's are compiled from source when started? That would be pretty nice..
Boo compiles to standard ilsm code.

Pretty easy to get things to compile from source though, since the .Net Framework runtime contains the csc compiler, and the Mono runtime contains the gmcs compiler, so no need to install Visual Studio or anything.

nant is able to build a project using csc, then run it using exec. Put them in separate targets, with a "depends" in the run pointing to the build.

For dlls, you can make a loader dll that first builds the target dll then loads it.
Torian
Posts: 2
Joined: 24 Jan 2007, 12:58

Post by Torian »

hughperkins wrote: ermmmm, it's been a while.... there's a major change going from 0.73 to 0.74: the Spring compiler changed from msvc to gcc.
Okay, so no new csailoader possible, but gcc as compiler...
- use Mono instead. There is a mono layer. This also passes through the ABIC layer.
*sigh* sounds better than the c-layer proxy (considering cross-platform usage)
No, my Python is very rusty. Isnt a List an abstract class? Does it work if you use ArrayList instead?
this is the relation between List and ArrayList found (for example) in java...
in Boo (btw one of the most under-documented languages I ever encountered, and it is not Python :o|), List is a double-linked list; in the shell, there is no problem instantiating one...

Okay, long posting, short story:
the csailoader does not (and may never) work with spring 0.74+.
there might be a problem with spring 0.73 and csailoader affecting some Boo features like List (rendering that approach useless for above-simple-AI programming).
I take a look at the mono/ABIC issue; but I am afraid, in the next few weeks I cant spend much time on that...
[flowery] So, the light at the end of the tunnel (ie AIs in script languages like perl, lua, python, etc) vanishes again...[/flowery] ;o]
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Post by hughperkins »

You need to use the csailoader from SVN. It has to use the ABIC layer, because csailoader needs to build using msvc.

It does work, I've tried it ;-) but I cant promise that it doesnt need a little dust wiping off it.
Post Reply

Return to “AI”