XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Updating information of game object

Last post 6/25/2009 8:12 PM by haxpor. 1 replies.
  • 6/17/2009 5:44 PM

    Updating information of game object

    I have a question on how to efficiently code the network section.

    What I do right now is that, I have one server app, and one client app. I have the airplane entity (game object in 3d) in the client side. The updating process of position, rotation angle, etc will be sent from the server side to client side. So it means that the client app doesn't need to calculate anything about that information, instead it will receive the data sent from server side and calculate the world matrix and do the rendering part.

    From what I have tested so far,
    the approach I used is this, on the server side, I create 3 packets for airplane information and set all the information required for each packets.
    My packet format is as follow,

    Airplane Packet Format
    - ID (2 bytes)
    - Position X, Y, Z (4 bytes each, thus total is 12 bytes)
    - Rotation Angle X, Y, Z (4 bytes each, thus total is 12 bytes)

    Overall size of one packet is 26 bytes.

    I create a list to contain those packets. In my test scene, I have 3 airplanes, so I need 3 packets. Thus in the server side, I create 3 packets and add them into the list.
    Then when the server app starts to send the data into the network (using loop-forever with thread), I will modify the packet individually as need such as if I want to move airplane whose ID is 3 like a circle, so I will locate that particular packet and modify it as need in the loop.

    I also sleep for very short time, usually 16.67 miliseconds as corresponds to the XNA's Game app with fixed-time step.

    The result from my test: The information can be sent from server to client correctly, and I see those airplanes are in the correct and expected position. But when the time goes I receive this error (grab from the error message sent from the debugging mode for the Server App Project).

    A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself

    I should tell you that I test this thing within the same host but server and client are in the different port. I used UDP protocol.
    And also no matter or not I have set the time-sleep the error message still goes, but if I set not to sleep it's fast to get the message.

    Can anyone spot the problem?

    If I want to do the project that involve the network stuff, sending a lot of data between server and client. Which approach I might use? Or Any suggestion on this thing?

    Thanks in advance.
  • 6/25/2009 8:12 PM In reply to

    Re: Updating information of game object

    Okay everyone, I have solved the problem.

    The actual root of problem came from me, I have set the wrong size for sending out the buffer to network. So it surely goes beyond the limit of network.

    Sorry for that.
Page 1 of 1 (2 items) Previous Next