Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Connection

Author
Message
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 1st Nov 2009 18:36 Edited at: 1st Nov 2009 18:59
Hello guys.

Sorry that i've been asking alot of questions lately..
anyway, i would like to know how do servers/clients works? how can a client connect to a server? is it through the internet or lan?

how do servers / clients works in general? is it like this?:



So, in the server, i have to host it, then work on messages, and in client, i need to connect to the server then send messages, how can i send a message? (in multisync ) i think i should use NetSend ( 1 ) or something, what does it do exactly? it sends a message to the server, how do the server know what kind of message is it?

Thanks for your time, and sorry if some questions makes no sense, i just have no clue about connection.

EDIT: would be thankful if someone mind giving me a working link for multisync and maybe some tutorials pages, i have 4 versions and im kinda confused..

SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 2nd Nov 2009 12:35 Edited at: 2nd Nov 2009 12:43
theres alot of ways, yes that is one of the ways, given that the library you are using supports sending different message types. Or you could send constant messages at a steady pace(maybe 150 -200 ms) sending messages only when needed iz the smoothest way but then you can only send object animations when the player moves or something of the sort. but in general , yes that is the way client/server works

Also i use RakNet which is a powerful Indy licensed library tht handles many more things than you will most likely find from TGC IMO.

but if you use Multisync you would need to write your message using NetPutX (where X is String,Byte,Float,etc..) then call NetSend(1) or NetSendAll() and on the server side, read the message in the order in which you wrote them.Then you want to relay the message to all the other clients.


when i used MultiSync i used strings and then at the client side, positioned the opponent player at the coordinates of the string(i used atof() for the conversion)

if(You.AddCode.toPost)TGC.Users.CanHelp = true;
else return NoCodeMessage;
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 2nd Nov 2009 14:57
Thanks for your reply, but an example would be useful, i still dont get it, how can i know what message im sending, and how can the server know what message it's receiving, NetPutString ( str ) then NetSend(1) will send str to the server? how can i get a handle for str from the server? i mean like:



SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 3rd Nov 2009 00:37 Edited at: 3rd Nov 2009 00:40
You can try something to this effect

Client Side(pseudo code)


ClientSide(pseudo code)


if(You.AddCode.toPost)TGC.Users.CanHelp = true;
else return NoCodeMessage;
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 3rd Nov 2009 13:09
what if the client sends two messages?

Drowneath
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location: In your eyes
Posted: 3rd Nov 2009 14:46 Edited at: 3rd Nov 2009 14:46
SFCBias:
Quote: "read the message in the order in which you wrote them.Then you want to relay the message to all the other clients."


That means:


if(asleep) sheep++;
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 3rd Nov 2009 15:15 Edited at: 3rd Nov 2009 15:19
oh, sorry i passed this sentence. thanks alot.

also, how do i create connection? like, how to host a server and how to connect from client to it?

also, which version of mutisync should i be using? 1.4.1?

thanks in advance

EDIT:

let's say im creating a game, which is a box moving on terrain.
on each client, i load terrain and a box ( which is the player ), each client send messages to server like : x y z angle, then server reads them and resend them to all clients, and on each client i make a new box on the received xyz ang data, so each player can see the other, right?

Drowneath
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location: In your eyes
Posted: 3rd Nov 2009 16:57 Edited at: 3rd Nov 2009 18:14
Quote: "
also, how do i create connection? like, how to host a server and how to connect from client to it?"


Read the documentation.

You can use these commands in DGDK by removing spaces and capitalize each first character in each word of each function name. (for example, NET GET MESSAGE -> NetGetMessage())

Quote: "let's say im creating a game, which is a box moving on terrain.
on each client, i load terrain and a box ( which is the player ), each client send messages to server like : x y z angle, then server reads them and resend them to all clients, and on each client i make a new box on the received xyz ang data, so each player can see the other, right?"


Yes.

if(asleep) sheep++;
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 3rd Nov 2009 17:17
Great, thanks.

SFCBias said that i should send messages like once every 150-200 ms, why shouldn't i send them instantly after the client does an action?

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 5th Nov 2009 17:25 Edited at: 5th Nov 2009 18:55
Guys, may someone give me a little example ( using a dos application, since it's simple ) for a server / client?,

and before i forget, a question came across my mind, what if 2 players (clients) send like 4 messages each, at the same time, and the server tried to read the messages, how can it know the order? since it's mixed when the 2 clients sent the messages at once? do the server read and send data to all clients at once? or it sends it to them one by one, each one with different data?
for example..there are 2 players on a server, the first one want's to receive the location and the angles of the second one, and the second one want's the first one's data, how can the server send each one different data? when i use NetSend(), it send data to all clients, right?


EDIT:


is that supposed to work? the client prints TIMED OUT error message

Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 5th Nov 2009 20:35 Edited at: 5th Nov 2009 20:45
You can't use multisync in DOS because it requires the windows message loop to run.

1) The packets are received in whatever order they arrive and from whoever. In order to know who sent the packet, use NetMessageFrom().

2) The server will only be able to send one packet at a time to one client at a time (unless you use NetSendAll(), but it only sends one identical packet)

3) If a client2 needs client1's data, you can make sure that you have the data first on the server and then send a message to all of the clients that client1 is ready. Once that is done (and assuming that client1's data will be continuously updated), you should have no problem with trying to get information from the server about client1. It wouldn't matter if client1's continuous update data reached the server before the request sent by client2, because client2 will receive the more updated data the next time and so on.

4a) When you use NetSend() on the server, you need to specify what client you are sending it to. (Use NetSendAll() to send it to everybody)

4b) When you use NetSend() on a client, it is sent to the server no matter what number you specify, but not 0. NetSend(0) erases the current packet.

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 6th Nov 2009 06:00
ok that's very helpful! thanks alot mate!

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 6th Nov 2009 07:03 Edited at: 6th Nov 2009 07:10
Hmm, a little problem with connection between server and client

which ip adress should i pass for the server and which one for the client? local ip or internet ip or 0.0.0.0?

P.S: i want it to be online, not on lan

SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 6th Nov 2009 18:00
If you want people to be able to connect onver the internet , you need to make sure you have forwarded ports(if your on a router) and pass in 0.0.0.0 to NetHost_IP . then on the client side pass in the internet IP of the host.

Or you could just use NetHost in which case you will want to conect using the domain name or the LAN ip

if(You.AddCode.toPost)TGC.Users.CanHelp = true;
else return NoCodeMessage;
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 6th Nov 2009 18:06 Edited at: 6th Nov 2009 18:08
may i know how to forward the prot(s)?
also, if i connect through the net, i can still run/play on the client on the same computer as the server right?

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 6th Nov 2009 19:30
sadly..i don't think i can forward the port..

how about hamachi? would it work with mutisync? i tested it with some other games servers ( a world of warcraft server ) and it worked by passing the hamachi ip to the client and the server.

im going to test it as soon as i find someone who can help me with it since i can't download it on other computer in my home.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 7th Nov 2009 08:14
Nice! it worked with hamachi!

just host a network on hamachi and use it's IP on both server and client

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 8th Nov 2009 13:59
Weird...i tried using any random simple client to connect to my server, and it worked fine, but when i tried to connect from this one:



it get's kicked after exactly 30 seconds, why's that?, problem is not with the IP, tested on the random clients with the same IP and it worked..

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 8th Nov 2009 14:36 Edited at: 8th Nov 2009 14:36
i added


in the loop and it worked fine, so the problem is caused when i stop sending messages, is there a way to turn that off? NetSetOption() i think?

SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 9th Nov 2009 17:35
yes , you want to change the timeout time.

if(You.AddCode.toPost)TGC.Users.CanHelp = true;
else return NoCodeMessage;
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 10th Nov 2009 13:01
Okay, thanks

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 13th Nov 2009 20:25
Damn..i installed windows 7 and im getting some problems connecting to my server, anyone have connected to his server on windows 7? i tried every possible IP on both client and server and i don't seem to be able to connect

Login to post a reply

Server time is: 2024-10-01 18:26:18
Your offset time is: 2024-10-01 18:26:18