Advertisement

My network approch...Good or Bad ?

Started by March 27, 2006 02:18 PM
2 comments, last by GameDev.net 18 years, 10 months ago
Hi all... I just read the complete Beej's guide to network programming and now I think a lot about how I will make my game network. First of all, my game is a FPS, where you are a simple sphere rolling around shooting at each other. That's why I think UDP could be a good choice since it's really fast, and the game is fast paced. I am ready to make myself a queue system where you have High priority packets Low priority Packets Acknowledge Needing Packets ForcedRouting packet etc The thing is, recv() and send() will always tell how many bytes where sent or received and so on... That bring me to think that a good approche would be to convert into char[] all data that has to be sent, so that if I send 512 bytes, and 510 is returned, ill be able to tell my program : ok this packet needs to resend the last 2 bytes, since they already are in an array. One question comes to mind, if 510 is returned like in my exemple above, can I be sure that it's the 510 first bytes ? Another question is : Would it kill my process time to always convert my float to char[] to send them ? Thanks for any help, by the way i never did network programming, i'm just curious.
Based on my understanding of UDP and winsock, sendto() reads the data buffer from first element to last element not exceeding buffer size. Unreliability is reflected on the order of the message buffers.

Kuphryn

This topic is closed to new replies.

Advertisement