Advertisement

Network Design.

Started by July 15, 2004 05:49 PM
0 comments, last by iliak 20 years, 7 months ago
Hi, I have try to add multiplayer for 4 player on an game that im working with... But I can't get it to work.. or recv all the info if you know what i meen. the send part I send all the data over an struct look like this.

struct pData_Send
{
	char message[128];

	int   id;
	
	float xPos;
	float zPos;
};

pData_Send pData; 

sendto(Client.ClientSocket, (char*)&pData, sizeof(pData_Send), 0, (SOCKADDR *)&from, sizeof(SOCKADDR));

and the recv part looks like this..

struct pData_Recv
{
	char message[128];

	int   id;
	
	float xPos;
	float zPos;
};

pData_Recv pData; 

recvfrom(Client.ClientSocket, (char*)&pData, sizeof(pData_Recv), 0, (SOCKADDR *)&from, sizeof(SOCKADDR));

is this an good way to do it? or can you guys come up with some ohter solution? feel free to come with examples on how you make multiplayer consepts and how do make it work with 5 players. thx.
-[ thx ]-
Think about network byte order !!!
- Iliak -
[ ArcEngine: An open source .Net gaming framework ]
[ Dungeon Eye: An open source remake of Eye of the Beholder II ]

This topic is closed to new replies.

Advertisement