Game Development Community

TorqueX multi-Threads?

by James Ford · in Torque X 2D · 07/11/2007 (9:55 am) · 7 replies

I'm looking into using multiple threads in torquex, is there something for this is the GarageGames namespace or should I just look in XNA? This is not an animation thread.

#1
07/11/2007 (4:23 pm)
From what I've read so far XNA doesnt have anything special for handling threads so you should use the basic .NET thread functionality. Is this the case?
#2
07/11/2007 (6:59 pm)
I use fairly massive parralelization (7 primary threads) in my project, and I will tell you that TX does not play well "out of the box" with multithreading.

That's not saying you cant do it, on contrary it is not that difficult.... IF you are already skilled in multithreading techniques.

if you are not a multithreading guru, either find someone who is, spend a month ramping up on it, or just forget about it and write your game single threaded.
#3
07/11/2007 (11:24 pm)
As Jason said, you can definitely do it but multithreading in itself is a challenge :)

As warning example, when first implementing a networking thread I just handled the updates as they came from the network thread. This worked fine 99% of the time, but every once and a while updates probably happened mid-tick or something, which sent the objects flying to the walls.

The way I fixed it was to just send outgoing & store incoming updates in the networking thread. Incoming updates are handled and applied as the first thing of the tick (ProcessTick-callback with 0-priority) FROM THE TORQUE-THREAD. This is pretty much the simplest approach to have input/output-queues for the threads, and just manipulate objects from the owner thread. For example C# forms only allow updates from the owner thread.

You should also lookup on general C# multithreading topics, loads of material out there.
#4
07/12/2007 (10:17 am)
Thanks for the info guys!

Matias are you working on a PC only project or XBOX as well? How are you doing networking with TorqueX since neithor it nor XNA express have networking yet that I know of?
#5
07/12/2007 (1:38 pm)
Just the normal System.Net networking for Windows only. There's been a lot of gossiping in the forums about MS opening networking for XBOX or even adding some network gaming features to next XNA/GSE release.. But so far no official commitment, so time will tell :|
#6
07/12/2007 (6:26 pm)
Fyi, it was announced today that xna is going to get networking "very soon" (next release?)
#7
07/13/2007 (12:23 am)
You wouldn't happen to have a link to go with that announcement? ;) Not that I'm doubting, but I'd like to do reading-between-lines about if they'll introduce just System.Net for Xbox or also XNA network gaming features like connection state management or reliable/unreliable communication pipes...