Fix Your Netcode!

Post all other topics which do not belong to any other category.
Post Reply
Cyberdragon
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Aug 11, 2015 9:38 pm
Contact:

Fix Your Netcode!

Post by Cyberdragon »

O_O @_@ *old movie scream*

I was trying to play with my friend and it was working fine for awhile but today it was being really laggy. It's "working" but being very, very slow. So I wiresharked it again...and nearly VOMITED. Remember awhile ago when the game would crash because it would drop a UDP packet and fail. I said that a cheap and dirty solution would be to spam the same packets a number of times and hope that it picked one up. um...I DIDN'T MEAN ACTUALLY DO THAT...or at least not for this long, you should have switched to proper TCP by now. If this is not how the game is supposed to work, well it's doing that, so fix it. This should be top priority, cause this is B.A.D.

Do we need to use the force to get you to use TCP, or any other protocol used properly. Or at least have separate connections for local and remote. Because seriously...please no more duct tape solutions.

Kane
Filter Inserter
Filter Inserter
Posts: 666
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: Fix Your Netcode!

Post by Kane »

Cyberdragon wrote:O_O @_@ *old movie scream*

I was trying to play with my friend and it was working fine for awhile but today it was being really laggy. It's "working" but being very, very slow. So I wiresharked it again...and nearly VOMITED. Remember awhile ago when the game would crash because it would drop a UDP packet and fail. I said that a cheap and dirty solution would be to spam the same packets a number of times and hope that it picked one up. um...I DIDN'T MEAN ACTUALLY DO THAT...or at least not for this long, you should have switched to proper TCP by now. If this is not how the game is supposed to work, well it's doing that, so fix it. This should be top priority, cause this is B.A.D.

Do we need to use the force to get you to use TCP, or any other protocol used properly. Or at least have separate connections for local and remote. Because seriously...please no more duct tape solutions.
You are an idiot... I'm sorry but there is many reasons this game should not be TCP to the point that I'm not going to waste my time. I hate calling people idiots but then again you started attacking the developers with your comments... I highly doubt you even understand the inner workings and why it's the way it is....

This is also not a bug maybe a suggestion but not a bug.

Berserker55
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Sat Jan 31, 2015 7:36 am
Contact:

Re: Fix Your Netcode!

Post by Berserker55 »

Well, the packet spam is routinely killing my friend's router, making him disconnect the entire household from internet over there. And it only happens when we play Factorio. So, he is right in some regard, there is some fixing to be done.

ChucklesTheBeard
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Sep 10, 2015 1:12 am
Contact:

Re: Fix Your Netcode!

Post by ChucklesTheBeard »

redacted

(I was clearly drunk when I originally made this comment)
Last edited by ChucklesTheBeard on Thu Feb 28, 2019 8:00 pm, edited 1 time in total.

User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 278
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: Fix Your Netcode!

Post by Narc »

Berserker55 wrote:Well, the packet spam is routinely killing my friend's router, making him disconnect the entire household from internet over there.
I, uh, hate to break this to you, but your friend's router may be crap.

Kane
Filter Inserter
Filter Inserter
Posts: 666
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: Fix Your Netcode!

Post by Kane »

They are always improving it... Take a game like Space Engineers and try it's MP... After a few Months from no netcode to netcode they have done amazing things. But this topic was more of an attack.

Their already using I think Lock step that you see in some the RTS games that helps cut down the traffic. But your talking about something massive vs 20 npc's running around the map..

Your Router issue or friends router might be really bad... I assume he can't torrent then if this kills his router.. If it's a ISP Router then gateway off and get a proper router.

Cyberdragon
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Aug 11, 2015 9:38 pm
Contact:

Re: Fix Your Netcode!

Post by Cyberdragon »

If there are reasons that factorio should be UDP when MAP DOWNLOADING, then give them. I've talked to other people who are computer savvy, who don't play this game, so they aren't bias, and even they think it's stupid to download files over the open internet with UDP. UDP is for LAN and streaming, not downloading.

And no, it has nothing to do with internet speed, this is a 2D sprite based game, it shouldn't take that much to play. I can play other games just fine but this one hogs the internet. And you people out their with your 50Mbps fiber connections or whatever who can take the packet spam till it slows down to 1% internet speed and still play just fine, you have no idea. I don't know what is causing the lag while playing, but I'm pretty sure it's down to poor netcode, given that the map downloading is this bad.

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Fix Your Netcode!

Post by daniel34 »

Moved to General discussion.

I agree with you that UDP is not the best protocol to use when downloading the map. I've got a pretty old modem/router (>6 years) and it limits the download rate I get when downloading a map.
However, Factorio uses UDP because when you're ingame the state of the map is communicated every tick, 60 times per second. UDP is the better choice here. I guess when the devs added the map download they used the already working UDP code. In a LAN this works perfect, but over the internet there's always some peers who have old equipment/bad internet and the map download takes ages. The map download might be better handled with TCP.
The devs are aware of this issue, I hope they do something to change the current map download.
quick links: log file | graphical issues | wiki

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Fix Your Netcode!

Post by prg »

Yeah, the devs must be idiots. That's why we repeatedly see suggestions of the form "It's so obvious! Why don't they just..." with popular choices for obvious things being
  • make it multithreaded? It would be four times as fast on a quad core!
  • use TCP for networking? It would be way more reliable!
  • write to a temporary file in RAM first before copying it to disk? The game then wouldn't freeze during autosaves!
The devs sure can be glad to have you guys around to tell them how to write a game.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Berserker55
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Sat Jan 31, 2015 7:36 am
Contact:

Re: Fix Your Netcode!

Post by Berserker55 »

Narc wrote:
Berserker55 wrote:Well, the packet spam is routinely killing my friend's router, making him disconnect the entire household from internet over there.
I, uh, hate to break this to you, but your friend's router may be crap.
It certainly is, but there's nothing he can do, as it's a shared flat.

Gammro
Filter Inserter
Filter Inserter
Posts: 360
Joined: Wed Oct 09, 2013 1:45 pm
Contact:

Re: Fix Your Netcode!

Post by Gammro »

Cyberdragon wrote:And no, it has nothing to do with internet speed, this is a 2D sprite based game, it shouldn't take that much to play.
Graphical fidelity has very little to do with how much information needs to be exchanged. There's literally tens of thousands of entities in at any one time in the game. Those all need to be synchronized between the clients. In your average good looking AAA FPS, there's 64 people on a server at best. That doesn't need anywhere near the amount of data exchange for a synchronized game state.
Ignore this

dee-
Filter Inserter
Filter Inserter
Posts: 415
Joined: Mon Jan 19, 2015 9:21 am
Contact:

Re: Fix Your Netcode!

Post by dee- »

Gammro wrote:
Cyberdragon wrote:And no, it has nothing to do with internet speed, this is a 2D sprite based game, it shouldn't take that much to play.
Graphical fidelity has very little to do with how much information needs to be exchanged. There's literally tens of thousands of entities in at any one time in the game. Those all need to be synchronized between the clients. In your average good looking AAA FPS, there's 64 people on a server at best. That doesn't need anywhere near the amount of data exchange for a synchronized game state.
Yes, graphical fidelity has for Factorio nothing to do with network usage and
No, those tens of thousands moving items and activated buildings are NOT sent over the wire - that's the reason the game has to be always in deterministically determinable states (Factorio-speak: "synchronized") otherwise the simulation of the mutliple clients becomes divert ("desyncs").


I just don't understand why they have to use UDP, because every "tick" of the game can be sent out, but it does NOT have to be realtime.
For example have six clients and one suddently loses a burst of packages, then his simulation stops after the last received package.
Now, if user input could also be merged/muxed into the packet-input stream for the game engine to be processed, then the game could pause at any time for the lagging clients to catch up and continue from there - deterministically

User avatar
Kewlhotrod
Fast Inserter
Fast Inserter
Posts: 168
Joined: Thu Apr 23, 2015 5:20 pm
Contact:

Re: Fix Your Netcode!

Post by Kewlhotrod »

prg wrote:Yeah, the devs must be idiots. That's why we repeatedly see suggestions of the form "It's so obvious! Why don't they just..." with popular choices for obvious things being
  • make it multithreaded? It would be four times as fast on a quad core!
  • use TCP for networking? It would be way more reliable!
  • write to a temporary file in RAM first before copying it to disk? The game then wouldn't freeze during autosaves!
The devs sure can be glad to have you guys around to tell them how to write a game.
^dis, plz fix

ty <3

immibis
Filter Inserter
Filter Inserter
Posts: 303
Joined: Sun Mar 24, 2013 2:25 am
Contact:

Re: Fix Your Netcode!

Post by immibis »

dee- wrote:I just don't understand why they have to use UDP, because every "tick" of the game can be sent out, but it does NOT have to be realtime.
Huh, why doesn't it have to be real-time? You do know that the game can't simulate a tick until it's received all the player input for that tick, right?

User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Re: Fix Your Netcode!

Post by SHiRKiT »

I see we have tons of developers here. Why don't you all try to make your own game? Pfff

The Lone Wolfling
Long Handed Inserter
Long Handed Inserter
Posts: 97
Joined: Tue Oct 28, 2014 3:33 pm
Contact:

Re: Fix Your Netcode!

Post by The Lone Wolfling »

Cyberdragon wrote:If there are reasons that factorio should be UDP when MAP DOWNLOADING, then give them.
Reason: TCP requires packets to be acked/nacked in-order. Whereas as long as the packets have proper sequence numbers (which they have to have either way) you don't need packets to be in order - you can receive them in whatever order and then shuffle them around as needed, asking for retries as necessary. This is especially relevant on lossy connections (say: wifi), where a momentary connection interruption can cause a delay of (at minimum) a full round-trip.

Reason: Poor window scaling on lossy connections. TCP is built around the assumption that most packet loss is due to congestion not external factors. And as a result it performs poorly on lossy connections.

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Fix Your Netcode!

Post by ratchetfreak »

The Lone Wolfling wrote:
Cyberdragon wrote:If there are reasons that factorio should be UDP when MAP DOWNLOADING, then give them.
Reason: TCP requires packets to be acked/nacked in-order. Whereas as long as the packets have proper sequence numbers (which they have to have either way) you don't need packets to be in order - you can receive them in whatever order and then shuffle them around as needed, asking for retries as necessary. This is especially relevant on lossy connections (say: wifi), where a momentary connection interruption can cause a delay of (at minimum) a full round-trip.

Reason: Poor window scaling on lossy connections. TCP is built around the assumption that most packet loss is due to congestion not external factors. And as a result it performs poorly on lossy connections.
reciever on a TCP has a buffer to hold the out of order arrivals.

and wifi will retry on its own when packets don't go through

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Fix Your Netcode!

Post by ssilk »

I think that's an important point: For connections, which are about to transfer much data, or over bad connections, a TCP-connection can run much more smooth, cause the devices in the route can fix problems in their connection in most cases themselves, they repeat the lost or wrong packets and can handle out very smart methods to make the communication as efficient as possible.

This is - AFAIK - not generally possible with UDP, because there is no "end-to-end" connection.

So on bad or laggy connections I think it might be useful to use TCP instead UDP.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
Darkestnoir
Inserter
Inserter
Posts: 29
Joined: Sun Nov 23, 2014 8:57 pm
Contact:

Re: Fix Your Netcode!

Post by Darkestnoir »

Yeah, very slow download/upload speed over the Internet. I hope that will be fixed soon, 10mb download with 40kB/s are not funny.....

Post Reply

Return to “General discussion”