Dynad
Member
|
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 |
|
Esenthel
Administrator
|
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 |
|
Chris
Member
|
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 |
|