Multicore FA

Talk about general things concerning Forged Alliance Forever.

Moderators: FtXCommando, Ze Dogfather

Multicore FA

Postby SC-Account » 13 Mar 2013, 23:36

I wondered how difficult it would be to add multi core support to FA. Is it possible to get access to the core files? And how much of it is Lua code?
SC-Account
Evaluator
 
Posts: 541
Joined: 07 Feb 2013, 05:10
Location: Colonial district of Germany
Has liked: 48 times
Been liked: 77 times
FAF User Name: Tnuoccacs

Re: Multicore FA

Postby rootbeer23 » 14 Mar 2013, 00:07

you need the source code for the game to implement multithreading.
which you dont have.
then you need to implement a multithreaded design which produces exactly the same results on all clients.
which is very complicated.
it is already a hard problem to make it work with a single thread.
an educated guess is that it takes 1 person several months of work.
rootbeer23
Supreme Commander
 
Posts: 1001
Joined: 18 May 2012, 15:38
Has liked: 0 time
Been liked: 31 times
FAF User Name: root2342

Re: Multicore FA

Postby Kof » 14 Mar 2013, 03:37

Never going to happen IMO, multi-threaded programming is much more complex and difficult to implement. I'd estimate it would take man years to re-develop.
Kof
Avatar-of-War
 
Posts: 119
Joined: 09 Jan 2013, 18:17
Has liked: 9 times
Been liked: 3 times
FAF User Name: Kof

Re: Multicore FA

Postby rootbeer23 » 14 Mar 2013, 04:11

one way to do it is to draw an imaginary thick cross on the map (imagine the red cross flag), which gives you 4 white quadratic regions and everything that happens in one white square has no chance of being affected by anything in another white square (with some exceptions) during a single tick in the simulations.
what you do then is launch 4 threads, 1 per white square and simulate the 4 squares.
note that what is inside the 4 white squares can be affected by entities in the red cross... that is why the thread that
processes the red cross is inactive while the white squares are simulated and run afterwards.
the runtime of one round of simulation is then the time it takes to simulate 1 white square (4 will run in parallel and finish at approximately the same time) plus the time for the red cross.
but the execution order will be perfectly synchronized.
rootbeer23
Supreme Commander
 
Posts: 1001
Joined: 18 May 2012, 15:38
Has liked: 0 time
Been liked: 31 times
FAF User Name: root2342

Re: Multicore FA

Postby Benoker » 14 Mar 2013, 08:21

In this model an ASF blop fight can happen in one square, and all the multicore does not help because this one square is only handled by one core...

Personally I think it does not matter in which order the collisions between projectiles and units are calculated because total damage is a simple addition of all the single damages (a+b = b+a). Each core could randomly choose which projectiles/units to handle.

But if it would be so easy GPG would have implemented it ;-) There really is no point in trying to modify the application without even having access to the source code.
User avatar
Benoker
Contributor
 
Posts: 35
Joined: 12 Sep 2011, 11:08
Has liked: 9 times
Been liked: 1 time
FAF User Name: Benoker

Re: Multicore FA

Postby rootbeer23 » 14 Mar 2013, 12:03

Benoker wrote:In this model an ASF blop fight can happen in one square, and all the multicore does not help because this one square is only handled by one core...


nothing is perfect

Benoker wrote:Personally I think it does not matter in which order the collisions between projectiles and units are calculated because total damage is a simple addition of all the single damages (a+b = b+a). Each core could randomly choose which projectiles/units to handle.


computer1 simulates projectile P34324 hitting tank t232 and destroying it first and computer2 simulates tank232 shooting at tank545 and afterwards simulates projectile P34324 hitting t232.
rootbeer23
Supreme Commander
 
Posts: 1001
Joined: 18 May 2012, 15:38
Has liked: 0 time
Been liked: 31 times
FAF User Name: root2342

Re: Multicore FA

Postby Benoker » 14 Mar 2013, 12:27

Concurrency is nothing that can be solved in one day. But for example the very real issue you bring up might be sovled with "All computers first simulate tanks firing their shots, then all computer simulate tanks taking damage, then all computers calculate which tanks have taken too much damage and explode" -> meaning breaking down the algorithm in several steps, each of which can be solved concurrently - but it would not be possible to execute more than one (big) step at a time. Of course this solution might have some side effects causing trouble elsewhere...

... and just our friendly argument should prove to SC-Account that the answer to "how difficult would it be ..." is "very".
User avatar
Benoker
Contributor
 
Posts: 35
Joined: 12 Sep 2011, 11:08
Has liked: 9 times
Been liked: 1 time
FAF User Name: Benoker

Re: Multicore FA

Postby rootbeer23 » 14 Mar 2013, 13:12

Benoker wrote:All computers first simulate tanks firing their shots, then all computer simulate tanks taking damage, then all computers calculate which tanks have taken too much damage and explode


you would see a similar problem with just the movement of units which would not be solved by the solution above.
rootbeer23
Supreme Commander
 
Posts: 1001
Joined: 18 May 2012, 15:38
Has liked: 0 time
Been liked: 31 times
FAF User Name: root2342

Re: Multicore FA

Postby discoverer2k4 » 14 Mar 2013, 14:31

seperate air, land, engy-like and naval on 4 different threads ;)
somebody allready posted a link to the engine, I thought actually...?! But it would be illegal to change something in the engine without permission of the licence owner...
ranking :
~1500 global / ~1100 ladder
~1100 games / ~ 400 games
User avatar
discoverer2k4
Contributor
 
Posts: 174
Joined: 03 Jul 2012, 17:37
Has liked: 0 time
Been liked: 0 time
FAF User Name: discoverer2k4

Re: Multicore FA

Postby SC-Account » 14 Mar 2013, 15:20

Well, my point was more about getting the code etc. The multi threading itself should not be the problem. I am confident that there is always something you can put in another thread, even if it might not be perfect multi threading it will be better than the current.
SC-Account
Evaluator
 
Posts: 541
Joined: 07 Feb 2013, 05:10
Location: Colonial district of Germany
Has liked: 48 times
Been liked: 77 times
FAF User Name: Tnuoccacs

Next

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest