Archived

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

Dplay problem :(

This topic is 5766 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I''m doing a small game using dplay7. When a player gets lost for some reason, maybe a crach or a full hour lag, I destroy that player on the server and send a destroy player msg to the others in the session. But here comes the problem.. When I try to send a guaranteed message from the server to all other players using DPID_ALLPLAYERS after that a player has timedout I get a few seconds delay on the server.. I think it has something to do with that dplay tries to send a guaranteed message to the previously destroyed/timedout player that does no longer exist. If I loop through the players manualy instead of using DPID_ALLPLAYERS the delay disapears I''m using DestroyPlayer(player_id); when removing the timedout player. I get a DP_OK as a result although something is quite wrong. Anyone got a solution? /Herr.O (didn''t see this forum until now, sorry for 2X post)

Share this post


Link to post
Share on other sites
DPID_ALLPLAYERS starts to lag when I destory a player... so, it's not so good.

I'll tryout KalvinB's suggestion.. thx!

Edited by - Herr_O on February 20, 2002 7:54:57 AM

Share this post


Link to post
Share on other sites
DirectPlay works great. ALL_PLAYERS works fine as well if you have it set up properly. There''s just never a need for it. You should code your game so that there''s rarely if any need for every player to recieve a message. It''s better just to use a for loop so you''re in control.

The biggest problem was probably not using ASYNC. By not using ASYNC the program stops until a message has been sent and if it''s guarenteed it has to wait even longer to make sure the message made it to it''s destination.

Once again using a for loop with ASYNC allows

a) control
b) the server to keep moving while DPLAY handles the messages transparently in a seperate thread.

With Winsock you have to set up the multithreading. With DPlay, it''s already there.

Ben

Share this post


Link to post
Share on other sites
hehe.. I don''t agree, I think DPlay could do with alot of improvements. Hate having to wait 1h (exaggerated) just to create a server, leaving a game etc. But now that I''ve started using DPlay I might aswell complete it, though next time (if there is a next time) I won''t be using it.

I don''t like the DPSEND_GUARANTEED thing neither It may be easy to use, but I feel a lack of control. Another thing, I can''t get through my router with DPlay (it splits my IP).. why is this? I got no problem going through it with winsock.

I belive dp can be good as a start but to make large and complicated game - then I would prefer to do my own thing.

I can go on forever, but I won''t.

thx for the replies everyone!

-----------------------------
"If I''m not careful, I''ll end up talking to myself!"

Share this post


Link to post
Share on other sites
I used that before.. it sucked also =-) dplay is based on winsock anyway, so why use crap ontop of other crap

-----------------------------
Sometimes a Guru meditation must be followed by a Vulcan neck grip.

Share this post


Link to post
Share on other sites
quote:
Original post by ajoling
Yeah, but you''re using DP7, DP8 has been completely rewritten =-)



That''s a good reason for learning Winsock over DP and OpenGl over D3D.
Microsoft keep rewriting their API''s. It''s almost impossible to keep up. At least WinSock won''t change much in the near future because it''s purpose is to mimic Berkeley Sockets (but yes I do know that WinSock is Microsoft too).


Share this post


Link to post
Share on other sites
Why do dplay change often when it is based on winsock (which seldom changes as far as I know) ? Do it right the first time. :-) That''s what I would have done (*h0h0h0*).

-----------------------------
Sometimes a Guru meditation must be followed by a Vulcan neck grip.

Share this post


Link to post
Share on other sites
I''ve rewritten my game 2x..does that make me a bad programmer? No. I just learned new things and I thought it would be better if I applied it to other parts of the game as well.

Also, DirectPlay simply offers easy methods for sending:non-gaurenteed, nice events, grouping, etc.

I know this is can all be done with Winsock, but for me it would mean the Winsock API. And in VB thats still a bit a mess. Anyway, I think both have their own pro''s and cons... it''s just personal preference. Just with the discussions about Intel vs AMD, OpenGL vs DirectX, etc.

Share this post


Link to post
Share on other sites
There is nothing wrong with optimizing the code. Although for a big company like Miicrosft I would expect them to optimize it from the start.

But if the codes needs to be rewritten several times and changes have to be made to all the interface-functions, then it wasn''t designed right from the start.

SLOPPY !

Adding new functions and functionality is another matter.

Share this post


Link to post
Share on other sites
BTW. DP might do what it is supposed to do but if the interface changes each year you''ll be stuck porting you game for all eternaty...

So I''m not saying that DP is no good although it does look a bit too highlevel for my needs. I mean CreatePlayer() ???? What kind of a function is that. All you need is send and receive. It is easy to create a Create-Player-Message and functionality yourself. All DP should provide in my opinion is easy sending and receiving of messages and reliable UDP.

See ya....

Share this post


Link to post
Share on other sites
quote:
Original post by granat
BTW. DP might do what it is supposed to do but if the interface changes each year you''ll be stuck porting you game for all eternaty...

So I''m not saying that DP is no good although it does look a bit too highlevel for my needs. I mean CreatePlayer() ???? What kind of a function is that. All you need is send and receive. It is easy to create a Create-Player-Message and functionality yourself. All DP should provide in my opinion is easy sending and receiving of messages and reliable UDP.

See ya....



Backwards compatible? btw, Direct3D of DX3 didn''t had vertex shader''s too =-).

DP8 doesn''t have a createplayer() method. You just connect to a server. And then I have my own code that does all the authentication before the player is actually considered "in game"
I do not use the new player event''s...

Anyway, see my previous message =-)

Share this post


Link to post
Share on other sites
It shouldn''t take more than an afternoon to abstract the DPlay interface into your own class / interface, and it shouldn''t take more than a couple hours to migrate to a new version of DirectPlay. Granted, you might have to do a little reading to see exactly how some things have changed, but if DPlay 7 worked in a previous game, and DPlay 8 doesn''t add much functionality that you need, then why change?

Share this post


Link to post
Share on other sites
Okay this is getting way OT (but I''m trying to get it back on track), but here''s another viewpoint.

For those who just hate MS for whatever reason, and only stick to OGL, etc....just remember that it''s a razor thin line between stability and stagnant.

I''m no MS mark, but from a pov I can appreciate that they try to push the latest technologies with every rev. If that means rewriting the interface, then so be it. So it pisses off a few
of us developers. I for one am MUCH happier with the rewrite of DP8 over the klodgy DP7/4...MS realized it wasn''t working so they scrapped it...a gold star for them.

But my point only proves that you can argue for whatever side you want. I used to CONSTANTLY worry that I was using the "wrong" API, *just* because everybody was doing something different...(does this sound like "religion" to anyone else but me?? *grin*)

It took me a long time to realize that constant indecision can lead to projects never being completed..

If you want to use DP7, then use it. It sounds like you''re already at a decent point in the game to keep going with it. Don''t scrap half the design just because you want to switch to Winsock/DP8 (unless of course there''s *just* no other way)..

If you love Winsock, great!
If you love DP7, great!
If you love DP8, great!

Enough ranting, back to my project..

Share this post


Link to post
Share on other sites