Broadcasting Player Data
So, I've moved up a bit. I can have multiple players connect at once, and chat. Now I'm working on the movement system. My question, related to networking, is what is common practice in sending "Status" to a client about another player? I'd thought about doing XML into bytes, but it seemed bulky as hell. If you simply have a link that you think is helpful, and don't even wanna say anything, feel free to post that :P Thanks in advance!
The Forum FAQ has a section on "what to put into your packets."
Typically, you want to send the minimum possible for being able to display the other players. The player ID; An integer which indexes into a list of player meshes; a string for the name/label; the position, heading and velocity of the player; and what weapon he's carrying would be a good first start.
When your maps are reasonable-size and your art team is small, a single byte is enough for "mesh index" and "weapon index," and you may get away with quantizing to scaled shorts (2 bytes) for each coordinate (x,y and z) of position and velocity. A single byte is enough for heading, and unless you have more than 250 players, a single byte is enough for player ID.
Total: 16 bytes plus the length of the player name.
Once the player moves, you only send the player ID and position/velocity/heading; you don't need to send the additional information about what the player looks like unless that changes. This saves very little traffic in the current proposal, but once you have a richer player representation (various armor, shields, spell effects, whatnot) it starts adding up.
Typically, you want to send the minimum possible for being able to display the other players. The player ID; An integer which indexes into a list of player meshes; a string for the name/label; the position, heading and velocity of the player; and what weapon he's carrying would be a good first start.
When your maps are reasonable-size and your art team is small, a single byte is enough for "mesh index" and "weapon index," and you may get away with quantizing to scaled shorts (2 bytes) for each coordinate (x,y and z) of position and velocity. A single byte is enough for heading, and unless you have more than 250 players, a single byte is enough for player ID.
Total: 16 bytes plus the length of the player name.
Once the player moves, you only send the player ID and position/velocity/heading; you don't need to send the additional information about what the player looks like unless that changes. This saves very little traffic in the current proposal, but once you have a richer player representation (various armor, shields, spell effects, whatnot) it starts adding up.
enum Bool { True, False, FileNotFound };
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement