Cores in games

chucky9

Distinguished
Nov 3, 2013
534
0
19,010
10
So i am currently creating a game using c++ and a lil java script. is there any way to get the game to detect the hardware of the users and therefore customize how the game perform depending on your hardware. eg using all the hardware you have instead of half your system sitting idle
 

mbreslin1954

Distinguished
Nov 27, 2010
1,515
1
20,460
250
It's been many years since I wrote software, but I know a fair bit about operating systems and software development, so here is my take on it:

Basically what I think you do is to parallelize as much of your code as you can, utilizing threads which can run concurrently, then the operating system parcels out the threads to however many cores the user has in his system. That is one of the primary tasks of an operating system: CPU utilization, or time-slicing. So if you have spawned 10 threads that can run simultaneously and there are only four cores, the operating system will assign the threads to the different cores until it runs out of cores. If there are more threads than cores, then time-slicing will occur (again, under the direction of the operating system).

What happens when games can only take advantage of two cores is that they are designed that way. There is limited parallelism designed in to the game. It is not easy to break software up into tasks that can happen simultaneously, and software development is behind hardware in this area.
 

minerva330

Honorable
Dec 27, 2013
449
0
10,960
58
Sounds like you are referring to Nvida's Geforecec Experience (https://developer.nvidia.com/geforce-experience)

It an app that is linked to the cloud. It detects your hardware and recommends optimal in-game settings to achieve the best visual quality for specific games
 

chucky9

Distinguished
Nov 3, 2013
534
0
19,010
10
yh but like some people have dual core, quad, six and now even 8 and i really really dont want to hard code my game to say quad or 6 core but im worried that if i put it to 8 cores then the game wont run smoothly on quad and 6 core cpu's
 

minerva330

Honorable
Dec 27, 2013
449
0
10,960
58
Also you should check out this thread...http://www.tomshardware.co.uk/forum/id-2001851/cores-effective-games.html

The discussion has been going for a while most games only utilize 2-4 cores. The rare exceptions like BF4 can use 6. I am not a programmer but I do not think that a java game could use 6 cores even if you wanted it to, or am I way off base?

And depending on the requirements of your game a good GPU is always more important than a CPU core count

Edit: Obviously disregard, I now realize he was referring to threading.
 

chucky9

Distinguished
Nov 3, 2013
534
0
19,010
10
well i currently head up about 20 friends who volunteer way to much of their life to making 2 games at once dont ask how we do it but some how it works anyway currently the games are more cpu intensive that gpu and run of a lot of ai and in game calculations so cores would help lol but i think ive worked it out only think i can do now is test it i suppose
 

minerva330

Honorable
Dec 27, 2013
449
0
10,960
58


I fully realize servers use more cores but regardless I read up.


EDIT: still miscommunication due to the authors first post. I was referring to cores in the physical sense. I know what multi-threading is and know that many apps use them
 

chucky9

Distinguished
Nov 3, 2013
534
0
19,010
10
Basically i wanted to know if there is a set few lines of coding that would allow the game to detect maybe the gpu and cpu and the change the way the games uses the hardware from some set defaults made by me?
 

minerva330

Honorable
Dec 27, 2013
449
0
10,960
58
Like I said in my first post, Geforce experience is vaguely the only thing that is similar to what you were originally asking about (that I know of).

Regardless, good luck with your alpha.
 

mbreslin1954

Distinguished
Nov 27, 2010
1,515
1
20,460
250
It's been many years since I wrote software, but I know a fair bit about operating systems and software development, so here is my take on it:

Basically what I think you do is to parallelize as much of your code as you can, utilizing threads which can run concurrently, then the operating system parcels out the threads to however many cores the user has in his system. That is one of the primary tasks of an operating system: CPU utilization, or time-slicing. So if you have spawned 10 threads that can run simultaneously and there are only four cores, the operating system will assign the threads to the different cores until it runs out of cores. If there are more threads than cores, then time-slicing will occur (again, under the direction of the operating system).

What happens when games can only take advantage of two cores is that they are designed that way. There is limited parallelism designed in to the game. It is not easy to break software up into tasks that can happen simultaneously, and software development is behind hardware in this area.
 

ASK THE COMMUNITY