UDP Lag

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
Prynok
Prole
Posts: 7
Joined: Mon Mar 31, 2014 8:00 pm

UDP Lag

Post by Prynok »

Hi, recently I've exported one of my little multiplayer games and sent them to my friends. However, there is a huge delay when someone tries to move when there is more than three people, and when they receive the movement. Is there any reason why this would happen? The only thing I added from the tutorial is direction and collision, whereas the collision all happens on the client side.

Thanks, Prynok
User avatar
Positive07
Party member
Posts: 1015
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: UDP Lag

Post by Positive07 »

Sometimes that happens cause you are requesting just one packet of data every update. If your computer hang three updates, then you will be three packets late than the rest. If also there is some lag in the connection you may read a packet many updates later causing even more delay. This error propagates and add it self and can get to seconds.

The problem could be solved by waiting until all packets arrive and waiting until unleast one packet arrives... But that will generate lag in your graphics. I don't know a really good answer. Maybe using a separate thread for the connection might work
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
WetDesertRock
Citizen
Posts: 67
Joined: Fri Mar 07, 2014 8:16 pm

Re: UDP Lag

Post by WetDesertRock »

Try polling the network at a rate of 30Hz, thats what I was told. This might help.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests