This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

How would I go about sending a large array over an RPC call I tried using to_json but it's pretty inefficient

in Engine by (12 points)

1 Answer

0 votes

a large array

What do you mean by "large"? 100 elements? 10 000? 1 000 000? Also: What's the content of your array? Does it contain mixed types? Strings? Integers? Floats?

I tried using to_json but it's pretty inefficient

Define "pretty inefficient". If you send the string representation of a huge array, it will take time, yes. However, there's no magic solution for this. Depending on your use case, you might get away with sending the string in smaller chunks. The real question is why you have to send a huge array over the network in the first place though...

by (10,634 points)

large as in 1 000 with arrays with the same size inside and those have integers

If you know that array's width in advance (or can send it alongside), consider sending the array as an 1D array instead of a 2D array. This should be significantly faster to serialize to JSON, and will let you loop much faster over the array.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.