OTAI Thread - Page 3

OTAI Thread

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

Moderators: hoijui, Moderators

IMSabbel
Posts: 747
Joined: 30 Jul 2005, 13:29

Post by IMSabbel »

By the way, i wonder...
If otai uses threads... does it benefit from SMP? I.e. can the ai work swapped out to another cpu /core?
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

I have no idea. I just learned how to do stuff with _beginthread() a couple weeks ago and thought I'd try it. I don't even know what SMP is.
IMSabbel
Posts: 747
Joined: 30 Jul 2005, 13:29

Post by IMSabbel »

well, symetric multi processing, of course :D

I never went into the real of threadsafe programming myself, but it would be worthwhile to check out, as it would really be cool to offload ALL ai load on the second core that way.

As dual core gets more and more common, that way you can have the whole cpu for the physics&gamelogic, plus can spend the whole cpu time of the other one for ai calculations/stuff.


Edit: just checked the new build:
i tested it on speedmetal and wideopencombat (yeah, i know, maps suck, but that doesnt matter).

It didnt crash on startup, but on speedmetal it crashed reproducably after about 2 minutes, and on wideopencombat after 5-10 minutes.

The crash is unusuall in the way the game contiunes for a minute or so while the "do you want to send crash information" window pops up until there is some kind of timeout, so i think its a protection fault in the ai dll.

Did you make sure that everything is thread-save? i.e. nothing can be catched in an non-well defined state during a synchronisation event?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

veylon, can you post the links to where you learnt about threads? and IMSabbel, you seem to know stuff, are there any godo places I can learn about it?
IMSabbel
Posts: 747
Joined: 30 Jul 2005, 13:29

Post by IMSabbel »

Well, im out of programming since around 2001, so my knowledge has become a bit rusty...
I would suggest browsing the msdn page about multithreading:

http://msdn2.microsoft.com/en-us/librar ... S.80).aspx

This should at least be a general introduction. The subject is vast and complicated, though.
Chocapic
Posts: 556
Joined: 16 Oct 2005, 03:35

Post by Chocapic »

beware that multi threading adds a ton of issues while accessing shared data, wich without the specific care leads to inconsistent data.
oh btw the libs the use in multithreaded projects are also multi threaded libs wich are diferent from the ones used regularly
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

Here's the page for the threading stuff I've been using:
http://msdn.microsoft.com/library/defau ... readex.asp
mynthon
Posts: 23
Joined: 12 Feb 2006, 19:23

Post by mynthon »

I dont know why but sometimes, after big battle (when AI loses a lof of units) computer sends commander to "my base".
Chocapic
Posts: 556
Joined: 16 Oct 2005, 03:35

Post by Chocapic »

mynthon wrote:I dont know why but sometimes, after big battle (when AI loses a lof of units) computer sends commander to "my base".
LOL, payback time!! :-)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

mwha, XE 2 spawns a new thread when it tries to create then display the threatmatrix, onyl the game still pauses when system("threat.tga"); is called
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

@ mynthon

I don't know for sure why this would happen, but I suspect that OTAI wants your metal patch.
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

New version: 1.09

I've added a new section in mods.cfg so that it can start out with a build list. It's pretty primitive, but it does keep OTAI from stalling out on certain mods (Nanoblobs, Gundam, helps with AA).

I also fixed a potential Multithreading bug by having the BuildingOrganizer mark that a search structure was done after the coordinates had been written, rather than before.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Any download links?

And are these primitive buildlists in the same form as NTAI XE as in list of commar seperated unit names? If so do NTAI buildtrees work in OTAI?
User avatar
FizWizz
Posts: 1998
Joined: 17 Aug 2005, 11:42

Post by FizWizz »

It's on FileUniverse, of course: http://www.fileuniverse.com/?p=listing&ID=104
User avatar
QMan
Posts: 103
Joined: 17 Feb 2006, 01:10

Post by QMan »

One quick question which I didn't see here or in the readme. What is the difference between the regular and LL version?

-QMan
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

The LL version puts out the log files. The regular one does not. Otherwise, they are both the same.

It does say so in the readme file at the very top, but maybe I should make it more obvious.
User avatar
QMan
Posts: 103
Joined: 17 Feb 2006, 01:10

Post by QMan »

Doh, I figured everything above --Features-- was credits and contact info. :)

Also, any word on an OTAI for Spring 0.7?
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

Here's the word. OTAI does not yet work on 0.7. I will be putting out a version just as soon as:

a) I get spring working on my computer again.
b) I get all my includes to use the right files.
c) I either quit making my own UnitDefs or figure out that class-registering stuff that's been added in there.

As soon as these get done, I'll put out OTAI 1.10.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

no need, just do the following:

Take NTAI ro JCAI from the spring source

rip out all our code exept the main class and the itnerface

Shove all your code in there and add your files to the project

recompile

It should compile without needing all that nasty stuff you've ended up doing to get it to compile with unitdefs etc.

Also be aware that MS created their own version fo the STL rather than usign the standard version for soem reason which may be the route of all your problems especially when cosnidering you appear to be using codeblocks rather than VS .Net 2003
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

Ah, good idea. I should've thought of that. Thanks. I'll see if it works. What I do with the UnitDefs is kind of unorthodox, so it might not.

I did get that STL stuff working right, because I downloaded the 2003 thing from microsoft that I've been using as the compiler/source/libraries for Codeblocks.
Post Reply

Return to “AI”