Hi, im making a realtime multiplayer in Unreal Engine, but can't find a solution, how can i send data to server and then emidiatly recieve that data on all client including sender?
Best Answer
T
Tech Support
said
about 6 years ago
Why do you want the player to receive the same data they sent? They can just use the data locally.
If you really want to, and I don't think is a good idea, to send to the same player then you need to use RT Scripts like I showed up above.
-Send packet to server
-Let server send to all clients.
Again, what point in client sending data to server and receiving them? You're wasting bandwidth and potentially will lose packets and not see the effect reflected in game.
The send function automatically sends the packet to the server and to other clients in the session but not to the player sending it.
If you want to send a packet to the server and have the server send it to everybody then:
1- When sending the packet, the peers int array should have the int 0 in it. 0 is the address of the server. With any OpCode, for this example it'll be 99.
100 being an example OpCode. If you don't set the setTargetPeers then the server will send that packet to everyone.
However, why would you want to send the player the same packet they sent to the server? What are you trying to do?
Cheers,
Omar
Z
Zaur Khadikov
said
about 6 years ago
Its kind of a turn based game where, both players can manipulate the same character in game. so i wat to send some input data to server and see the same result on both clients.
Z
Zaur Khadikov
said
about 6 years ago
can it be done via blueprints only, or i should write some scripts on cloud code?
Z
Zaur Khadikov
said
about 6 years ago
When sending data to server by seting 0 in the peers int, i did not recieve enithing on clients.
Tech Support
said
about 6 years ago
Hey, have you had a look at our RT example in the sample project?
It's got an example of how to do that. Here's a quick photo of sending an empty packet to all clients (Not including the sender).
Cheers,
Omar
Z
Zaur Khadikov
said
about 6 years ago
Thanks Omar, Yes ive tried this method, but it seems to sends data to all peers exep for the sender.
Tech Support
said
about 6 years ago
Answer
Why do you want the player to receive the same data they sent? They can just use the data locally.
If you really want to, and I don't think is a good idea, to send to the same player then you need to use RT Scripts like I showed up above.
-Send packet to server
-Let server send to all clients.
Again, what point in client sending data to server and receiving them? You're wasting bandwidth and potentially will lose packets and not see the effect reflected in game.
Cheers, Omar
Z
Zaur Khadikov
said
about 6 years ago
Well thanks, i guess it was realy stupid idea to recieve the data that is already here)
Zaur Khadikov
Hi, im making a realtime multiplayer in Unreal Engine, but can't find a solution, how can i send data to server and then emidiatly recieve that data on all client including sender?
Why do you want the player to receive the same data they sent? They can just use the data locally.
If you really want to, and I don't think is a good idea, to send to the same player then you need to use RT Scripts like I showed up above.
-Send packet to server
-Let server send to all clients.
Again, what point in client sending data to server and receiving them? You're wasting bandwidth and potentially will lose packets and not see the effect reflected in game.
Cheers,
Omar
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
The send function automatically sends the packet to the server and to other clients in the session but not to the player sending it.
If you want to send a packet to the server and have the server send it to everybody then:
1- When sending the packet, the peers int array should have the int 0 in it. 0 is the address of the server. With any OpCode, for this example it'll be 99.
2- In your match's RT Script:
100 being an example OpCode. If you don't set the setTargetPeers then the server will send that packet to everyone.
However, why would you want to send the player the same packet they sent to the server? What are you trying to do?
Cheers,
Omar
Zaur Khadikov
Its kind of a turn based game where, both players can manipulate the same character in game. so i wat to send some input data to server and see the same result on both clients.
Zaur Khadikov
Zaur Khadikov
When sending data to server by seting 0 in the peers int, i did not recieve enithing on clients.
Tech Support
Hey, have you had a look at our RT example in the sample project?
It's got an example of how to do that. Here's a quick photo of sending an empty packet to all clients (Not including the sender).
Cheers,
Omar
Zaur Khadikov
Thanks Omar, Yes ive tried this method, but it seems to sends data to all peers exep for the sender.
Tech Support
Why do you want the player to receive the same data they sent? They can just use the data locally.
If you really want to, and I don't think is a good idea, to send to the same player then you need to use RT Scripts like I showed up above.
-Send packet to server
-Let server send to all clients.
Again, what point in client sending data to server and receiving them? You're wasting bandwidth and potentially will lose packets and not see the effect reflected in game.
Cheers,
Omar
Zaur Khadikov
Well thanks, i guess it was realy stupid idea to recieve the data that is already here)
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics