Archived

This topic is now archived and is closed to further replies.

stefu

DirectPlay - msg size & send-rate

Recommended Posts

I''m great 3D programmer but new in networking. Currently I''m coding (C++) a 3D net racing sim, using OpenGL and DirectPlay Peer/Peer system. I''m jus wondering at what rate is the best to send data to all other players (all players send own car position to all others) and what is max size for singe message. At the moment the message data consists of car matrix, tyres'' rot angle, front tyre''s steer angle (84 bytes). It''s now sent 50 times per second. What do you think about the size and rate? Of course I have to add some deltas to message data and interpolate position cause the message arrival is not so frequently. I think 50 fps is too much. Another problem. If I send my MSG_CARDATA - message and there is stil older message queuing, how can I remove it? Is it good to just set the timeout value to match the send-rate? Thanks a lot for answers!

Share this post


Link to post
Share on other sites
Hi Stefu,

1. 50 times per second is overkill. You should be able to get away with 10 times per second if you use proper interpolation.

2. You might try creating your own pre-queueing mechanism that allows you to remove messages. You would need to create it so that your queue only sends message to DirectPlay if DPlays buffers are not full. This would let you remove messages if they had not been sent yet.

Todd Barron
Author, Mutliplayer Game Programming
LostLogic
webmaster@lostlogic.com
www.lostlogic.com

Share this post


Link to post
Share on other sites
Thanks a lot!

Yes, the 50 times per sec really is too much. It worked when I opened two apps in single machine (TCP/IP), but now I tried over internet and it jammed my app after few seconds.

Pre-queuing sounds good, something I''v thought myself too.

Share this post


Link to post
Share on other sites
Try to avoid having your data send rate locked into your graphics frame rate. This would be bad since people with slower computers will not be-able to keep up with the faster computers.

Instead try to use a graphics independant frame rate.

Also, I have found that Directplay is happy to accept the messages as fast as you give them to it. Unfortunatly it will buffer them internally, either because it can''t get them out fast enough or because it is throttling back due to the client not being able to accept them fast enough.

Thus it is hard to tell how long your message will hang around in the internal DirectPlay buffer. So try to regulate the speed at which you supply them to Directplay. The intefaces provide methods for monitoring the internal buffers.

Directplay does provide a time out feature. Perhaps you could look at how many messages are timing out and use that as a means of regulating your throughput.



Share this post


Link to post
Share on other sites