CSM icon indicating copy to clipboard operation
CSM copied to clipboard

Server (Relay)

Open ronaldmourik opened this issue 4 years ago • 4 comments

Based on #67 I said to myself, if i could make a server work in a couple of hours i would make a pull request. So, here i am...

List:

  • [x] Split Commands to shared library
  • [x] Multiple clients can join
  • [x] Basicly make it all "work"
  • [x] "Synchronize" save game to server
  • [x] Make the Pause/Unpause/Time work.
  • [ ] Test functionality some more
  • [ ] Refactor server/client classes for less code duplication
  • [x] Change project to .NET core
  • [ ] Refactor namespaces
  • [ ] Optimize save game synchronization (At this moment its hooked into the save method)
  • [ ] Add documentation
  • [ ] More?

My plan is to work on above functionality in the next couple of days. .NET Core/AspNetCore will be high on the list to support some modern tech (Like webserver etc)

ronaldmourik avatar Jul 08 '21 21:07 ronaldmourik

I don't have time to look though this at the moment (and I'll be out of town next week).

Is the basic idea to send commands to the relay server, which then relays the commands to all connected clients?

Does the relay server become the actual server and everyone else becomes clients?

Is there still the option to host and connect as before (One user is the server, the other is the client).

DominicMaas avatar Jul 08 '21 22:07 DominicMaas

Keep in mind this project (https://github.com/CitiesSkylinesMultiplayer/HolePunchTest), which I may end up integrating soon at some point (NAT hole punching for traditional client-server though NAT).

I might have to do the repo restructure in another blank PR and then rebase all these others PRs before things get too messy.

DominicMaas avatar Jul 08 '21 22:07 DominicMaas

I don't have time to look though this at the moment (and I'll be out of town next week).

Is the basic idea to send commands to the relay server, which then relays the commands to all connected clients?

Does the relay server become the actual server and everyone else becomes clients?

Is there still the option to host and connect as before (One user is the server, the other is the client).

No problem.

Yes exactly as you describe. In fact, I haven't changed the client code one bit. All the functionality still remains the same.

ronaldmourik avatar Jul 09 '21 05:07 ronaldmourik

Keep in mind this project (https://github.com/CitiesSkylinesMultiplayer/HolePunchTest), which I may end up integrating soon at some point (NAT hole punching for traditional client-server though NAT).

I might have to do the repo restructure in another blank PR and then rebase all these others PRs before things get too messy.

It would be possible to create a separate project for this. Having minimal changes on the codebase The only problem is that the packet id's are generated and not fixed. That's the whole reason the shared protocol project exists. If we could make the packet id's fixed the server can exist without the need of the client and only support a small subset of commands.

ronaldmourik avatar Jul 09 '21 05:07 ronaldmourik