Few Seconds ago i tested my game with my brothere it didnt work
mp is so complicated:S:S:S
Client
#include <DarkGDK.h>
#include "multisync.h"
void GetPlayerInfo(void);
void ControlCamera(void);
typedef struct tPlayer
{
int x;
int y;
int z;
void PositionCubeXYZ(void);
} tPlayer;
tPlayer Player[16];
void DarkGDK ( void )
{
dbSyncOn();
if (NetConnect("192.168.123.124"))
{
while (LoopGDK())
{
dbMakeObjectCube(42, 2);
while(NetGetMessage() == true)
{
GetPlayerInfo();
}
////////////
ControlCamera();
int X = dbCameraPositionX();
int Y = dbCameraPositionY();
int Z = dbCameraPositionZ();
NetSend(1);
dbSync();
}
}
}
void GetPlayerInfo(void)
{
int iLoop;
for ( iLoop = 0 ; iLoop < NetGetPlayerAmount() ; iLoop++ )
{
Player[iLoop].x = NetGetInt();
Player[iLoop].y = NetGetInt();
Player[iLoop].z = NetGetInt();
}
}
void PositionCubeXYZ(void)
{
int iLoop;
for ( iLoop = 0 ; iLoop < NetGetPlayerAmount() ; iLoop++ )
{
dbMakeObjectCube(1, 2);
dbPositionObject(1, Player[iLoop].x, Player[iLoop].y, Player[iLoop].z);
}
}
void ControlCamera(void)
{
if(dbKeyState(17)==1)
{
dbMoveCamera(0, 0.2);
}
if(dbKeyState(30)==1)
{
dbMoveCameraLeft(0, 0.2);
}
if(dbKeyState(31)==1)
{
dbMoveCamera(0, -0.2);
}
if(dbKeyState(32)==1)
{
dbMoveCameraRight(0, 0.2);
}
}
Server:
#include <DarkGDK.h>
#include "multisync.h"
void GetPlayerInfo(void);
int Counter;
typedef struct tPlayer
{
int x;
int y;
int z;
} tPlayer;
tPlayer Player[16];
void DarkGDK ( void )
{
dbSyncOn();
if (NetHost(16))
{
while (LoopGDK())
{
if (NetPlayerJoined() != 0)
{
Counter++;
}
if (Counter > 0)
{
while(NetGetMessage() == true)
{
GetPlayerInfo();
}
NetSendAll();
}
dbSync();
}
}
}
void GetPlayerInfo(void)
{
int iLoop;
for ( iLoop = 0 ; iLoop < NetGetPlayerAmount() ; iLoop++ )
{
int X = NetGetInt();
int Y = NetGetInt();
int Z = NetGetInt();
X = Player[iLoop].x;
Y = Player[iLoop].y;
Z = Player[iLoop].z;
}
}
THis is so wierd could somebody pleas explain how i could share ints.
And how do you now which player is who server is 1 writte'?
Game.Love