Friday Facts #302 - The multiplayer megapacket

Regular reports on Factorio development.
User avatar
FactorioBot
Factorio Staff
Factorio Staff
Posts: 228
Joined: Tue May 12, 2015 1:48 pm

Friday Facts #302 - The multiplayer megapacket

Post by FactorioBot » Fri Jul 05, 2019 1:22 pm


User avatar
BattleFluffy
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Sun Mar 31, 2019 4:58 pm
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by BattleFluffy » Fri Jul 05, 2019 1:23 pm

wooo :D

This was a fascinating read. Looking forward to my next multiplayer session now.. :>
Last edited by BattleFluffy on Fri Jul 05, 2019 1:33 pm, edited 1 time in total.

Mylon
Filter Inserter
Filter Inserter
Posts: 368
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by Mylon » Fri Jul 05, 2019 1:29 pm

Why does the game state need to know what entity the player has selected anyhow? If the player executes an action, pass that action to the server rather than passing the player.selected property. This seems like an unnecessary linkage between view and controller of model/view/controller design.

User avatar
ledow
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Sat Sep 24, 2016 3:00 pm
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by ledow » Fri Jul 05, 2019 1:42 pm

In terms of debugging multiplayer, can't you just pull a frozen state out of the multiplayer server for offline replay for, say, the last dozen ticks?

Then if you crash out, you could instruct the server to send you that state, and then replay it offline to your heart's content without interfering with other people's games and without having to guess, by proper breakpointing and retrace?

I'm sure that's how everything multiplayer since the days of Doom has done debugging on multiplayer games.

ske
Filter Inserter
Filter Inserter
Posts: 375
Joined: Sat Oct 17, 2015 8:00 am
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by ske » Fri Jul 05, 2019 2:10 pm

Twinsen, you are a hero!

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

Re: Friday Facts #302 - The multiplayer megapacket

Post by ratchetfreak » Fri Jul 05, 2019 2:35 pm

If it were me I'd have added another edge case, if the packet has too many selection changes, delete them all from the queue instead have it send single absolute value.

But I'm sure there'd be issues with that as well

Ultros
Fast Inserter
Fast Inserter
Posts: 122
Joined: Thu Apr 04, 2019 4:25 pm
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by Ultros » Fri Jul 05, 2019 3:22 pm

What exactly are the giant basketball hoop and the four pillars entities in the video linked in the FFF?

I've only played on .17, but they don't look like any .16 graphics entity I know of. Are mods allowed on specific clusterio servers?

User avatar
Lubricus
Fast Inserter
Fast Inserter
Posts: 213
Joined: Sun Jun 04, 2017 12:13 pm
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by Lubricus » Fri Jul 05, 2019 4:00 pm

Mylon wrote:
Fri Jul 05, 2019 1:29 pm
Why does the game state need to know what entity the player has selected anyhow? If the player executes an action, pass that action to the server rather than passing the player.selected property. This seems like an unnecessary linkage between view and controller of model/view/controller design.
I was thinking the same. Other players don't have to see what you have selected and what you have selected shouldn't directly influence any gamestate that have effect on other players. Similar to the details on mouse movements.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 1999
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by Jap2.0 » Fri Jul 05, 2019 4:29 pm

Lubricus wrote:
Fri Jul 05, 2019 4:00 pm
Mylon wrote:
Fri Jul 05, 2019 1:29 pm
Why does the game state need to know what entity the player has selected anyhow? If the player executes an action, pass that action to the server rather than passing the player.selected property. This seems like an unnecessary linkage between view and controller of model/view/controller design.
I was thinking the same. Other players don't have to see what you have selected and what you have selected shouldn't directly influence any gamestate that have effect on other players. Similar to the details on mouse movements.
I don't know - can mods do things when you hover over something? Does the server tell clients what you click on, or just that you click?

Edit - all very interesting, by the way. I'm looking forward to testing it out :).
There are 10 types of people: those who get this joke and those who don't.

User avatar
Raiguard
Long Handed Inserter
Long Handed Inserter
Posts: 54
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by Raiguard » Fri Jul 05, 2019 4:35 pm

Jap2.0 wrote:
Fri Jul 05, 2019 4:29 pm
Lubricus wrote:
Fri Jul 05, 2019 4:00 pm
Mylon wrote:
Fri Jul 05, 2019 1:29 pm
Why does the game state need to know what entity the player has selected anyhow? If the player executes an action, pass that action to the server rather than passing the player.selected property. This seems like an unnecessary linkage between view and controller of model/view/controller design.
I was thinking the same. Other players don't have to see what you have selected and what you have selected shouldn't directly influence any gamestate that have effect on other players. Similar to the details on mouse movements.
I don't know - can mods do things when you hover over something? Does the server tell clients what you click on, or just that you click?

Edit - all very interesting, by the way. I'm looking forward to testing it out :).
Yes, my mod absolutely depends on player.selected. If they were to take that out, my mod would not work at all in multiplayer.
Don't forget, you're here forever.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 1999
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by Jap2.0 » Fri Jul 05, 2019 4:38 pm

Raiguard wrote:
Fri Jul 05, 2019 4:35 pm
Jap2.0 wrote:
Fri Jul 05, 2019 4:29 pm
Lubricus wrote:
Fri Jul 05, 2019 4:00 pm
Mylon wrote:
Fri Jul 05, 2019 1:29 pm
Why does the game state need to know what entity the player has selected anyhow? If the player executes an action, pass that action to the server rather than passing the player.selected property. This seems like an unnecessary linkage between view and controller of model/view/controller design.
I was thinking the same. Other players don't have to see what you have selected and what you have selected shouldn't directly influence any gamestate that have effect on other players. Similar to the details on mouse movements.
I don't know - can mods do things when you hover over something? Does the server tell clients what you click on, or just that you click?

Edit - all very interesting, by the way. I'm looking forward to testing it out :).
Yes, my mod absolutely depends on player.selected. If they were to take that out, my mod would not work at all in multiplayer.
Well there's everyone's answer :P.
(also, there's a debug option that shows what everyone has selected in multiplayer. I like to leave it on, just for fun.)
There are 10 types of people: those who get this joke and those who don't.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 3178
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by eradicator » Fri Jul 05, 2019 4:50 pm

@Raiguard: Which one? Tapemeasure at least seems to not need them seperate.
Jap2.0 wrote:
Fri Jul 05, 2019 4:29 pm
I don't know - can mods do things when you hover over something? Does the server tell clients what you click on, or just that you click?
Currently "pressed a button" and "selected something" are different events. If i.e. my mod needs to know "did player click on my_building" then i have to listen for the "pressed mouse button" event and then in that event check what the player has currently selected. So theoretically most things could still be done if the two events where combined into a single "player pressed button on something" event. Practically it would be a lot of work to change all existing mods, and of course you lose the edge-case scenarios where you actually want only the selection event, i.e. for some mods that let you "manually revive" ghosts just by hovering them, etcpp.
Author of: Hand Crank Generator, Screenshot Hotkey 2.0
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

OvermindDL1
Fast Inserter
Fast Inserter
Posts: 164
Joined: Sun Oct 05, 2014 6:12 am
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by OvermindDL1 » Fri Jul 05, 2019 5:17 pm

eradicator wrote:
Fri Jul 05, 2019 4:50 pm
@Raiguard: Which one? Tapemeasure at least seems to not need them seperate.
Jap2.0 wrote:
Fri Jul 05, 2019 4:29 pm
I don't know - can mods do things when you hover over something? Does the server tell clients what you click on, or just that you click?
Currently "pressed a button" and "selected something" are different events. If i.e. my mod needs to know "did player click on my_building" then i have to listen for the "pressed mouse button" event and then in that event check what the player has currently selected. So theoretically most things could still be done if the two events where combined into a single "player pressed button on something" event. Practically it would be a lot of work to change all existing mods, and of course you lose the edge-case scenarios where you actually want only the selection event, i.e. for some mods that let you "manually revive" ghosts just by hovering them, etcpp.
Tapemeasure uses a blueprint to get extents, so it wouldn't.

Look at a mod like the Picker Pipe Tools (I think was the name), it shows overlays of the entire pipe network and dead-ends and all just based on the position of the mouse (of any player); it feels integrated and a natural part of the game.

Twinsen
Factorio Staff
Factorio Staff
Posts: 970
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by Twinsen » Fri Jul 05, 2019 7:13 pm

Mylon wrote:
Fri Jul 05, 2019 1:29 pm
Why does the game state need to know what entity the player has selected anyhow? If the player executes an action, pass that action to the server rather than passing the player.selected property. This seems like an unnecessary linkage between view and controller of model/view/controller design.
Since it was done super long ago, probably only kovarex knows the real answer.
But I can think of 3 reasons:
- we tend to put as much as possible in the game state. By having almost all game information in the game state, it's less probable to cause desyncs, and it's generally easier to work with code wise.
- keeps actions like open entity, rotate entity, copy settings, paste settings, shoot, etc quite simple and small since they don't need to send the selected entity.
- more flexibility for mods, as mentioned above

posila
Factorio Staff
Factorio Staff
Posts: 3652
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by posila » Fri Jul 05, 2019 7:34 pm

In addition, since LuaControl::selected exists in the API, entity selection input action has to be sent anyway. And I haven't check but I would say the API property is older than multiplayer.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 1999
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by Jap2.0 » Fri Jul 05, 2019 9:14 pm

I've been playing online some (redmew mostly) and it seems that a decent number of people agree that lag/latency (especially in combat) got worse in .54, what are everyone else's thoughts?
There are 10 types of people: those who get this joke and those who don't.

Mylon
Filter Inserter
Filter Inserter
Posts: 368
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by Mylon » Fri Jul 05, 2019 10:10 pm

Raiguard wrote:
Fri Jul 05, 2019 4:35 pm
Jap2.0 wrote:
Fri Jul 05, 2019 4:29 pm
Lubricus wrote:
Fri Jul 05, 2019 4:00 pm
Mylon wrote:
Fri Jul 05, 2019 1:29 pm
Why does the game state need to know what entity the player has selected anyhow? If the player executes an action, pass that action to the server rather than passing the player.selected property. This seems like an unnecessary linkage between view and controller of model/view/controller design.
I was thinking the same. Other players don't have to see what you have selected and what you have selected shouldn't directly influence any gamestate that have effect on other players. Similar to the details on mouse movements.
I don't know - can mods do things when you hover over something? Does the server tell clients what you click on, or just that you click?

Edit - all very interesting, by the way. I'm looking forward to testing it out :).
Yes, my mod absolutely depends on player.selected. If they were to take that out, my mod would not work at all in multiplayer.
I'm not saying to remove player.selected property. But the player.selected event. You could still fetch it via a hotkey or possibly a timer. This could lead to some weird edge cases in multiplayer where the server asks, "What do you have selected?" And before the server gets the client's reply, the entity could be removed so mods would have to validate it to avoid an error.


User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 3178
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by eradicator » Sat Jul 06, 2019 9:30 am

OvermindDL1 wrote:
Fri Jul 05, 2019 5:17 pm
Tapemeasure uses a blueprint to get extents, so it wouldn't.
I have no clue what you tried to say there, but tapemeasure uses a capsule.
Mylon wrote:
Fri Jul 05, 2019 10:10 pm
I'm not saying to remove player.selected property. But the player.selected event.
The event is a consequence of syncing the "selected" input action as far as i understand. Thus "removing the event" would only reduce moddability while doing nothing for latency. And besides the server doesn't "ask" stuff as explained in the FFF.
Author of: Hand Crank Generator, Screenshot Hotkey 2.0
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

ukezi
Filter Inserter
Filter Inserter
Posts: 338
Joined: Sat Jul 02, 2016 11:02 pm
Contact:

Re: Friday Facts #302 - The multiplayer megapacket

Post by ukezi » Sat Jul 06, 2019 10:38 am

Ultros wrote:
Fri Jul 05, 2019 3:22 pm
What exactly are the giant basketball hoop and the four pillars entities in the video linked in the FFF?

I've only played on .17, but they don't look like any .16 graphics entity I know of. Are mods allowed on specific clusterio servers?
That would be the clusterio custom entity that does the sending and receiving of stuff. Clusterio itself is a mod. You could probably also play it with bob's or angel+bob's

Post Reply

Return to “News”