I’m working on an Android app for learning purposes. In particular, I’d like to learn the best method to sync a boolean state between multiple instances of this app running on separate devices.
What exactly is my app so far? The app is called Coin Flip. You can download the project here on DropCanvas. It simply has an image of a coin heads-up, over a white background. Tap on it, and it will change to be tails-up (a different sprite). Tap again, and it will go back to heads. It always alternates to the other face when tapped. Clearly this is a basic demonstration of a toggle-able boolean state.
Let’s say I build my app to my brother’s Android, as well as my own. What I’d like to happen is have his coin’s facing stay in sync with my coin’s facing, such that we are flipping the same coin. Ideally, at least 16 people could all have the app installed and we’d all be in sync when connected to the internet, flipping the same virtual coin.
I’ve done some research into Unity’s multiplayer possibilities, and I have to say I’m a bit overwhelmed. The Unity HLAPI (High Level API) seems focused on player GameObjects and only synchronizing those in particular. I’ve also seen the Photon plugin. Then there’s the possibility of using a database such as through Azure, AWS, Redis… but I haven’t done that before and I’d like to stay within Unity functionalities – and stay free – if at all possible.
Considering that in the future my actual app (since this is just a proof of concept) might contain a 100 by 100 grid of “coins”, I would probably need to synchronize a 2-dimensional array of booleans.
So my question is, what route would you recommend for this multiplayer scenario? And does the recommendation change when considering 100x100 coins instead of a single coin?
Issues I predict are:
• how to handle latency between flips – players could end up physically tapping at the same time, while virtually they see opposite coin sides
• how to deal with players trying to flip when they aren’t connected to the internet