toddw123 / RotMG_Clientless

Compatible with version X16.0.0
MIT License
11 stars 4 forks source link

Mulitple client issue #19

Closed toddw123 closed 7 years ago

toddw123 commented 7 years ago

Anyone want to take a look at the "test" branch i just pushed and see if they can figure out why the clients lose connection after like 20 seconds? I didnt want to push this to the master branch until its working correctly lol

I feel like it has something to do with the threads not working correctly, possibly not sending data out or something like that. Its clearly receiving data no problem, but then about 15-20 seconds later i get a failure packet and it says the client lost connection to the server. Its really bugging me, and i know its not something wrong with the servers/my internet because i was logged in on an actual client the whole time and never got disconnected.

And some info, i was testing with 2 clients, i tried having both on the same server and then on different servers. Either way, 15-20 seconds later they get disconnected. I feel like something isnt sending, but then they wouldnt login at all if the hello/load packets didnt send. So packets must be sending. Ugh i hate debugging.

toddw123 commented 7 years ago

Think i finally figured it out. After awhile of debugging you tend to miss some of the stupidest things.

It seems that doing: if (this->currentTarget.x == 0 && this->currentTarget.y == 0) { this->currentTarget = this->loc; } causes the currentTarget to be all over the place, since the currentTarget doesnt get initialized anywhere. Or something like that. All i had to do was add currentTarget = { 0.0f,0.0f }; to the Client constructor and now it works.