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 / Multisync, 5 second delay?

Author
Message
Awesomest
15
Years of Service
User Offline
Joined: 13th Oct 2009
Location:
Posted: 30th Nov 2009 16:17
I'm trying to get my 3D MMORPG networking going, and the server up dates perfectly, recieving data as fast as it is sent, but the client gets the information being sent to it with around a 5 second delay. For example, when I send out the position of a character walking in a straight line to the client, it gets it 5 seconds after, and when you stop walking, it does not stop recieving values for an additional five seconds. I'm sort of new to C++ so any help would be great!

Here's the code, each is in the main loop of it's corresponding program:

Server


Client


Thanks in advance!

alalala
Snowyowl
14
Years of Service
User Offline
Joined: 30th Nov 2009
Location:
Posted: 30th Nov 2009 19:07
I'm not very clear on how such connections work in C++, but it sounds like it's just ping. If you're running the server and the client on different machines, there will be a noticeable delay while data is sent and received. I don't know why it's so long though; perhaps there's a problem with a connection between the two?

If you're running the server and the client on the same machine and you still get lag, then you'll need someone who knows more that I do :-| Try running your server and client on the same machine; connecting to IP address 127.0.0.1 loops back to the local network, so you can run both at once and connect them together. Do you still get the same delay?
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 30th Nov 2009 19:08 Edited at: 30th Nov 2009 19:10
instead of NetGetMessage() alone make it



and put only receiving code in it, you can put sending code out of it, remember that this is just what i think, im not good using multisync xD

Awesomest
15
Years of Service
User Offline
Joined: 13th Oct 2009
Location:
Posted: 1st Dec 2009 16:47
Thanks for the help guys,
I tried both and it's still the same problem.
The cliant still has the 5 seconds delay and the server still works fine, same speed running off one computer.

alalala
zydeoN
15
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 5th Dec 2009 15:12
Same problem here, did you solve it ?
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 5th Dec 2009 18:09
I have not done much net stuff but are you sending data every loop?

If so, you may be sending too much, creating a backlog of packets for the client to work through. I have read a few times on this forum that you should not send data every loop but maybe once every 20ms or so.
Awesomest
15
Years of Service
User Offline
Joined: 13th Oct 2009
Location:
Posted: 7th Dec 2009 14:42
Tried it, unfortunately no luck. Still the same issue.

alalala
zydeoN
15
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 7th Dec 2009 23:00 Edited at: 7th Dec 2009 23:02
Try this:
NetSetOption(2, 50);
"Sets the write buffer size in bytes. Must be used before NET HOST/NET CONNECT. The default value is 2048" (from manual)

It reduced the time delay to me
zydeoN
15
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 8th Dec 2009 14:55 Edited at: 8th Dec 2009 15:14
Solved! The method i mentioned earlier just reduced the time delay, but it still had some...
So i looked at some of Michael P code snippets and i figured it out that the solution for this is putting dbWait(1); at the end of the main loop

At least it worked to me
See if it works to you and let me know
Awesomest
15
Years of Service
User Offline
Joined: 13th Oct 2009
Location:
Posted: 9th Dec 2009 14:23
I tried both, and neither worked very well. I think adding the wait may have reduced the time, but the problem is still their and im not sure why.

alalala
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 16th Dec 2009 04:43
Some problems:

* You're flooding the network with too many messages.

* You're not reading through all messages in a single loop iteration (which means they may be building up and causing delays and freezing).

* You're reading data from messages that you aren't sure exist (check if NetGetMessage returns 1).

Sorry about the late reply, I've been really busy lately and I didn't notice this thread, or the message you posted on my thread.

Login to post a reply

Server time is: 2024-11-20 07:18:13
Your offset time is: 2024-11-20 07:18:13