RAI v0.601 - Page 12

RAI v0.601

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

Moderators: hoijui, Moderators

imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: RAI v0.601

Post by imbaczek »

do not use dev-c++, use codeblocks + mingw
Reth
AI Developer
Posts: 70
Joined: 15 Aug 2006, 14:05

Re: RAI v0.601

Post by Reth »

dev-c++ should work fine as well, you will run into the same problems regardless. The default project settings assume that the {spring source directory} and the {mingwlibs} directory are at the same location. If this is done correctly, the boost compile errors will all go away.

To change it (If it is located somewhere else):
In the main Window: Project->Project Options
In the 'Project Options' Window: Directories->Include Directories
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: RAI v0.601

Post by imbaczek »

dev-c++ uses an eons-old compiler by default, that's why you should avoid it.
gavan
Posts: 53
Joined: 03 Feb 2006, 13:52

Re: RAI v0.601

Post by gavan »

Thanks for the replies so far, they did help a lot.. i have all the required libs now i think, and using codeblocks, but i'm getting a new error;

C:\Users\gavan\Desktop\theKAP\spring_0.78.2.1\AI\Global\RAI\boost\boost\test\utils\runtime\file\config_file.cpp||In constructor `boost::runtime::file::param_namespace::param_namespace(boost::runtime::cstring, const boost::runtime::file::param_namespace*)':|

C:\Users\gavan\Desktop\theKAP\spring_0.78.2.1\AI\Global\RAI\boost\boost\test\utils\runtime\file\config_file.cpp|63|error: no matching function for call to `assign_op(boost::runtime::dstring&, boost::runtime::cstring&)'|
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: RAI v0.601

Post by hoijui »

looks like you try to compile bost directly from source into RAI.
you should not need the boost sources on your PC at all, you only need the library and the headers, and this should both be under mindgwlibs.

.. ahh i see, you are trying to compile wiht the Makefile that comes with RAI.
i think you should not need boost at all, but you have to edit the project file, RAI.dev, to use this build flag:

Code: Select all

-DBUILDING_AI
do like this:
global replace -DBUILDING_DLL with -DBUILDING_AI, as -DBUILDING_DLL is not needed anymore.

please, if you you get it all working, could you please post your adjusted RAI.dev file here in the forum, so we can inlcude it in hte repository? thanks :-)
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Re: RAI v0.601

Post by ivand »

Reth it's sad to say, but 3 allied RAI have lost to one KAIK on comet catcher redux.
Attachments
20090207_163229_Comet Catcher Redux_0.78.2.sdf
(4.58 MiB) Downloaded 57 times
Reth
AI Developer
Posts: 70
Joined: 15 Aug 2006, 14:05

Re: RAI v0.601

Post by Reth »

Either way, in the future, you will definitely see an increase in difficultly. For the last month I had shifted my efforts back improving the economy (last time I did any real work in this area was v0.35). The current system is just too wasteful with resources(building unneeded factories), waits too long to build the first few workers and is too cautious/stupid with expansion. The first of those issues has already been solved(not in 0.601), but a lot of my AI's intelligence fell apart when I started using builders for multiple build-lists, such as dedicated assistants.

Well.. don't expect anything too soon, its months away from completion and I'm not going to have any free time until February is over.
fliebel
Posts: 18
Joined: 24 Feb 2009, 21:34

Re: RAI v0.601

Post by fliebel »

Hi, I'm on 64 bit Ubuntu and all bots that come with the deb package crash Spring , so I wanted to compile RAI for myself, i thought that maybe the problem with the package supplied ones is that they are 32 bit.
First I tried to use the 64 bit version from jobjol.nl, but that is the wrong version for my Spring.

The wiki page says that I can just do a scons or cmake on it, but it does not have the right file... so I downloaded CodeBlocks, downloaded a Source version of Spring, downloaded the dev packages for glew, boost and mingw, and tried to compile....

Code: Select all

Linking dynamic library: RAI.so
/usr/bin/ld: .objs/Builder.o: relocation R_X86_64_32 against `__dso_handle' can not be used when making a shared object; recompile with -fPIC
.objs/Builder.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
Then I tried to add -fPIC to Project->Buld options...->Other options, but that did'nt help...
Then I tried to make a static library, but that gave me an .a file that did nothing at all when placed in the right folder...

Can anyone help me?
fliebel
Posts: 18
Joined: 24 Feb 2009, 21:34

Re: RAI v0.601

Post by fliebel »

OK, It compile now... i forgot to clean the project :oops:
But it still crashes!

Doe anyone know how to get RAI, or any other AI runing on my 64 bit iMac?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: RAI v0.601

Post by hoijui »

you will probably find nobody that will compile it for you for mac.
though, as you have spring settup for compilation on your system, you could do a debug build and run it with gdb, then, when it crashes, you type bt (in gdb) and send us the report, plus some info, eg. when the crash happend, what mod/map and such. I (or if i can not fix it probably Reth) would have a look at it then.
fliebel
Posts: 18
Joined: 24 Feb 2009, 21:34

Re: RAI v0.601

Post by fliebel »

I'm sorry to confuse you, I have an iMac, bu that does not mean I run Spring on Mac os X 10.5, I dual boot the 64 bit version of Ubuntu 8.10, and I was trying to run an ai on that.

Both the RAI that came with the apt-get bundle and my 'home brew' RAI crash right after the countdown just before the game starts.
BTW, KAIK, AIK and AAI crash as well using CA, only KAIK works so far, but only with BA.
The AI's that do work are: TestGlobalAI and chicken AI's

I'm not an experienced programmer/compiler/debugger, so I don't realy understand what I should do.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: RAI v0.601

Post by hoijui »

hmm.. sorry, looks like i was tired or something ;-)

post your infolog.txt (usually found in ~/.spring/infolgo.txt) here, from one of the games that crashed with RAI (or post one infolog.txt for each AI separately, dont mix them for this).
use http://www.pastebin.com
fliebel
Posts: 18
Joined: 24 Feb 2009, 21:34

Re: RAI v0.601

Post by fliebel »

The infolog does not look usefull to me, but here you have it:
For packaged: http://pastebin.com/m383dacb3
For homebrew: http://pastebin.com/m9983121

different mod and map(homebrew RAI) to show it makes no difference:
http://pastebin.com/m668aaa1e

If this is of no help, how can I get more debug information?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: RAI v0.601

Post by hoijui »

hmm, yes you are right, they do not help :/

i think the only thing you can do is get the spring sources, compile it with debug symbols and then debugg wiht gdb or a GUI frontend (eg ddd or kdevelop).

you should get the spring master (latest sources), and then follow the instruction here to compile:
http://spring.clan-sy.com/wiki/Building_Spring_on_Linux

if you use cmake, use -DCMAKE_BUILD_TYPE=DEBUG2 on the command line to cmake.
fliebel
Posts: 18
Joined: 24 Feb 2009, 21:34

Re: RAI v0.601

Post by fliebel »

Why should I compile spring?
Why isn't there a -dbg package in the package manager?
Would it be sufficient to only compile RAI with debug symbols?
I don't really like compiling spring from source, the last time I tried that on Fedora it took me the whole day :shock:
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: RAI v0.601

Post by hoijui »

well, you can try that, though the easiest way to do that is with the spring build system, i guess, so you had to setup this anyway.
Sorcerer
Posts: 1
Joined: 17 Mar 2009, 06:11

Re: RAI v0.601

Post by Sorcerer »

I've had the same problem with AIs on Ubuntu 8.10 64bit. I've compiled Spring from sources, and now it works fine. It is simple to compile using instructions from http://spring.clan-sy.com/wiki/Building_Spring_on_Linux . Just install all the packages specified for Debian (the same for Ubuntu) and cmake package.
Societal
Posts: 64
Joined: 05 May 2009, 13:57

Re: RAI v0.601

Post by Societal »

Reth, is RAI still being worked on? I've observed some things that could improve it's play in BA if you're interested.

* I see in the source that there is an idle builders check every 60 seconds. Sometimes if a RAI commander is disrupted (attacked and his current construction destroyed) right after the start of the game he will stand around and literally do nothing, except for defending himself if more enemies come near. I'm not sure if it's this check that finally frees him up or not but generally he will get going later on. This is even worse if it happens while the commander is underwater at the time and I've seen him stuck there permanently. However, IF I /give that team another commander somehow that resolves it and both commanders will start moving and building again. I would suggest having the idle builders check dropped to something like 5-10 seconds for the first 5 minutes of the game when any such inactive builders are a huge handicap to the economy. The CPU load for AI is relatively low during this period it shouldn't be a problem in that regards.

* On a related note the infinite loop builders get into where they are trying to build and the construction is immediately being destroyed by an enemy unit. If you start a game with two opposing RAI commanders near each other they can get stuck with #1 building a metal extractor and shooting lasers at #2's metal extractor while #2 does the same in return. Until either commander takes damage from another unit and starts to move away this loop goes on (I've seen ~40 seconds of it in one case). Some sort of check if a construction task has had to be restarted over and over due to being destroyed by an enemy unit should be made and the builder should move away from the nearest threat before another build task.

* DGun usage should probably be stopped or at least reduced when attacking any aircraft slower than a Krow. Your commanders do quite well DGunning land units but I've never seen them hit a plane. Commanders waste a lot of Energy resources right now against fast aircraft they never hit.

* Aircraft carriers end up with too high of a priority and stockpile quite a lot of missiles even when no nukes have been used. I don't know if there is any check at the moment for a unit being destroyed by a nuke launcher. I believe some sort of ramping formula for anti-nuke priority would make more sense. I've seen a lot of RAI navies and ports destroyed when they had built 5 carriers each trying to stockpile 10 missiles... but had only built one or two battleships.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: RAI v0.601

Post by hoijui »

Societal
Reth is arond sometimes, but rather seldomly. As you are already inspecting the code, why not making patches, i will include them, and if its arguably nothing that makes the AI much slower or behave worse in some circumstances, i am sure that Reth will have no problem with it.

best way is to fork the spring repo on github, commiting your patches there, and when you want me to integrate them, tell me or if i am not around, ask any of the other devs.
Reth
AI Developer
Posts: 70
Joined: 15 Aug 2006, 14:05

Re: RAI v0.601

Post by Reth »

just happened to be around today..
Societal wrote: * I see in the source that there is an idle builders check every 60 seconds. Sometimes if a RAI commander is disrupted (attacked and his current construction destroyed) right after the start of the game he will stand around and literally do nothing, except for defending himself if more enemies come near. I'm not sure if it's this check that finally frees him up or not but generally he will get going later on. This is even worse if it happens while the commander is underwater at the time and I've seen him stuck there permanently. However, IF I /give that team another commander somehow that resolves it and both commanders will start moving and building again. I would suggest having the idle builders check dropped to something like 5-10 seconds for the first 5 minutes of the game when any such inactive builders are a huge handicap to the economy. The CPU load for AI is relatively low during this period it shouldn't be a problem in that regards.
I consider the 60 second update to be nothing more than a safety net, it *really isn't suppose to ever happen*. Rather than covering up those cases, I would rather find out exactly what is causing it. On top of that, there actual is a few-unit-monitor running at 3 second intervals until RAI has more than 10 units. Although, I think I have seen cases where the commander is sitting next to a newly constructed building with 1-5 health for long periods of time without it's health changing. Internally my AI thinks its being built, so the order is never interrupted.
Societal wrote: * On a related note the infinite loop builders get into where they are trying to build and the construction is immediately being destroyed by an enemy unit. If you start a game with two opposing RAI commanders near each other they can get stuck with #1 building a metal extractor and shooting lasers at #2's metal extractor while #2 does the same in return. Until either commander takes damage from another unit and starts to move away this loop goes on (I've seen ~40 seconds of it in one case). Some sort of check if a construction task has had to be restarted over and over due to being destroyed by an enemy unit should be made and the builder should move away from the nearest threat before another build task.
There actually is a try limit of 3 or 4 where the builder will give up construction but I have seen these cases, especially with metal extractors, were the economy itself will recreate the same build order and assign it to the same builder repeatedly. When I improve the expansion to consider the threat at a given resource, this will likely solve itself.
Societal wrote: * Aircraft carriers end up with too high of a priority and stockpile quite a lot of missiles even when no nukes have been used. I don't know if there is any check at the moment for a unit being destroyed by a nuke launcher. I believe some sort of ramping formula for anti-nuke priority would make more sense. I've seen a lot of RAI navies and ports destroyed when they had built 5 carriers each trying to stockpile 10 missiles... but had only built one or two battleships.
.. sometimes units like this are built simply for the sake of energy production, other times as air-pads,.. and also as anti-nukes... I'd have to look at the log file to know for sure which lists it was assigned to. Normally there would only be 1 or 2 anti-nukes, but you're right I should probably have it consider the total anti-nukes built & being built.
Post Reply

Return to “AI”