Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

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);

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

share|improve this question
up vote 3 down vote accepted

Send logical data, not presentation. Most games will never send graphics or textures to other systems during gameplay. Each system should already have all the resources it needs to render the events; you just send information about which events have taken place.

share|improve this answer
thanks, i actually just woke up about an hour ago thinking the same thing. But having clarification is really helpful :) – Dusty May 28 '12 at 11:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.