0 votes

Hi,
Theseday, I use godot as network server (fast build for demo server)

Question about optimization

Situation
1. Game will send data in realtime (means send at least 30 packets per second)
(optional) 2. Data always be ( JSON-stringify )
Have some form for kind of contents, but will be JSON in demo play

I want to optimize sending/receiving amount.
and wonder,

Is sending 'Number like string' as Number is better than as String?

Sending "1234567890" as string VS 1234567890 as int

In godot,
Int is 'Signed 64-bit integer type'
String may kind of 'Object'

which is cheap?

*Optional situation can be delete if it cause optimization more

in Engine by (43 points)

1 Answer

0 votes
Best answer

well if what are sending will be always a number and its not a decimal number, only a integer according to Signed 64-bit integer type sending it is cheaper.

also if you are going to send 30 packets per second you should not use a JSON, nor TCP connection, but instead, UDP connection and convert all to PoolByteArray

by (100 points)
selected by

Thank you for your advice :)

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 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 webmaster@godotengine.org with your username.