Multiplayer [DELPHI]

Any other programming language that is not covered in the Web Scripting category.

Multiplayer [DELPHI]

Postby wilk on Wed Feb 08, 2006 7:21 am

Hello
I have a little problem with writing network connection in game.
I just want to do sth like this :
Client send name,health,x,y
Server recv this and send to other clients
Now i have problem because i can send some informations to the server. Server send this informations to clients and clients dont know how to read this informations and attribute this informations for variables Player.name etc.

I have sth like this :
Record:
Code: Select all
TPlayerr=record
health : string[5];
name  : string[20];
x    : string[5];
y    : string[5];
end;


Client Send informations to the server:
Code: Select all
Player.health:='100';
Player1.name:='PlayerName';
Player1.x:='10';
Player1..y:='15';
ClientSocket1.Socket.Sendtext(Player1.name+#13#10+Player1.health+#13#10+Player1.x+#13#10+Player1.y+#13#10);


Now how client must recived this informations from server and get variabels name,health,x,y. Some one know how to do this ? Confused
--------------------
wilk
Newbie
Newbie
 
Posts: 3
Joined: Wed Feb 08, 2006 6:56 am
Location: Poland

Postby binex on Thu Feb 09, 2006 7:52 pm

there is a event in TClientSocket called OnRead u use it:

var
f:string;
begin
f:=socket.readln; // or socket.receiveln i cant remember...
binex
Newbie
Newbie
 
Posts: 4
Joined: Thu Feb 09, 2006 7:25 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron