DirectPlay related problem

Started by
5 comments, last by Tarique 24 years, 2 months ago
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
Advertisement
Could you clear the topic up a little for a stupid swede like me?

Also, what do yo mean by "labeling" your PC''s? All identification of computers in a DirectPlay session is their DPID (or their DirectPlayAdress).

Daniel Netz, Sentinel Design
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown

Sorry! When I say labelling, I mean what I refer to them in my message above. I''ve just called them that to explain the problem. It''s nothing to do with the programming side of things

What I was trying to say (badly!) was that it''s always the same PC that hogs the network and has nothing to do with it being the server or client.

Also, it is worth mentioning that both PC''s are the same spec (ie. Pentium II 400''s 256MB RAM, equivalent network cards, etc), so it''s not that one PC is faster and is tx more data per frame.

I hope this clears it up for you. It was late when I posted so it''s nothing to do with you being stupid. It''s merely me typing too fast without thinking

Cheers,
Tarique.
---------------------------------Tarique NaseemCTOVRX Technologies Ltd.http://www.vrxtechnologies.com
Ok, now I get it

First, is the application running in a server/client mode?
Default is a peer-to-peer mode, which in most cases is the best way (especially in sessions with only two players).
Note: the session host is not the same thing as the server.

Are you sending some information instantly, like a keepalive signal? That may cause a backlog in the network (which can be solved by using message throttling though).

This is how my message loop looks like (I use VB):

==========================
Do Loop

Do While DPlay.MessageQueue() <> 0
GetMessage
ProccessMessageData
Loop

Sleep (whatever time)
Loop
==========================

I.e. I first check if the messagequeue is empty, if not, get the message and process the data. Then I let the mainloop sleep a little (it checks for new messages every 100 ms). Just be careful how fast you send the data from the other player.

Hope that helps,

Daniel Netz, Sentinel Design
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown
Depending on how many FPS you are getting, sending the data every other fram may be too much. You might try sending the data about 10 - 15 times per second.

Thanks for the info guys.

After reading other peoples posts and yours, I''ve realised I''m transmitting too much. ie. I transmit the player position and orientation every frame on both machines. It seems that the solution is (as you have also pointed out) to transmit every now and again.

In other words only transmit data say every 10 frames and only if the player has moved. I''ve tried a quick test with this and transmit every 10 frames and this solves the problem. However, the player movement on the other machine is jerky obviously. I suppose I now have to interpolate the players movements in between.

Does this sound like a good idea?
---------------------------------Tarique NaseemCTOVRX Technologies Ltd.http://www.vrxtechnologies.com
That''s the way to go, interpolation.

Good luck!

Daniel Netz, Sentinel Design
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown

This topic is closed to new replies.

Advertisement