About Store Forum Documentation Contact



Post Reply 
Threading
Author Message
Dynad Offline
Member

Post: #1
Threading
Hey,

I want to implement multi-player in the game with Raknet. Raknet works fine and all but now i am stuck with threading.

i looked over the threading tutorials but those are function based. that's np but i don't know how to thread the update/render function in my Game.

Now i have made 1 thread for Raknet but my process stays there because its in a loop till i end it ofc.

So my question is what's the best way to thread multi-player and the game update at the same time?


Thnx,
~Dynad

There is always evil somewhere, you just have to look for it properly.
02-04-2010 12:51 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Threading
maybe you can collect messages (network data) in secondary thread

but process them in the main thread

just an idea
02-04-2010 01:05 AM
Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #3
RE: Threading
RakNet is already multi-threaded.

Just call you're:
Code:
void Network::ReceiveMessages() {
    // Get a packet from either the server or the client
    for (p=client->Receive(); p; client->DeallocatePacket(p), p=client->Receive()) {

function in the Update of the game.
02-04-2010 01:30 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #4
RE: Threading
ah, that will work indeed. Thnx smile

There is always evil somewhere, you just have to look for it properly.
02-04-2010 03:13 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply