I was doing some digging into the subject of multi-core support after realising how if I were to make large games or just games that have a lot of stuff going on at the screen at once everything would absolutely suck no matter how hard I tried to optimise things if it didn’t take full advantage of every single CPU core available. I’m noticing a trend I’m sure other people have noticed too, there are games being worked on now like Star Citizen and even Total War Warhammer that are getting ridiculously huge, not just in terms of scale but of course how much is happening within the game worlds that are being created.
As you will know though, optimisation is a huge problem, in fact, it’s become such a problem that creative assembly for whatever reason seemed to have decided to just throw their arms up in the air and go “Meh” and seem to have stopped bothering doing fixes for now.
Since it’s that much of a problem what exactly is stopping us from using more than four cores in games? I’m just generally interested in the subject. Not least of which because I would love to see how some games played if I could fully use my 8 core CPU but I just wonder if games are getting bigger and that’s becoming a problem why can’t we just throw more processing power at it?
Isn’t that pretty much what’s happened with gaming ever since the SNES? Or am I wrong about that?
Ohh I remember watching Brackey’s video about that, is this what Unity has been working on then with the new update? If so that’s great, thanks for the information.
Why can’t we use more than four cores if the machine has them? It doesn’t seem much different from using four… maybe I’m missing some context.
I make job queues and put as many threads as needed into it. If the machine has more, more can be available to take work in parallel. Nothing more to it.
Of course, multithreading itself can be complicated. But the complexity, at least in the ways I use multithreading, is the same whether I use two threads or 16.
The Unity Engine already does some things in a multi-threaded way. Other things (such as the API) are done in a single threaded way. I would like to see thread safe support for at least some of the API, such as Raycasts. The things like ECS, Jobs, and Burst Compiler are all helpful tech.
One thing I’m thinking about is in terms of turn based games where ECS would probably be very useful if you want to make use of tons of cores, long turn times? No problem, throw more processing power at it, I’m just wondering though if I’m being a noob and not understanding how it all works.
It would just make sense to me if you have a very CPU intensive game to make sure the game supports using more than 4 cores in this situation.
ECS is for having a lot more objects in your scene. For example, if you are building a RTS style game with thousands of units moving around in the scene, then you should consider using ECS.
What type of thinking are you doing in a turn based game that needs more CPU cores? If you are doing things that need to run for a while across multiple cores but those things do not need to access the API, then you can probably set up multi-threading in your game. The only thing that must be single threaded is accessing the API.
For example, if you are building a turn based game like chess, you can set up the AI that handles the computer’s moves in multiple threads, since that code would be thinking about the chess moves but it would not be accessing the API.
I was just thinking in general terms and examining other games like Total War Warhammer which has gotten severe problems when it comes to the campaign map and the overall turn times with it’s latest updates and Creative Assembly even admitted that much which is rare for them. That much CPU intensive stuff all going on at once is obviously going to be a strain on most computers but I was wondering how possible it would be to solve such a problem by assigning different jobs and so on to multiple AMD cores.
There will come a point when stuff like quad cores are just that powerful it won’t matter most likely, as Intel will inevitably want to compete like crazy with AMD but I’m thinking in terms of near future. As more DLCs and content keep getting added to single games as games developers get more and more ambitious with their projects it’s a simple fact that either the technology or the software is going to have to find a way to keep up.
[quote=“Lethn, post:13, topic: 707069, username:Lethn”]
There will come a point when stuff like quad cores are just that powerful
[/quote]Actually, there probably won’t. We’re no longer operating under Moore’s Law; clock speeds of cores are not really getting any faster. You’ll no doubt see some incremental improvements, but they’re getting less and less, and chip manufacturers are turning to other things - power consumption and core count being the top two.
Depends what the game is doing I guess… if it’s more graphical than cpu intensive the extra cpu cores aren’t going to be of much use. You would have to be doing a lot of scripting, animation, offline processing or mega amounts of calculations like that in order to totally max out the cpu cores.
Yeah, Async Raycasts looks really cool. I have a project in Unity 2018.1 that I am planning to test Async Raycasts. In theory, it should be a good use case for the tech, but I will need to do testing to see how well it works. I have thousands of laser projectiles managed through GPU Instancing pools and each projectile does a short Raycast test once per frame. I should be able to refactor the series of individual Raycast calls into a single Raycast job, and it should theoretically scale well across CPU cores.
Well, it is really difficult for 3rd party people to armchair optimize somebody else’s game. I don’t know what the devs for Total War Warhammer have tried or not tried, so I can’t even guess if their problems are related to taking advantage of CPU cores. There are tons of potential optimizations that they may have tried or not tried.
As for AMD vs Intel, both companies have excellent multi-core CPU solutions. The readily available Intel i7-8700k is a beast that usually outperforms AMD’s current offerings in most games. The i7-8700k has 6 cores compared to AMD’s Ryzen 7 with 8 cores.
Am I missing something, why can’t a programmer use System.Threading? If there is something wrong with doing this, please enlighten me because I have several worker threads in my own code and I need to know if I have to take them out. I don’t see any issues so far, I don’t talk directly to any Unity constructs and have proper mutexes.
You can, but you need to sync everything on the render thread before you can manipulate transforms. So its really limited what you can do on your custom threads