Recommended Posts

Hello everyone,
I am making a client server game with DXPlay and have come accross a few issues which somebody may be able to help me with.
1)
When sending a message, is it possible to send it masquerading as another player?. eg When the host gets a player update it needs to send that update to everyone in the relevant area but it needs to send the update as if it were the player (so each receiver can use the FromId to update the correct player).
I played around with the TCustomDXPlay.SendMessage procedure inside dxplay.pas and replaced:
FDPlay.Send(FLocalPlayer.ID, ToID, DPSEND_GUARANTEED, Data^, DataSize);
with:...
FDPlay.Send(FromID, ToID, DPSEND_GUARANTEED, Data^, DataSize);
This seems to work as the host sends the packet to everyone as if it were the player, but when the packet is received from the other players it has a FromID of the host that sent it, not the FromID that the host was supposed to be masquerading as.
Anyone have an idea as to how I can send these masquerading packets?
2)
Is there any way to dynamically create DXPlay player groups, or are there any examples anyone has on this?
As the host is about to send out an update it needs to create a group of players that the update is relevant to, Then send the single update to the full group. This saves the host having to send out singular packets to every player. Atleast I presume this is the correct medium to use groups in DirectPlay?
3)
Considering that the players themselves are going to be hosting the final game. Would I be better off writing it as peer to peer rather than client / server?. Will client/server, although more diffacult, allow us to have more players per game than a peer to peer system?
I would imagine that as long as the host has decent bandwidth the client / server would be much better?
Thanks for your time, I have a few more questions but perhaps I should leave them for later
-Sav

Share this post

Link to post

Share on other sites

The 3 problems u asked, are the same I experience during coding on my game one year before.

1st question.I agree with turbo, u should define your own protocol. Just add the FromID into a message structure just like Urth said.

2nd questionAcutally, DelphiX don''t expect u to use group in DirectPlay. So u need to write your own, or modify Hori''s source code. If u know how, I would like to know.

3rd questionActually, DelphiX is default peer to peer. So in order to use as client server. Again, modify source code. However, after my research, the best approach is to use hybrid method. use peer to peer as default as DelphiX, but actually in coding, u are routing all message to server first, then direct to client. So, in this case, u can control grouping in server by looking on the message to see which client need this message, and send it to those client only. Since u''re peer to peer in default, DelphiX still proprogate those "add user" event "delete user" event and playerList by default, so u don''t need to manage by yourself.

I hope this can help u, but anyway, if u got any good idea, feel free to send me a message.

(* Since I coding in this style about one and a half year already, but I still suffer from some sychronise problem. So this may not be a good solution, but I think u''re worth to have a try.)