Page 1 of 1

[0.11.17] Multiplayer Still Desync Loop When New Player Joins

Posted: Mon Mar 09, 2015 2:30 pm
by FishSandwich
This was a known issue in 0.11.16 so I'm kind of surprised that it wasn't fixed in 0.11.17

Steps to reproduce:
Start a new multiplayer game.
Have someone join.

Re: [0.11.17] Multiplayer Still Desync Loop When New Player Joins

Posted: Mon Mar 09, 2015 2:40 pm
by quinor
Do you know any specific conditions when this bug appears? Generic joining doesn't cause desync loop.

Re: [0.11.17] Multiplayer Games Still Desync When New Player Joins

Posted: Mon Mar 09, 2015 2:43 pm
by SHiRKiT
It happens from time to time, and I have a better description for the issue:

Many of us players are using third-party softwares to create virtual LAN, such as Evolve and Hamachi. More specifically with Evolve, this issue is happening, but it's totally unrelated to Factorio:
- Start Evolve and create a party.
- Have players join the party and start Factorio.
- Host a game and have a friend join a game.
- In some random % of the loading, the connecting player will drop

This happens due to Factorio using a lot of the bandwidth available, and Evolve keeps requesting, checking and verifying the connecting between client and server, and clients to each other. Since Factorio is using a lot of the available bandwidth, Evolve's connection drops and resets, disconnecting for a second or so, to then reconnect (after about 1 second). This comes by unnoticed by players, and thinks that Factorio is causing issues.

If you are using Evolve Fish, I suggest to try out with another software, or just use public IP's with NAT with Virtual Servers. Using public IPs makes the game less laggy and loads the map faster, since Evolve does add some overhead to the bandwidth consumption.

Re: [0.11.17] Multiplayer Still Desync Loop When New Player Joins

Posted: Mon Mar 09, 2015 3:25 pm
by FishSandwich
psorek wrote:Do you know any specific conditions when this bug appears?
The specific condition is it only happens when a new player joins. Saving the game after the player has joined, desynced, left and then loading that map again fixes the problem.
SHiRKiT wrote:<snip>
Just to confirm, I wasn't using evolve at the time, and the player gets into the game fine(doesn't drop) then instantly goes into a desync loop. Tested 10 times and it happened 100% of the time.

Re: [0.11.17] Multiplayer Still Desync Loop When New Player Joins

Posted: Mon Mar 09, 2015 3:41 pm
by kovarex
It might be specific to the map or to the computers or something else.

We have been playing in 4 people a lot these days, we have been connecting and disconnecting all the time and everything worked fine.

So either a save, log of specification of the player that has this problem would be helpful.

Re: [0.11.17] Multiplayer Still Desync Loop When New Player Joins

Posted: Mon Mar 09, 2015 4:04 pm
by FishSandwich
Okay, my bad, it is related to my PvP mod. I assumed it was the problem from 11.16 because the behaviour was identical.

Anyway, desync report is attached:
desync-report-2015-03-09-15-57-08.zip
I was testing this locally on my own computer, but it also happens when playing over the internet.

Saving after desync, quitting and loading the save game fixes the problem for each new player. Also getting everyone into the map with the mod disabled, then saving and reloading with the mod enabled also works.

Re: [0.11.17] Multiplayer Still Desync Loop When New Player Joins

Posted: Mon Mar 09, 2015 5:10 pm
by FishSandwich
Okay, been testing(and redoing some stuff), it seems to be related to setting the player force to enemy when player first joins:

Code: Select all

game.onevent(defines.events.onplayercreated, function(event)
	local player = game.players[event.playerindex]
	if player.character then
		player.force = getProperForce(event.playerindex)
		player.force.researchalltechnologies()
		player.insert{name="pvp-armor", count=1}
		player.insert{name="biter-attractor-ON", count=1}
	end
end)

function getProperForce(index)
  if index % 2 == 0 then
	game.getplayer(index).color = {r = 1}
	return game.forces.enemy
  else
	game.getplayer(index).color = {b = 1}
    return game.forces.player
  end
end
Commenting out this line fixes the desync loop, but obviously the player won't be set to the correct team until they die.

Code: Select all

player.force = getProperForce(event.playerindex)

Re: [0.11.17] Multiplayer Still Desync Loop When New Player Joins

Posted: Mon Mar 09, 2015 5:40 pm
by kovarex
Now we are talking :)

This seems to be much better clue than in the beginning, we will take a look at it tomorrow I'm almost sure we will find a solution :)

Re: [0.11.17] Multiplayer Still Desync Loop When New Player Joins

Posted: Mon Mar 09, 2015 6:07 pm
by FishSandwich
kovarex wrote:This seems to be much better clue than in the beginning, we will take a look at it tomorrow I'm almost sure we will find a solution :)
I genuinely thought it was the same bug from 11.16, so I didn't take the report seriously until I realised it was my mod causing it.

I've isolated the problem to the line of code that sets a player onto the enemy team when they first join, so it's definitely something to do with that.

In the mean time, I have a workaround where we can just kill any player that's meant to be on the enemy team, and when they respawn they get put onto the enemy team without any desync issues, so I guess this isn't really an urgent fix.

Re: [0.11.17] Multiplayer Still Desync Loop When New Player Joins

Posted: Tue Mar 10, 2015 6:18 pm
by slpwnd
Thanks for the report. This problem was actually introduced during bug fixing for 0.11.17 (fix one bug create another :)). Anyway it will be fixed for the 0.11.18.