Idea for improving the AI(@Devs)

Post here if you want to help developing something for FAF.

Idea for improving the AI(@Devs)

Postby fredlllll » 16 May 2013, 23:25

Hi there.
the first thing i want to say about that: i dont know if its even possible in FAF.
so supreme commander always had problems when i comes to many units. many as in >2000
i bet everyone of you already noticed when you play with AI and use 1000 as unitlimit the seconds will pass like 5 seconds or more.
so as far as i know the AI is still using only one core(= thread). so i wondered how could you make an AI multithreaded?
first idea would be: much synchronizing. but this is hard, if not impossible and could be slower than one thread because of the synchronization. you would have to synchronize both, read and write on datastructures.
so i had the idea to make something like a "double state AI". you have 2 instances of the AI state (ressources, units...) and you read from the old state, and write into the other state. so you only have to synchronize the writes, and can completely forget about the reads. of course this needs some additional control structures, which i already have in my head.

so basically im asking if it would be possible to do this in FAF. if some people understand code better than text, i could make a little code sample in c/c++.
and if you say it would be only possible using python, you have to do it on your own XD. i recently had the "pleasure" to code in python and i miss my autocompletion and typed environment :D

so yeah let me know what you think about the idea, and if it would be possible
fredlllll
 
Posts: 6
Joined: 16 May 2013, 23:06
Has liked: 0 time
Been liked: 0 time
FAF User Name: fredlllll

Re: Idea for improving the AI(@Devs)

Postby fredlllll » 19 May 2013, 11:34

is this a no?
fredlllll
 
Posts: 6
Joined: 16 May 2013, 23:06
Has liked: 0 time
Been liked: 0 time
FAF User Name: fredlllll

Re: Idea for improving the AI(@Devs)

Postby Vicarian » 19 May 2013, 11:59

The AI isn't written in Python - it's done with Lua. I believe I remember duck_42 saying that Lua is incapable of supporting processing on multiple threads.
User avatar
Vicarian
Avatar-of-War
 
Posts: 112
Joined: 19 Apr 2012, 08:43
Has liked: 0 time
Been liked: 1 time
FAF User Name: Vicarian

Re: Idea for improving the AI(@Devs)

Postby eXcalibur » 19 May 2013, 15:07

the only problem i see with the AI is that it tends to mass units in its own base without sending them towards the enemy. this happens in an extreme form, when there are no map markers for the AI.

here is a fix for sorianAI for this problem:
read: http://forums.gaspowered.com/viewtopic.php?t=23929
download: http://members.iinet.net.au/~dionysus/misc/AIFix.zip

the ai cannot be converted to use multiple cores, since the whole game (and therefore the engine) only supports one core. i do not think (yet i do not know a lot about this subject) that it is possible to separate the simulation process of the game and the ai process in order to run them on separate cores. there where already people who tried it and failed:
read: http://forums.gaspowered.com/viewtopic.php?t=15556
download: http://healthandmana.googlecode.com/fil ... er1.03.zip
eXcalibur
Priest
 
Posts: 302
Joined: 28 Apr 2012, 14:18
Has liked: 52 times
Been liked: 3 times
FAF User Name: eXcalibur

Re: Idea for improving the AI(@Devs)

Postby fredlllll » 19 May 2013, 15:25

well if its in lua then there is no chance to do it. its time for us to make a supreme commander 2.5 :P
fredlllll
 
Posts: 6
Joined: 16 May 2013, 23:06
Has liked: 0 time
Been liked: 0 time
FAF User Name: fredlllll

Re: Idea for improving the AI(@Devs)

Postby RoLa » 02 Aug 2013, 11:08

eXcalibur wrote:the ai cannot be converted to use multiple cores, since the whole game (and therefore the engine) only supports one core. i do not think (yet i do not know a lot about this subject) that it is possible to separate the simulation process of the game and the ai process in order to run them on separate cores.

I doubt that! The only thing you need is an IPC mechanism with the builtin LUA of supcom. So if it's possible to write and read files or to use Sockets or to use WinAPI calls(shared mem), it is possible to use multiple processes! As i understand the engine is made of 500ms time slots. So basically you could use for each additional process, 2 files one for read and one for write, to exchange information. It would'nt matter which language is used to programm the ai. With tcp/sockets you could even process the different ais on different computers.

If it's possible to fork processes, just use one process per ai, like in the following examples:

Please take a look at the chess engines and the xboard protocol which is using pipes just as an example, seperating the AI's from the user interface.
http://www.gnu.org/software/xboard/engine-intf.html

An AI programming battle sim
http://realtimebattle.sourceforge.net/
User avatar
RoLa
Contributor
 
Posts: 313
Joined: 23 Apr 2013, 22:14
Has liked: 5 times
Been liked: 19 times
FAF User Name: RoLa

Re: Idea for improving the AI(@Devs)

Postby Ze_PilOt » 02 Aug 2013, 12:05

Well, find a way to do it with FA then :)
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Re: Idea for improving the AI(@Devs)

Postby johnie102 » 06 Aug 2013, 12:15

eXcalibur wrote:here is a fix for sorianAI for this problem:
read: http://forums.gaspowered.com/viewtopic.php?t=23929
download: http://members.iinet.net.au/~dionysus/misc/AIFix.zip


Is this implemented in FAF? If not, would it help?
johnie102
Avatar-of-War
 
Posts: 128
Joined: 27 Dec 2012, 22:26
Has liked: 0 time
Been liked: 2 times
FAF User Name: johnie102

Re: Idea for improving the AI(@Devs)

Postby Krapougnak » 24 Aug 2013, 11:53

Hi,
Sprouto on the GPGnet forums is working on an advanced AI for SCFA, his work seems to be in a very advanced state now, maybe you could ask him if it is transferable to faf.

http://forums.gaspowered.com/viewtopic.php?f=30&t=59085
User avatar
Krapougnak
Contributor
 
Posts: 340
Joined: 12 Jul 2012, 11:03
Has liked: 193 times
Been liked: 24 times
FAF User Name: Krapougnak


Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest