Android Question Real-time Bluetooth Multiplayer

wonder

Expert
Licensed User
Longtime User
Hey guys!! Hey @Erel! ;)

I was wondering, would it be possible and reliable to create a simple Pong game, where the 2 players compete via bluetooth in real-time, with negligible lag?

I guess the way to implement it would be a host/guest model, where the app in host mode is fed the Player 2 input and performs all the calculations before sending the data back to the second device running the app in guest mode.
Please correct me if there is a better way to do it.
 

wonder

Expert
Licensed User
Longtime User
Thank you Erel and happy holidays!!

If you have time to answer and assuming you are familiar my project (signature), do you think it's worth to pursue the implementation of multiplayer bluetooth support?
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
The implementation you are suggesting is time consuming and will double the lag time, because the host will process for himself and for the guest.. but if each one just sent it's new position and let the other process it, this way you will save time.
 
Upvote 0

wonder

Expert
Licensed User
Longtime User
The problem is the randomized behavior of the AI. Without a host the AI would have different movement patterns on each device, henceforth creating a different experience for each user in cooperative multiplayer.

However, for a simple versus match (such as a Pong game), yes... there's no need for a host/guest scheme.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
you are right, I was thinking about Ping-Pong game that you mentioned..
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
The Pong game would be a proof of concept and if it works properly, I would happily publish the source code. :)
I would then implement what I've learned in my own game.
That would be great and can't wait to read your Ping-Pong code. I will definitely benefit from it..
Some time ago I think someone posted a project like Ping-Pong, but not quite sure. but that was single player.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Did you find the single player code posted here some time ago?

edit:
Just remembered it was not Ping-Pong, but only ping.. a moving bar at the bottom of the screen that will return the ball.. the ball will return in random angle and if hit a small box will destroy it.. when all boxes are destroyed then the game is over.

something like this:
pingpong-jpg.30635
 

Attachments

  • pingpong.jpg
    pingpong.jpg
    9.1 KB · Views: 431
Last edited:
Upvote 0
Top