Jump to content
Sign in to follow this  
carlostex

Arma 3 && Multithreading!!

Recommended Posts

now You talk about dedicating core here and there for PhysX and AI, but You somehow forgot about thread syncing etc.

I'm one of those people :) but in truth I see HyperThreads and cores as synonymous. Probably not helpful from a programmer's point of view but I think the concepts are still valid in a broad way. I leave it up to coding monkeys to sort out the details ;)

But in any case: as far as syncing goes AI is CERTAINLY one excellent candidate for offloading on to dedicated cores/threads. No-one will notice if an AI decision id delayed by a frame or two and in fact a whole second or two is probably more realistic as far as reactions and decisions go for human players in any case.

Share this post


Link to post
Share on other sites

How about implementing something akin to an 'AI' arbiter thread that decides the result of all AI calculations done in separate threads (for instance on a gpu).

When I wanted to enjoy Arma 2 with a little more oommph I started one instance of the Arma 2 server executable on my 16 core (quad socket) machine and locked it to half the CPU cores, and then started the game client up on the other 8 cores.

Then I played a network game with myself or together with others with my server hosting the game....

The server executable decided who hit / didn't lived / died... not the client I guess ?? Thus I had some additional AI headroom since the client was doing it's own AI calculations for my squad...was my understanding.

In lack of better words -> Move all AI (physX) calculations to separate / unused cores either on a CPU or on a graphics card - I considered something similar for Arma 2 here : http://forums.bistudio.com/showthread.php?100519-exThreads&p=1653998&viewfull=1#post1653998

Share this post


Link to post
Share on other sites

While i too try to follow the "Impossible is nothing" mantra at every turn one still has to remain realistic...

  • Do the developers know enough multithreading code fu to make it work well?
  • Can the code be (re)designed to work well in a multithread environment?
  • What are the (un)expected side effects of converting something into multi threading?

From a completely uneducated standpoint... and lets face it, we are all uneducated when it comes to the code behind ARMA 3 except the developers that are writing the code... We can assume something is easy because we have done some multithreading code snippets ourselves and it was beautiful and very optimized.

But neither of us has made a fully featured title like ARMA or BF3 on our own. There is so much more to it than just sitting down one day and writing a small narrow demo on how good results you can get from a specific multithreading solution.

That said, if one particular task takes 90% of one core leaving other cores at 20% it would (at least in my humble opinion) be worth it trying to make the routine that uses 80% of one core spread out over all cores and prioritize the heavier calculations over the less heavy ones.

What i am getting at is, make the heavy operations overtake all cores and squeeze as many cycles as you can out of all cores and let all other routines suffer a little.

So now, the 20% routines wait for the HOG to finish and then do their work whenever the core is available again.

You guys are saying the AI routine is the culprit and it's sequential. Well, if that alone takes 80% of a single core then there must be a number of calculations in it that can be prepared in advance or reallocated onto other cores. It's all about making a "roadmap" on what's going to be needed.

So entity X needs to go from A to B through obstacles 1 to 4,000. You have 4 cores at your disposal. Divide the trip into 4 equal parts (straight line) with a rough estimation on the number of obstacles per section to circumvent.

Each part will have their own respective A to B start and end points and each section is allocated to one core each. The final route might not be the most optimal one to take but at least it doesn't bog the game down.

So now, a process that would use one core at 80% would use all cores at 20% and the remaining 80% of CPU time of each core can be spent dealing with the not so heavy routines.

But then again, as the rest of us, i don't really know what the real problem is because, just like the rest of us, i don't have the source code in front of me and thus have no idea what can and cannot be done under the limitations of what's already there.

If whatever suggestion someone comes with means re-doing too much code then the game will fail due to one of the following:

  • The developers simply don't know how to make it work, so they would need to spend tons of hours learning. Time lost that could be spent on actually making the game in the first place.
  • The time spent re-doing the whole thing means the game features suffer.
  • Time spent makes the game miss it's deadline which means the budget goes out the window and the game becomes vaporware and developers are out of a job.

So in conclusion...

Prior Planning Prevents Pi** Poor Performance

It's most likely too late now and the next release will suffer similar problems to those of ARMA 2.

For whatever next release in the future (no matter what game studio we are talking about) they need good developers that actually are capable of harnessing the full power of both CPU's and GPU's of the future. And of course, this should be taken into consideration from day one!

//Cadde (Known as PLRSniper from 14 years ago playing Delta Force 1 and OFP 1985)

Share this post


Link to post
Share on other sites

I hope ARMA3 will take better advantage of Bulldozer, like BF3 does.

Edited by zamani532

Share this post


Link to post
Share on other sites

The game has kind of had multi CPU AI since OFP. AI groups on server + player-led AI on each leader client. This is evident when AI under your command remains responsive for a while even after server crash or lost connection. There's no question it's possible.

Share this post


Link to post
Share on other sites

It's most likely too late now and the next release will suffer similar problems to those of ARMA 2.

that's pretty pessimistic. Arma 2 does multithreading fairly well, scaling well to 3 cores, and one of the things holding it back (dx9) has been eliminated. When arma 2 released there were already many quadcores and it was pretty obvious multicore cpu's were the future. I think arma 3 will perform well compared to 2.

Share this post


Link to post
Share on other sites
that's pretty pessimistic. Arma 2 does multithreading fairly well, scaling well to 3 cores, and one of the things holding it back (dx9) has been eliminated. When arma 2 released there were already many quadcores and it was pretty obvious multicore cpu's were the future. I think arma 3 will perform well compared to 2.

Well, it's not as simple as pressing a button you know. And based on the feedback from the dev(s) that have responded to this thread it makes me think they never really planned in multithreading beyond splitting each element (physics, AI, rendering, game logic) to a core each.

Proper multithreading would split the workload of each game component over multiple cores but requires the code to be designed to do just that from the bottom up.

It's too late for that now and i said similar, not the same.

Share this post


Link to post
Share on other sites

Anyone on here able to shed some light on how much of a performance improvement just moving from dx9 to dx10/11 can make?

Share this post


Link to post
Share on other sites
Well, it's not as simple as pressing a button you know. And based on the feedback from the dev(s) that have responded to this thread it makes me think they never really planned in multithreading beyond splitting each element (physics, AI, rendering, game logic) to a core each.

Proper multithreading would split the workload of each game component over multiple cores but requires the code to be designed to do just that from the bottom up.

It's too late for that now and i said similar, not the same.

Arma 2 is already beyond dedicating stuff to a core, there's even a blogpost about it. http://www.bistudio.com/english/company/developers-blog/91-real-virtuality-going-multicore

Share this post


Link to post
Share on other sites
Well, it's not as simple as pressing a button you know. And based on the feedback from the dev(s) that have responded to this thread it makes me think they never really planned in multithreading beyond splitting each element (physics, AI, rendering, game logic) to a core each.

Proper multithreading would split the workload of each game component over multiple cores but requires the code to be designed to do just that from the bottom up.

It's too late for that now and i said similar, not the same.

It has nothing to do with them not wanting to do it,

One word for you: Concurrency.

http://msdn.microsoft.com/en-us/magazine/cc163744.aspx

Go read about it and the pitfalls of multi-threaded apps. There are certain programs that can make use of multi-threading quite well but they tend to be programs where they are working on large amounts of data and that data is not needed by the other threads.

With games and a lot of other types of programs they have to put locks on certain data and memory, to make sure that one thread does not overwrite another threads work. Then you have to have some management overhead. All of that eats away at performance. And all of those other threads are waiting on the others for data. What is left is the type of multi-threading performance we have today.

Share this post


Link to post
Share on other sites

depending not always moving to dx10-11 equals more performance in some games cases depending on hwo they are written it can = less performance aka more features running

Share this post


Link to post
Share on other sites
Two very different game engines with very different coding approaches and challenges, so I think this may be a poor comparison. But yes, it's probably not impossible to make it more efficient, and I'm sure the programmers are doing their best to make it so, given the abundance of quad-core CPUs nowdays.

Additionally I think it would be a bad idea when comparing two engines to say one's more optimized than the other just because it uses 100% of all CPU cores (Note that I'm using a hypothetical example here, not BF3). Rather than this meaning that it threads well, it could also mean that its code is inefficient compared to the other, as it needs more CPU cycles to do the same job.

I think it's an entirely fair comparison. Arma 2 makes enormous demands on the cpu so it should be more optimised for multi-core not less so than BF3. Arma3 will no doubt be much more demanding still so suggestions that because it's a different game engine it should somehow be forgiven for the inevitably poor performance and cpu scaling it will exhibit seems very odd. It should be coded from the ground up to properly use 4-8 cores fully then BIS would actually make a lot more money because a far bigger audience could play it without it looking shabby or running like a dog on even high end cpu's which I fully expect.

Share this post


Link to post
Share on other sites
I think it's an entirely fair comparison.

BF3 has far smaller maps (many of them even have cloned trees made of a few planes as opposed to Arma 2, where every tree is a detailed 3D model and unique) and to the best of my knowledge its AI is very primitive compared to Arma 2 (it's not even available in multiplayer). If you run Arma 2 on a map the size of BF3's, get rid of AI, lower the view distance to match BF3, your framerate will jump pretty high. Apples and oranges.

Arma 2 makes enormous demands on the cpu so it should be more optimised for multi-core not less so than BF3. Arma3 will no doubt be much more demanding still so suggestions that because it's a different game engine it should somehow be forgiven for the inevitably poor performance and cpu scaling it will exhibit seems very odd. It should be coded from the ground up to properly use 4-8 cores fully then BIS would actually make a lot more money because a far bigger audience could play it without it looking shabby or running like a dog on even high end cpu's which I fully expect.

How did you come to the conclusion that Arma 2 is less optimised for multi-threading than BF3?

Edited by Dingo8

Share this post


Link to post
Share on other sites

Arma's main issue with multithreading is AI,it's what causes lag not graphics ... i hope BIS is working on that seriously !

Share this post


Link to post
Share on other sites

Would it be possible to run AI on multiple cores depending on the faction perhaps if the extra cores are available?

Share this post


Link to post
Share on other sites
Dan;2146528']Would it be possible to run AI on multiple cores depending on the faction perhaps if the extra cores are available?

It should be possible to have multiple AI worker threads, yes, though whether or not this brings an effective performance improvement really depends on the implementation.

Share this post


Link to post
Share on other sites
what about HyperThreading on I7 ?

:j:

What about it?

http://lmgtfy.com/?q=Hyper-threading

The performance improvement seen is very application-dependent, however when running two programs that require full attention of the processor it can actually seem like one or both of the programs slows down slightly when Hyper-Threading Technology is turned on.

http://forums.bistudio.com/showthread.php?129609-Arma-3-amp-amp-Multithreading!!&p=2141688&viewfull=1#post2141688

Share this post


Link to post
Share on other sites

Hypertheading only leads to gains if the rest of the cpu is working 100%. It's damn near impossible to balance the load of a game so well that will lead to real gains.

Battlefield 3 does a decent job at this but even there the gains of hyperthreading are minimal and lots of people report stutter when it's on.

Share this post


Link to post
Share on other sites
Hypertheading only leads to gains if the rest of the cpu is working 100%.

If the rest of CPU is used by other apps then maybe. But IMO BIS doesn't care about such scenarios. If your application creates many short-lived tasks than HT is good.

Share this post


Link to post
Share on other sites

HT would work only on Intel CPU's, they are reluctant to make such changes anyway, we'll see soon. E3 is 3 weeks away.

Share this post


Link to post
Share on other sites

Hyperthreading is a gimmick. A lot of people I know with HT processors end up turning it off because of stuttering/performance issues anyways.

Share this post


Link to post
Share on other sites
Hyperthreading is a gimmick. A lot of people I know with HT processors end up turning it off because of stuttering/performance issues anyways.

Hyper-threading does significantly help performance for some CPU intensive applications, so it's not just a "gimmick". It just seems to have some issues with some games. Good thing you can easily switch it off. I've been keeping it on lately and haven't had any noticeable performance issues.

Share this post


Link to post
Share on other sites
Hyper-threading does significantly help performance for some CPU intensive applications

Exact opposite is true. Define CPU instensive maybe?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×