Networking too slow for live multiplayer?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
notyetawizard
Prole
Posts: 3
Joined: Wed Jul 01, 2015 8:24 pm
Contact:

Networking too slow for live multiplayer?

Post 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!
User avatar
Tjakka5
Party member
Posts: 243
Joined: Thu Dec 26, 2013 12:17 pm

Re: Networking too slow for live multiplayer?

Post 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.
User avatar
portify
Prole
Posts: 18
Joined: Sun Feb 15, 2015 10:15 pm
Location: Locating
Contact:

Re: Networking too slow for live multiplayer?

Post by portify »

What is the actual slowdown you're experiencing? Networking logic taking a while? High latency on local connections?
User avatar
notyetawizard
Prole
Posts: 3
Joined: Wed Jul 01, 2015 8:24 pm
Contact:

Re: Networking too slow for live multiplayer?

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests