Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Multiple threads  (Read 1680 times)
0 Members and 1 Guest are viewing this topic.
Offline Mac70
« Posted 2013-03-29 22:15:35 »

I wonder if multi-threaded game can be faster than single (or double) threaded game. What do you think, is using multiple threads for game logic good idea in projects in which the CPU performance is the most important?
Offline Opiop
« Reply #1 - Posted 2013-03-29 22:19:01 »

No. Flat out plain no. If you mean running every object in a game on a different thread, then no. But if you mean multi-core suppport, then yes. If you have too many threads running at one time, it may actually do more harm then good. It would be super hard to manage and just nasty to clean up. Using a couple threads for world generation and the such is a good idea, but beyond that, I wouldn't use any other threads.
Offline DziNeIT

Senior Newbie

Exp: 3 years

« Reply #2 - Posted 2013-03-29 22:19:51 »

It depends on how well you do it. It's can work to have a rendering thread, a logic thread, a resource loading thread, a world generation thread (if applicable), and even an input thread if you do it right, as well as threads for connections, etc. It all depends on how your game works and how well you know how to implement multithreading though.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online theagentd
« Reply #3 - Posted 2013-03-30 03:07:04 »

If you have a problem which can be easily threaded and said problem is also a bottleneck then it's a good idea. Threading game logic can be difficult since it might not be easily threaded since objects may depend on each other. A simple example of something slow, CPU-limited and threadable is bone interpolation for skeleton animation. Each skeleton only depends only on itself, so they can be interpolated in parallel for an almost linear increase in performance with the number of cores. It's also possible to do things like collision detection on multiple cores. I have a test program simulating 20 000 balls in 2D with collision detection running at 118 FPS on one thread vs 445 FPS on 8 threads (4 cores with hyperthreading). That's a scaling of 3.77x for 4 cores. I'd say it all depends on the cost-effect ratio of implementing it.

Pages: [1]
  ignore  |  Print  

hadezbladez (712 views)
2018-11-16 13:46:03

hadezbladez (352 views)
2018-11-16 13:41:33

hadezbladez (697 views)
2018-11-16 13:35:35

hadezbladez (175 views)
2018-11-16 13:32:03

EgonOlsen (2366 views)
2018-06-10 19:43:48

EgonOlsen (2478 views)
2018-06-10 19:43:44

EgonOlsen (1465 views)
2018-06-10 19:43:20

DesertCoockie (2131 views)
2018-05-13 18:23:11

nelsongames (1909 views)
2018-04-24 18:15:36

nelsongames (2576 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!