Dplay problem :(
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)
Use SendEx with DPLAY_ASYNC and never use ALL_PLAYERS. Use a loop to go through all the players logged in and skip the one that exited.
Ben
[The Rabbit Hole | The Labyrinth | Programming | Gang Wars | The Wall]
Ben
[The Rabbit Hole | The Labyrinth | Programming | Gang Wars | The Wall]
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
I'll tryout KalvinB's suggestion.. thx!
Edited by - Herr_O on February 20, 2002 7:54:57 AM
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
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
I agree. DirectPlay works without any problems, and I prefer it anytime above the Winsock API
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!"
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!"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement