@Nepute
From my understanding, your game is a Story Mode (tell me if I'm wrong here as some of my answers depends on it.)
You pretty much have a main
Hero running the Story. A few
Accomplice / pets can join from time to time and you would like those to be played by friends. (Am I right?)
In other word. You expect
1 player to play solo most of the time, save
his progress in the story to
his computer. You are now looking for a way to let your a
friend jump in and play along from time to time. But the overall saved progress still belong to the main Player. (Am I right?)
This takes a lot of guess works out of your hands.
- Don't worry too much about state persistency and other stuff. Your Main Game (the hero's Computer) is authoritive. He tells the story. He runs the story. If your Main Game crashes, your friends will join back in to your last saved point.
- Don't worry too much about Creating Rooms and Lobbies for wait periods or broadcasting your presence.
- I would (as you've probably done) Simply implement the remote clients as "Remote control" sending their actions to the Hero's Host, waiting for a "World Update".
I know you are planning a release on Steam, I would advice against using
plain sockets for that matter. (they are great for development, but not for nothing else really)
- I would recommend you to setup a Steam *MatchMaking* layer that create a Private Lobby with "FriendOnly" level right when the your game starts. That way all your friends will see the "Join this game" button in there steam friends listing.
This way your Friends can join in from the Steam Friends chat to play one of the accomplice/pets.
- I would also recommend you to use the Steam P2P relay to reroute the traffics instead of using the base GML network_* functions. (The idea here is to use Valve' network (or any other relay really.. like photon networking) Instead of writing to a tcp socket.. you write to their wrapper.
- I would recommend you the simple Client/Server approach where the Server (your Hero game) Broadcast the
World state to the clients every 15-20ms. And the clients simply update all their obj accordingly. That's what you have already done if I've followed correctly.
- For your first draft, I would recommend your Client to do absolutly nothing else than sending the Key pressed to the Server.
- You will need a second draft where you interpolate to hide that 200ms-400ms ping between the click and move. Since you appears fairly new to Networking I would recommend you to save that as a "later deal" optimisation.
---
I know those 2 concepts (Steam MatchMaking and Steam P2P) are not well exposed to GML, so you will need to go some other way.
I can't advocate my own dll here since they are all private and propriatary bound... But searching the community I know YellowAfterLife is maintaining a great wrapper.
https://yellowafterlife.itch.io/steamworks-gml-example