# Multiplayer Game Data Serialization Problems

I want to create a simple game that can be played with one to two player. I plan on using TCP sockets, Farseer Physics, XNA, a BinaryFormater and a Memorystream.

as far as i know i can't do the physics on both clients, or you'll end up with everything out of sync. So my Idea was to do the physics on the host side then send the Farseer World data to the other client, however it is un-serializable and I also realized this was a lot of data to send every tick.

I could just send the players movements back to the server and send a Texture2D to the client to be drawn, however a Texture2D is un-serializable as well. it has dawned on me i must be doing this completely wrong.

But this is how i am attempting to send the data:

[Serializable()]
class ServerData
{
public Texture2D Test;

public Vector2 Test2;
}

static void SendData()
{
byte[] DataBuffer = null;

MemoryStream stream = new MemoryStream();
BinaryFormatter formatter = new BinaryFormatter();
NetworkStream netStream = PlayerOneSocket.GetStream();

ServerData ServerDataToSend = new ServerData();

formatter.Serialize(stream, ServerDataToSend);
DataBuffer = stream.ToArray();
netStream.Write(DataBuffer, 0, DataBuffer.Length);
netStream.Flush();
}


what am i doing wrong or how do i do it right.

I've done basic server stuff before with custom classes and serialization, I'm just at a loss on how to make a multiplayer game.

Thanks for the help