Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending data with more than 1250 bytes #23

Closed
Eleocraft opened this issue Feb 9, 2022 · 5 comments
Closed

Sending data with more than 1250 bytes #23

Eleocraft opened this issue Feb 9, 2022 · 5 comments
Labels
Feature Request New feature or request

Comments

@Eleocraft
Copy link

I am creating a player-hosted multiplayer survival game, so there is a lot of stuff that isn't stored on the server, but on the clients. because of this when the game gets saved I need to send a relatively big JSON savefile from every client to the server. Currently I need to break it down into several messages, because a message can't have more than 1250 bytes. However this is obviously not ideal, and as the savefile gets bigger because there is more data that needs to be saved It will get more and more complicated. So I wanted to ask: is there a possibility to send bigger chunks of data with riptide? and if this isn't possible: is there a reason for it not to be possible?

@ERmilburn02
Copy link

Riptide isn't designed for sending huge amounts of data, maybe try sending the save over http instead. It will be faster, more secure, and in theory can be any size.

@Eleocraft
Copy link
Author

Sorry, I normally make singleplayergames. how would I do that?

@tom-weiland
Copy link
Collaborator

So I wanted to ask: is there a possibility to send bigger chunks of data with riptide? and if this isn't possible: is there a reason for it not to be possible?

You could modify the source code to increase the limit. The reason messages are limited to that size is because Riptide is built for speed, and larger messages are more likely to take longer to send. In order for message instances to be reusable, they need a pre-allocated byte array which requires setting some kind of maximum size, and 1250 is less than MTU but bigger than most games will ever need a message to be.

there is a lot of stuff that isn't stored on the server, but on the clients

What kind of stuff are clients storing that the server doesn't know about?

because of this when the game gets saved I need to send a relatively big JSON savefile from every client to the server.

Sending the raw data and making the server create the JSON file locally will be more efficient than creating the JSON file on the client and sending that whole thing over.

@Eleocraft
Copy link
Author

Sending the raw data and making the server create the JSON file locally will be more efficient than creating the JSON file on the client and sending that whole thing over.

Yes I realized this. I fixed the problem by making a generic class, that can split a bytearray into several bytearrays with an index, and then put them together in the right order. It works fine, and I can send big chunks of data with many small messages.

What kind of stuff are clients storing that the server doesn't know about?

this is my first ever multiplayer game, and it will only be playable with friends cooperatively. So I don't need to keep track of for example player-abilities, loadouts or just inventorys on the server. Instead I just send it as a savefile when needed.

and larger messages are more likely to take longer to send.

I figued as much. that's why I didn't want to do this.

@tom-weiland tom-weiland added the Feature Request New feature or request label May 12, 2022
@tom-weiland
Copy link
Collaborator

7f67328 adds the ability to modify the max payload size for messages and will be part of v1.3.0, so you could use that to avoid having to split data. However, the aforementioned considerations still apply, so it may still not be something that you actually want to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants