Sign In Register

How can we help you today?

Start a new topic
Answered

Questions about Realtime Scripts

Hello.

I have a few questions regarding cloud code, especially real-time scripts and realtime modules.

First, I'm trying to make the server more authoritative of the game, so I need to keep a few things in the real-time scripts and also I want to do some calculations on it.

1: When a client send a packet to the server that contains unstructured data, is there a way to get the byte array from it in the realtime script? and to send unstructured data to clients?

2: If I'm using an external library in my c# code(in unity), or the built-in classes in c#, can I add it to the realtime modules?




Best Answer

 Hey Yaser,

We dont have the ability to receive unstructured data in RTscripts.
This would require a huge overhaul of the RTscripts and it would be very difficult to get JS working with the binary data, so it is unlikely we will develop this feature in the future.

Apologies for any inconvenience.
Sean


Hello.

I read more through the documentation but still can't find anything related to using Unstructured data with the cloud code.

So can you please help me with it?

Thanks.

Hi.

I think that I should post this as a feature request? Because clearly the use of unstructured data(byte array) in cloud code isn't supported yet.

Let me know If that's the case and I will post a new feature request.

In case you're wondering why would I need it, then it's for bandwidth optimization.

Sending an int as an index for each item in the packet is too much, also the RTData doesn't support types like Byte, Int16(short) and such, which would save a lot of bandwidth, especially for a real-time game where messages will be transferred about 10-15 times a second between the server and each player.

Thanks, I know you guys are busy working on the new update for GameSparks, sorry If I'm annoying you with my posts.

Hello.

it has been more than 20 days without an answer, are old topics ignored? Maybe I should create a new topic.


Hi Yaser,


Sorry for the delay in getting back to you. Have you had a look at our documentation here related to sending Unstructured Data (https://docs2.gamesparks.com/tutorials/real-time-services/implementing-real-time-chat-services.html#sending-unstructured-data) and also here on receiving unstructured data (https://docs2.gamesparks.com/tutorials/real-time-services/implementing-real-time-chat-services.html#receiving-unstructured-data) Do you think this would suit your needs.


Kind regards,

 - Steve

Hello steve, Thanks for your response.

What I want is to receive the unstructured data on the server,on real-time script,not on the client.

You can receive a packet on the real-time script like that:

RTSession.onPacket(1, function(packet){

// 

});

but the "packet" object doesn't contain any stream for the byte-array, so If 

you send unstructured data to the server, the server can't extract it from the packet.


Answer

 Hey Yaser,

We dont have the ability to receive unstructured data in RTscripts.
This would require a huge overhaul of the RTscripts and it would be very difficult to get JS working with the binary data, so it is unlikely we will develop this feature in the future.

Apologies for any inconvenience.
Sean

Hello, Sean thanks for your answer.

Can you consider adding boolean/boolean array data type to the RTpacket? On both unity GameSparks API and cloud RTscripts? so that I can exchange them between clients and the server.

Also, I have started a new topic yesterday but looks like it hasn't been published yet, can you please check it for me?


Hi, Sean.

The topic has been published, I didn't notice it,Sorry.

Login to post a comment