G'day, I started to work on a remake of Pong with network play, but the client doesn't seem to receive the net messages i send.
I'm using the DarkGDK network commands and no plugins.
The following code is the function i call from the host app to send the balls location. (I decided for this little experiment to have the Host do most of the work and send the client the updated variables).
// Host Function to send Balls new Position to clients.
void HostSendBallPositionPacket() {
// Make Memblock
dbMakeMemblock( 1, 12);
// Write Position info to Memblock
dbWriteMemblockDword(1, 0, 1);
dbWriteMemblockFloat(1, 4, fBallPosX);
dbWriteMemblockFloat(1, 8, fBallPosY);
// Send the packet
dbSendNetMessageMemblock(0, 1);
// Delete memblock
dbDeleteMemblock(1);
return;
}
And the following code is the function the client uses to process the messages and update its variables.
// This function wraps the proccessing of all net Messages.
void ProcessNetMessages() {
// Exit if no net messages exist
if(dbNetMessageExists() == 0) return;
dbGetNetMessage();
dbMakeMemblock(2, 12);
// While net messages are waiting process them.
while( dbNetMessageExists() == 1 ) {
// Get the message..
dbNetMessageMemblock(2);
// The first DWORD in the message is the command
DWORD CmdNumber = dbMemblockDword(2, 0);
// This was a ball location packet..
if( CmdNumber == 1 ) {
dbSync();
fBallPosX = dbMemblockFloat( 2, 4);
fBallPosY = dbMemblockFloat( 2, 8);
}
}
dbDeleteMemblock(2);
return;
}
I Realy would like to stick with the DarkGDK networking commands with this project (as its my first Game with network play). any adivice would be realy appreciated.
P.S Thanks for taking the time to read my woes...lol
Only those who have been through Hell can see Heaven.