Directplay problem.
Hi,
I''m programming an application in which 2 users share the same environment over a network / isdn link. I am using directplay for the communication.
As a first step I have got something working using IPX. One PC runs as the server and the other a client which joins it. I am trying to pass player position and orientation between the two machines.
PC 1 will tx player data to PC 2 and PC 2 will update according to the data received straight away. However, PC 2''s data does not seem to tx at the same time. It takes a while for PC 1 to pick this data up and move the ''remote'' player.
The reason I have labelled the 2 PC''s - PC 1 and PC 2, is that it doesn''t matter which one is the server and which one is the client. It''s always the same PC that exhibits the problem! (Sorry if all this confuses you!).
I''m using Dp->Send() and Dp->Receive() calls to tx and rx the data.
I thought it might be that one machine is hogging the network and not letting the other tx, so I tried to send the data every other frame to ease the congestion. This seems to help a little, but is not an ideal solution.
Is this the problem? Can you suggest of a ''neat'' way of doing things?
Sorry if all this is vague! If you need source code snippets, etc. Please let me know!
FYI, I am running it on a LAN between 2 PC''s. When it works, I would like to try it over an ISDN / modem link between the two.
Any help would be most appreciated!
Many thanks,
Tarique
---------------------------------Tarique NaseemCTOVRX Technologies Ltd.http://www.vrxtechnologies.com
This probably sounds pretty dumb, but is one computer significantly faster than the other? Because it might be flooding the other computer with too much data if it''s got a lot of spare processor time.
Try using the message throttling to see if there''s a huge queue of messages on the other machine.
Dr_S
Try using the message throttling to see if there''s a huge queue of messages on the other machine.
Dr_S
Dr_S
Hi there,
Both machines are PII 400''s (256MB RAM).
I think I understand what you mean by Message Throttling, but I''ll need to look it up!
![](smile.gif)
But I think you are right however. It does appear to be that one machine is not letting the other transmit.
FYI, They both tx the packet once per main loop. Is there any kind of handshaking I can do to get around this problem?
ie. do some kind of request and only sending the data once the other machie is ready? Any clues as to the best way to achieve this? Or am I on the wrong lines!?
![](smile.gif)
---------------------------------Tarique NaseemCTOVRX Technologies Ltd.http://www.vrxtechnologies.com
Hi,
I was reading an article the other day on networked games (lessee if I can find it for you) that suggested that throwing packets down the line every frame was likely to cause you problems, specifically in games over the internet.
perheps you should update less frequently, like once every 5-10 frames, unless some timing critical event happens.
Just a thought.![](smile.gif)
(ahh.. found it..) http://www.loonygames.com/content/2.10/feat/
--== Rapier ==--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Save the whales, feed the hungry, free the mallocs!
I was reading an article the other day on networked games (lessee if I can find it for you) that suggested that throwing packets down the line every frame was likely to cause you problems, specifically in games over the internet.
perheps you should update less frequently, like once every 5-10 frames, unless some timing critical event happens.
Just a thought.
![](smile.gif)
(ahh.. found it..) http://www.loonygames.com/content/2.10/feat/
--== Rapier ==--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Save the whales, feed the hungry, free the mallocs!
--== Rapier ==--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Save the whales, feed the hungry, free the mallocs!
It's even better to only send messages when data is changed on the client. I.e. monster1 moves, send a message about that.
Also, message throttling seems to be a good way of sending "just the right amount" of messages the line can handle, but unfortunately I dunno how to do message throttling (or if it's even default when using the DirectPlay Protocol) Anyone knows about this? Cuz the SDK says just about nothing about HOW to do it.
Put a counter that counts every message posted and every message recieved to get some statistics. There's also a Latency and bandwith parameter in some structure...dunno what name it is, just search for Latency in the DX7 SDK.
Daniel Netz, Sentinel Design
Edited by - Spiff on 2/10/00 6:01:38 AM
Also, message throttling seems to be a good way of sending "just the right amount" of messages the line can handle, but unfortunately I dunno how to do message throttling (or if it's even default when using the DirectPlay Protocol) Anyone knows about this? Cuz the SDK says just about nothing about HOW to do it.
Put a counter that counts every message posted and every message recieved to get some statistics. There's also a Latency and bandwith parameter in some structure...dunno what name it is, just search for Latency in the DX7 SDK.
Daniel Netz, Sentinel Design
Edited by - Spiff on 2/10/00 6:01:38 AM
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown
Many thanks for your help people!
It seems as if everyone is of the opinion not to transmit every frame, but only when you need to! Makes sense really...![](smile.gif)
I shall play around with that and see what I come up with. Initial tests, however, seem positive. I''m now tx''ing every 10 frames and this gets rid of the problem, although the remote players seem a little jerky. I will solve that by interpolating their movements inbetween. The only problem here is that the interoplated movement may not end up in the same position, as such when the next packet arrives, the player will snap to that position.
Anyone know of any good algos for this?
It seems as if everyone is of the opinion not to transmit every frame, but only when you need to! Makes sense really...
![](smile.gif)
I shall play around with that and see what I come up with. Initial tests, however, seem positive. I''m now tx''ing every 10 frames and this gets rid of the problem, although the remote players seem a little jerky. I will solve that by interpolating their movements inbetween. The only problem here is that the interoplated movement may not end up in the same position, as such when the next packet arrives, the player will snap to that position.
Anyone know of any good algos for this?
---------------------------------Tarique NaseemCTOVRX Technologies Ltd.http://www.vrxtechnologies.com
February 13, 2000 10:51 PM
is it possible to only update only when the position is changed?
if one player is per chance running at a slower framerate (for whatever reason, like bg apps) wouldn''t that give the other person an advantage?
I had similar problems with the DirectPlay code for my game star miner (http://www.positech.co.uk/). I think it was a matter of synching movement in the game to real time not frames. In other words, the amount an object moved was not x pixels per frame, but x pixels per millisecond, with the amount moved being multiplied by the ms since the last frame. With this system in place your two machines are much more likely to agree with each other when using interpolated data (i presume this means dead-reckoning?). Otherwise a faster machine (for whatever reason) will always be placing its ships further haead until it snaps back with the SYNCH message.
hope this helped :-)
http://www.positech.co.uk
hope this helped :-)
http://www.positech.co.uk
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement