Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
248 views
in Technique[技术] by (71.8m points)

sockets - Real Time Multiplayer Best way for pushing updates on android

I'm currently developing a Real-Time Multiplayer top down shooter. The Multiplayer is "working" and I'm currently struggling with pushing the player updates such as position and fired shots.

My first try was using the service "appWarp" which worked perfectly but isn't free and only provided around 2 Million Messages in the free version which i completely filled in around 2 weeks with only 2 devices and 2 players. ( Maybe way to much updates send )

Then I implemented Google Play Game Services and tried using this to send the updates:

  • I'm able to use "sendUnreliableMessage" for Position updates, which works faster than appWarp used to. I use interpolation to get over the package loss issue here which works alright.

  • But here the problem is with firing shots. The nature of UnreliableMessages is that packages can get lost, which happens a lot. Shooting 4 times only makes around 1 or 2 of them appear on the other device. Which means that 2 packages are getting lost. Using "sendRealiableMessage" i can achieve around 2-3 packages getting through but with, of course a higher latency. Which makes the shots appear after around 1 second on the other device.

For a fast paced real time multiplayer game this is not what i wanted to achieve.

So what is a better way to do this ? I found web based solutions like socket.io but don't really know which fits the best for my needs.

I found this website which contains a big list of every web based solution for this problem but don't really know where to start.

https://www.leggetter.co.uk/real-time-web-technologies-guide/#_hosted-realtime-services

I am really really thankful if someone could help me with this problem!.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Since you're asking for opinion, I can suggest you try Multiplayer in Unity. It is the leading game engine as of today, so you can expect a huge support from a stupendous user-base.

Another option would be Photon. Hope these suggestions helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...