Game Development Community

Cluster: how to wait for a message

by Ichijoji · in Torque Game Engine · 06/28/2006 (4:38 pm) · 4 replies

I'm working on multiprocessing an existing game over several machines. The game uses TNL for networking and I understand how to send and recieve messages over the network. In order to run the program on a cluster, problems are sent to clients and solutions are sent back to the server. I can do all of this fine, but the problem comes when I want to put all of the calculated information back together at the server. I need to wait until all of the clients have sent their results back before the server proceeds through the frame. Is there some way to put TNL to sleep until it recieves a message? Or, alternatively, is there some way to go into an infinite loop and have TNL still check for incoming messages and fire off the correct callbacks?

#1
06/29/2006 (5:36 am)
This seems like a fairly simple logic problem. Have a number of outstanding problems, and when a problem comes in decrement the number. When it hits zero then start processing. You still have to keep TNL in the loop to receive the solutions, correct? Why do you need it to sleep?
#2
06/29/2006 (10:26 am)
Keeping TNL in the loop to receive the solutions is exactly the problem. If I do something like:
[spawn off all of the subprocesses]
while [they haven't all sent back their solutions]:
    pass
I get an infinite loop. It seems like there's some TNL::update() function or something that I should be calling to have TNL go out and check for incoming messages.
#3
06/29/2006 (2:01 pm)
mNetInterface->checkIncomingPackets();
        mNetInterface->processConnections();

other than those?
#4
06/29/2006 (2:31 pm)
Those do exactly what I was looking for. Now I can just sit and wait for a certain message as long as I want:
while not call('isconnected'):
                call('updatenetinterface')
            call('requestid')
            while not call('hasid'):
                call('updatenetinterface')
            self.clientId = call('getid')
Thanks.