Jump to content

  • Log In with Google      Sign In   
  • Create Account

DavidColson

Member Since 18 Nov 2013
Offline Last Active May 08 2014 05:40 AM

#5112665 Object interactions in a multithreaded game

Posted by DavidColson on 28 November 2013 - 02:01 AM

This is very interesting, I appreciate all this information. 

 

One thing I am taking out of this is that high level gameplay logic is not something that I really need to do multithreading on. I suppose were it would be most beneficial is when a certain function is called that carries out  a low level taxing process. This particular process can then be broken down into "tasks" which can be put in a queue for the thread pools to process. In my head I am imagining this to give me much more precise control over what processes are multithreaded and which not.

 

I also like this idea of removing interaction between objects until computation is complete and then sending queued messages to objects. I have learned much!




#5112561 Object interactions in a multithreaded game

Posted by DavidColson on 27 November 2013 - 03:16 PM

So I have been doing research into multithreading for no reason other than curiosity and I have noticed something which I'd like to bring up. 

 

The best way to multithread any software, apparently, is data-decomposition. As in instead of putting subsystems on different threads, you break up the processing of one subsystem into multiple jobs to do concurrently, scaling to n number of threads. 

 

This is all fine and dandy, but say if you were to do this to the physics system, my logic would be to break it up so for n threads divide the number of objects by n and give each thread a group of objects to update. Then you would have a situation were conflicts would occur. Say object A collides with object B, but A and B are being updated at the same time on separate threads. Problem.

 

Another example is for updating game logic on gameObjects. What if object A is dependant on the health of object B. But again, they are being updated on different threads.

 

Now I know the simple answer is, minimize interaction and communication between objects, however this is not always going to be good enough, especially in physics, since object interaction is critical to the function of the system.

 

I have not worked on a game were objects never have to talk to each other, so how do you get around this problem when designing a multithreaded game?




PARTNERS