Hey, I've been trying to get into working on multiplayer darkGDK functions but they've been rather daunting, and just getting the program to stay running for 20 seconds without freezing is a nearly impossible task. Am I doing something horribly wrong here? I'm trying to just do the most basic of basic things, send a message and print that it was actually sent.
Also, the checkprint function just prints a file for debugging. I've confirmed it works.
//host program
#include "DarkGDK.h"
#include "ChecklistFunctions.h"
void GET_TEXT();
void SEND_TEXT(char* message);
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetNetConnection(3, "127.0.0.1");
dbCreateNetGame( "Chatserver", "Hostname", 8, 1 );
// our main loop
while ( LoopGDK ( ) )
{
GET_TEXT();
dbSync ( );
if (dbNetGameLost())
break;
}
return;
}
void SEND_TEXT(char* message)
{
//sending to player 0 sends to everyone but you. Very useful for hosts.
CheckPrint("Should be re-sending the net message to the client now", "4.txt");
dbSendNetMessageString( 0, message );
}
void GET_TEXT()
{
if ( dbNetMessageExists() == 1 )
{
CheckPrint("At the very least, there's a net message", "2.txt");
dbGetNetMessage();
if (dbNetMessageType() == 3) //confirm it's a string
{
CheckPrint("The net message is also a string", "3.txt");
SEND_TEXT(dbNetMessageString());
}
}
}
//client program
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetNetConnection(3, "127.0.0.1");
dbJoinNetGame(1, "Elspin");
dbSendNetMessageInteger( 0, 1 );
CheckPrint("Done sending", "1.txt");
while ( LoopGDK ( ) )
{
dbSync ( );
break;
}
return;
}
I realize I'm sending an integer when checking for a string, but the thing is that it's not even reading there being a message in the que, ever. And this is when I could get the programs to start up without crashing