Guys, I'm finally ready with the basic networking and clients can join freely to my server, and it's really cool, I tried with 3 clients simultaneously, and I still can't believe it's working. A few weeks ago I didn't know what IP, port and NAT mean, now I have my own server. :cool:
But the problem is that it starts lagging pretty hard. I checked the way I send the packets, everything seems fine, the only thing I send is 3D positions.
And I was wondering: can the reason be that I'm testing the networking on my own laptop?
The server receives gamestates from clients and then broadcasts all clients' positions every 75 milliseconds, this means that if I have 2 clients, the server sends only two glm::vec3 positions and it does it 13 times per second, and the clients just send "char" gamestates. Seems to me that the traffic is not so much. What do you think?
And when I go to cmd and ping 127.0.0.1, it says that ping is below 1ms, which is pretty cool, but then why is it lagging so hard?
I run the server and the client apps in small windows with 640x480 resolution and try to squeeze them so they can fit my 15.6 inch screen, which is not a problem at all, because I use RakNetGUID and it somehow knows what player is moved by what application although all the applications are run on one laptop and have the same IP.
Im sending stuff like this:
For clients: peer->Send( &bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, serverGUID, false );
For server: peer->Send( &bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true );
So nothing wrong with this part of the program.
If I decrease the update rate and change the sending time to 100 milliseconds, there is no lag at all, but the problem is that when I press "W", I need to wait a century until it moves forward. Is this my network limit, I really doubt it, I must be doing something wrong. :wacko:
NEED HELP :o