Sample to use UDP based methods in AppWarp

0 votes

Hello,

     I was wondering whether we have any sample available based on UDP messages. I got to know that we have to use initUDP(), before using sendUdpUpdate method, or similar methods. It is also written in the doc that it is not reliable over cellular network, my guess is we should use UDP way only for realtime multiplayer gaming, but how is it safe to use it?

 

    i need some guidance, whether I am in correct path or, not.

 

Thanks.

asked Jan 31, 2015 in AppWarp by veda.in (28 points)

1 Answer

+1 vote
 
Best answer
Hi,
 
UDP is unreliable by nature. But only because of this behaviour its faster than TCP. Also UDP is not supported by some networks. Therefore we introduced initUDP method. initUDP allows you to check if UDP is available or not. But being available will not make it 100% reliable. Although UDP works perfectly in most of the cases, it's just you can not be 100% sure about it.
 
Best way is to use mix of both TCP and UDP. You can send critical events on TCP and less critical events on UDP. Suppose in your game two players are moving. You can send positions of both players on UDP because even if a message is missed next message will give the updated position. But when player A shoots player B this message should be exchanged over TCP because if this message is missed you won't get it again.
 
We do have a sample on UDP and a walkthrough guide. You can read it here http://blogs.shephertz.com/2013/10/17/create-udp-based-multiplayer-game-using-appwarp/
 
Thanks
answered Feb 1, 2015 by Suyash Mohan (900 points)
selected Mar 10, 2015 by veda.in
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...