Jump to content

Multiplayer Protocol


Recommended Posts

Just now, Broxzier said:

Yes, by checking the source. Why do you want to know that?

I'm thinking about writing my own server implementation in Java (multithreaded) which allows plugins, but i'm not really a C/C++ pro :/
Is there any way you can tell me how the packes are build, and do you use id's?

Link to comment
5 minutes ago, Broxzier said:

Then I suggest reading up about that, instead of checking the source code of projects.

That still doesn't really answer my question :P, how do you identify packets, with ID's, or..? And in what order is the packet data (for example: 1. uint ID 2. byte[] data, etc)

Edited by Rammelkast
Link to comment

We're using UDP TCP, so there's no need for keeping track of IDs. Packets are guaranteed to arrive in the same order they are sent. From the code it looks like each packet has a size (number of bytes), a data array (vector of bytes), and keeps track of how many bytes are transferred and read.

https://github.com/OpenRCT2/OpenRCT2/blob/develop/src/network/network.h#L119-L153

Edited by Broxzier
Was confusing UDP with TCP.
Link to comment

There's some confusion in here. Let me clear all that up.

No, we do not use UDP, we use TCP only. See https://github.com/OpenRCT2/OpenRCT2/blob/develop/src/network/network.cpp#L660

The packets are simply game commands, a function that alters game's logic state. See https://github.com/OpenRCT2/OpenRCT2/blob/develop/src/game.c#L439

The only way you could do a server in Java* is by implementing full logic of the game (i.e. full and exact recreation of 0.0.4 bar the actual UI stuff) as this is what we sync right now over the wire, along with the tick, across all connected parties. See https://github.com/OpenRCT2/OpenRCT2/blob/develop/src/network/network.cpp#L1824-L1891

*which is insane and ill-conceived idea. Certainly possible and doable, but I would bet almost any money you won't pull through.

Link to comment
12 hours ago, janisozaur said:

There's some confusion in here. Let me clear all that up.

No, we do not use UDP, we use TCP only. See https://github.com/OpenRCT2/OpenRCT2/blob/develop/src/network/network.cpp#L660

The packets are simply game commands, a function that alters game's logic state. See https://github.com/OpenRCT2/OpenRCT2/blob/develop/src/game.c#L439

The only way you could do a server in Java* is by implementing full logic of the game (i.e. full and exact recreation of 0.0.4 bar the actual UI stuff) as this is what we sync right now over the wire, along with the tick, across all connected parties. See https://github.com/OpenRCT2/OpenRCT2/blob/develop/src/network/network.cpp#L1824-L1891

*which is insane and ill-conceived idea. Certainly possible and doable, but I would bet almost any money you won't pull through.

Okay, thanks.

Link to comment
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...