NTai for Linux

NTai for Linux

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

Moderators: hoijui, Moderators

Post Reply
User avatar
koshi
Lobby Developer
Posts: 1059
Joined: 14 Aug 2007, 16:15

NTai for Linux

Post by koshi »

Hi.

I have compiled svn source (rev 4214) of NTAI for linux (x86). You can get it here: spring.unknown-files.net/file/3469/NTAI_-_linux_build/
It was compiled against the spring source from the 0.75b2 tag.

I had to change some lines to get it to compile (using g++ from within Netbeans 5.5.1). Here is my attempt at a diff of directory AI/Global/NTai/AI/NTai: http://www.graasmilk.net/spring/ntai_linux.txt

If that is not useful, the changes were:
- Core/include.h (line 273): #include "../Helpers/CWorkerthread.h" --> #include "../Helpers/CWorkerThread.h"
- Helpers/CWorkerThread.h (line 156): void ThreadPool::stop() --> void stop()
- Helpers/CWorkerThread.h (line 170): void ThreadPool::wait() --> void wait()
- Helpers/Terrain/CBuildingPlacer.cpp (line 471): FeatureDef* fd = G->cb->GetFeatureDef(f); --> const FeatureDef* fd = G->cb->GetFeatureDef(f);

Changes number 2 and 3 were done just to get it to compile. No idea if they break some functionality.
If it is helpful I could replicate the error messages i had gotten.

I haven't gotten around to actually play against it, but it starts up fine.

Any input is appreciated.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

fixed
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

If I try to compile it on MinGW (by removing NTai from the line in SConstruct that excludes it from compiling) I get a bunch of errors too, maybe you are interested in them:

Code: Select all

rts/Sim/Misc/DamageArray.h: In member function 'bool Global::LoadUnitData()':
rts/Sim/Misc/DamageArray.h:43: error: 'float* DamageArray::damages' is private
AI\Global\NTai\AI\NTai\Core\helper.cpp:1272: error: within this context
rts/Sim/Misc/DamageArray.h:43: error: 'float* DamageArray::damages' is private
AI\Global\NTai\AI\NTai\Core\helper.cpp:1274: error: within this context
AI\Global\NTai\AI\NTai\Agents\Unit.cpp:5: error: 'Task' has not been declared
[...]
AI\Global\NTai\AI\NTai\Agents\CBuilder.cpp:5: error: 'CBuilder' has not been declared
[...]
I have left out errors that seem to be caused by the first error in the file.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Code: Select all

            if(pud->weapons.empty() == false){
                for(vector<UnitDef::UnitDefWeapon>::const_iterator k = pud->weapons.begin();k != pud->weapons.end();++k){
                    //ef += k->def->
                    float av=0;
                    int numTypes;// = cb->getk->def->damages.numTypes;
                    cb->GetValue(AIVAL_NUMDAMAGETYPES, &numTypes);
                    for(int a=0;a<numTypes;++a){
                        if(a == 0){
                            av = k->def->damages.damages[0];
                        }else{
                            av = (av+k->def->damages.damages[a])/2;
                        }
                    }
                    ef += av;
                }
            }
How am I supposed to calculate average dps then if that field is now private in svn?

The latter errors are in files that shouldnt be compiled. My next commit shall remove them.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

There exists an operator[] overload to access them.

Code: Select all

DamageArray damageArray;
float sum = 0.0f;
for (...) {
  sum += damageArray[index];
}
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

If its in svn but not 0.75b2 then your somewhat stuck as upgrading my sources to svn would prevent me releasing anymore versions fo NTai till after the mid september release

edit:: nm I dont need svn for the overloaded operator
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

The operator overload exists for a long time already, definitely in 0.75b2.

I just made the member private a while ago.
User avatar
koshi
Lobby Developer
Posts: 1059
Joined: 14 Aug 2007, 16:15

Post by koshi »

Finally found the time to play test it both with XTA and NOTA config on Tabula. In neither case NTai builds anything.

from infolog.txt:
rts/System/Platform/Linux/SoLib.cpp:41: SoLib::FindAddress: /usr/share/games/spring/AI/Bot-libs/NTAI.so: undefined symbol: IsCInterface
/usr/share/games/spring/AI/Bot-libs/NTAI.so has C++ interface
AI has enabled cheating.
and the NTai-log

At first i've put the configs in my springdatadir (read-write, inside home folder). Failing that I copied it to the the read-only dir, yet no change.

The NTai commander/command tower will however attack any of my units that come into range.

Any ideas?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

well NTai obviously loaded, looked in the right palce for a config, then found nothing.

You dont stick configs in the spring folder or the home folder, you stick them in the /AI/NTai/ folder such that theres /AI/NTai/config.tdf and /AI/NTai/configs/config.tdf Those 2 files are NOT the same file.
User avatar
koshi
Lobby Developer
Posts: 1059
Joined: 14 Aug 2007, 16:15

Post by koshi »

NOTA config is working now. Apperently I (or the GUI I used) messed up the archive extraction by overwriting the AI/NTai/NOTA.tdf with the AI/NTai/configs/NOTA.tdf

Still nothing with XTA though. I have confirmed that AI/NTai/XTA_BT2.tdf points to an existing AI/NTai/config/XTA_BT2.tdf, tried XTA v8.1 (with both core and arm) instead of XTA v9, playing on different maps and tried deleting the learning file. Not everything at once of course.
Still there is the error message about the empty tasklist.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

It says that about the empty task list because its looking inside the Tdfparser storing the config which is of course empty.

If its not working for you on linux despite what I've said I suggest you find someone who does have it working under linux as I dont have linux and I wouldnt know what else to do.
Post Reply

Return to “AI”