Hi,
Oolite does recognize the 4 cores from my processor, however, looking at the taskmanager, it always appears as if Oolite is only using a single core.
Could it be that the code itself cannot use multicore technology because it's single-threaded?
If so, does anyone know how to change this in Objective-C? I could very well imagine that collision testing could be a separate thread without any problems.
Screet
Multicore processors and Oolite
Moderators: winston, another_commander
-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am
Hmmm. Can you suggest parts of the code where I could have a look at in order to give threaded collision testing a try? I'd expect that this could help pretty much in situations with many objects...I could imagine that this might sometimes skip a possible collision because the objects did move, but then it also did appear to me, playing previous versions of Oolite, that on rare occasions a ship can move through objects if the ship is fast enough anyway.another_commander wrote:The extra cores are used for texture loading. I am not sure if they are also used for sound processing, will have to check the relevant code. But yeah, the bulk of the game is single threaded.
Screet
-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am
Have a look at OOTextureLoader.m, +(void)setUp method for an example of how threading is done. Another part where threads are detached is in OOLogOutputHandler.m, -(BOOL)startLogging method. These should give you an idea of how it works. But changing the collision code to make it multithreaded is a seriously challenging task. If you are not sure how exactly it must be done, be prepared for some painful debugging sessions (actually, be prepared for painful debugging sessions anyway ).
Having said that, if you get it to work and it is tested enough, I would be more than happy to include a patch in the trunk.
Having said that, if you get it to work and it is tested enough, I would be more than happy to include a patch in the trunk.