Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Network system #269
There were three goals to this. The first was to combine the client and server network managers into one shared manager that can be accessed from anywhere. The second was to remove the lidgren networking code from SS14Server. The third was to encapsulate the server packets so that some form of sanitizing can be done.
Things that were not in the scope of this were changes to the client/server communication protocol, and converting the client/shared to the new network system. This is currently designed to work with minimal changes to the client, and minimal changes outside of SS14Server (now named BaseServer, maybe the content assembly could inherit from it?), SS14.Server.Networking*, and SS14.Server.Player*.
The public interfaces for the NetManager are pretty much what you would expect, check out the doc comments on them. Packets are now their own object that serializes and deserializes itself. The big benefit to this is the system can enforce a template and easily detect malformed packets.
Systems define their own packets and register them with the NetManager and a callback. Currently since Client code has not been migrated, they still rely on the static shared NetworkMessages enum. This should be removed in the future. You can currently find the existing NetMessages for the game inside SS14.Shared.Network.Messages. Yes, the protocol is a mess.
I'm not super satisfied with how this turned out but it does meet my goals, and I think it is way better than what we had before. I do believe it would be a good base to keep building off of. I have been coding this in a vacuum though, there may be something major I missed. Comments are always welcome.