Page 1 of 1

Networking too slow for live multiplayer?

Posted: Mon May 23, 2016 11:03 pm
by notyetawizard
Hey LÖVErs!

I'm toying around with prototyping a sort of real time, tactical game, played on a grid. It's nothing special right now, as I've just been getting basic movement and networking set up. Everything is working right now, but the networking just seems too slow for real use, even with two players on a local connection.

Anyone interested in looking over my code (it's not too much, less than 500 lines still), and seeing if there's something I should be handling differently to speed things up? The "game.lua" library has no networking stuff in it, so it can probably be ignored. The server won't run on windows right now, as I'm using "uuidgen" to give things ids, but the client should.

Should I be sending less packets but larger? More but smaller? Trying to parse more packets at a time during "love.update()"? Do I need to thread things or something? Bah, I've reached the point where I just don't know!

Preemptive thanks to anyone who looks!

Re: Networking too slow for live multiplayer?

Posted: Tue May 24, 2016 7:26 am
by Tjakka5
As far as I could see, you're sending data over the network every frame; instead, try to send data only x times a second.
I'd suggest x being 30.

Re: Networking too slow for live multiplayer?

Posted: Tue May 24, 2016 9:40 am
by portify
What is the actual slowdown you're experiencing? Networking logic taking a while? High latency on local connections?

Re: Networking too slow for live multiplayer?

Posted: Tue May 24, 2016 1:34 pm
by notyetawizard
I am checking for updates to send every frame, but nothing sends unless there's an update. This ends up being about twice per player movement speed, times the number of players—only about 8 times a second, with what I've currently been testing.

While the latency of our local connection isn't great, it's been sufficient for other online gaming, and I'd be hesitant to blame it for anything. The slowness is very probably coming from my code somewhere, but I'm new to networking and don't have a clue where.