questions about socket/delphiX

If i have a chatroom and players join and leave which is all fine. However, im going to use delphiX to matchmake (directplay)  and collect ips and launch a game. Does everything ( private msg, all msg, player joins, player leaves ) have to go through directplay or can i just use directx (directplay) just for the matchmaking and not for the chat ?
966Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Emmanuel PASQUIERFreelance Project ManagerCommented:
It is definitely best if you use DirectPlay for every message
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
966Author Commented:
Thanks for the comment. Can i ask how is it better? But would it still work if i had my own chat program and then use directplay to collect info's to join game ?

Also can you answer these Questions i have about directy play.

When i use the delphix component and compile it , when i execute it directplay comes up with little boxes i have to tick and stuff. I dont want that to happen.
Is there any examples on how i can use directplay to collect Ip's and launch the game into a multiplayer screen ?

Also..

If i use my chat program as normal, then when the user enters the main chat there will be little chatrooms. When the user enters the chatroom (gameroom) then ill have to use direct play then for messages? or can i still use my chat program, and just only use direct play to actually "launch" the game by collecting Ip's and "nicknames"  in the chatroom.

If you can explain or provide detailed explaintion about delphi directplay for multiplayer matchmaking games, id be greatful.

Just that, if its best to use directplay for every single command " msg, priv msg, on join, on leave " ect.. i should maybe stop my programing of my chat and use direct play fore everything?

If this is the case, provide a working source code i can compile that has a chat client and a server that uses direct play to send and recieve messages with a nicklist to catch nicknames upon join ?

Thanks mate.
0
966Author Commented:
here is something that mauy help you figure out what im after. This is not my code, but i believe its similar and might help someone help me by compiling source.


unit Main; 

interface 

uses 
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
Dialogs, StdCtrls, SyncObjs; 

type 
TMainForm = class(TForm) 
HostButton: TButton; 
ExitButton: TButton; 
PlayerListBox: TListBox; 
procedure ExitButtonClick(Sender: TObject); 
procedure HostButtonClick(Sender: TObject); 
procedure FormCreate(Sender: TObject); 
procedure FormDestroy(Sender: TObject); 
private 
{ Private declarations } 
Critical:TCriticalSection; 
public 
{ Public declarations } 
end; 

var 
MainForm: TMainForm; 

implementation 

{$R *.dfm} 

uses 
DirectPlay8, ActiveX; 

const 
ServerGUID:TGUID='{EDE9493E-6AC8-4f15-8D01-8B163200B966}'; 
ServerPort:DWORD=2507; 
ServerName='Flash-Chat Server'; 

var 
DPServer:IDirectPlay8Server; 
DPAddress:IDirectPlay8Address; 
IsHosting:Boolean; 
AppDesc:DPN_APPLICATION_DESC; 

function DirectPlayMessageHandler(pvUserContext:Pointer;dwMessageId:DWORD;pMsgBuffer:Pointer):HRESULT; stdcall; 
var 
Info:Pointer; 
InfoSize,TempSize:DWord; 
r:hresult; 
begin 
Case dwMessageId of 
DPN_MSGID_CREATE_PLAYER: 
begin 
r:=DPServer.GetClientInfo(PDPNMSG_CREATE_PLAYER(pMsgBuffer)^.dpnidPlayer,nil,@TempSize,0); 
if r=DPNERR_BUFFERTOOSMALL then 
begin 
InfoSize:=TempSize; 
GetMem(Info,InfoSize); 
DPServer.GetClientInfo(PDPNMSG_CREATE_PLAYER(pMsgBuffer).dpnidPlayer,Info,@TempSize,0); 
MainForm.Critical.Enter; 
MainForm.PlayerListBox.AddItem(PDPN_PLAYER_INFO(Info).pwszName,Pointer(PDPNMSG_CREATE_PLAYER(pMsgBuffer).dpnidPlayer)); 
MainForm.Critical.Leave; 
FreeMem(Info,InfoSize); 
end; 
Result:=S_OK; 
end; 
end; 
end; 

procedure TMainForm.ExitButtonClick(Sender: TObject); 
begin 
Close; 
end; 

procedure TMainForm.HostButtonClick(Sender: TObject); 
begin 
if IsHosting then 
begin 
DPServer.Close(0); 
HostButton.Caption:='Host'; 
IsHosting:=False; 
end 
else 
begin 
DPServer.Initialize(nil,DirectPlayMessageHandler,0); 
DPServer.Host(AppDesc,@DPAddress,1,nil,nil,nil,0); 
HostButton.Caption:='Terminate'; 
IsHosting:=True; 
end; 
end; 

procedure TMainForm.FormCreate(Sender: TObject); 
begin 
Critical:=TCriticalSection.Create; 
CoInitializeEx(nil,COINIT_MULTITHREADED); 
FillChar(AppDesc,SizeOf(AppDesc),0); 
AppDesc.dwSize:=SizeOf(DPN_APPLICATION_DESC); 
AppDesc.dwFlags:=DPNSESSION_CLIENT_SERVER or DPNSESSION_NODPNSVR; 
AppDesc.guidApplication:=ServerGUID; 
AppDesc.pwszSessionName:=ServerName; 
IsHosting:=False; 
CoCreateInstance(CLSID_DirectPlay8Server,nil,CLSCTX_INPROC_SERVER,IID_IDirectPlay8Server,DPServer); 
CoCreateInstance(CLSID_DirectPlay8Address,nil,CLSCTX_ALL, IID_IDirectPlay8Address,DPAddress); 
DPAddress.SetSP(CLSID_DP8SP_TCPIP); 
DPAddress.AddComponent(DPNA_KEY_PORT,@ServerPort,SizeOf(ServerPort),DPNA_DATATYPE_DWORD); 
end; 

procedure TMainForm.FormDestroy(Sender: TObject); 
begin 
DPServer.Close(0); 
if DPAddress<>nil then DPAddress:=nil; 
if DPServer<>nil then DPServer:=nil; 
CoUninitialize; 
Critical.Free; 
end; 

end.

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.