I’m trying to make a multiplayer game for the first time on Android. I have now come to the point where the different objects that is going to be drawen on the screen should be the same on all the devices that are have joined a game-session. I have thought of three different solutiuons:
- Socket programming where a master devices/host is responsible for sending out/storing information about coordinates send it to the other devices.
- Socket programming where all devices sends coordinate information to each other.
- A server that stores coordinates information from the devices and distribute it to the devices.
Which of these methods seems as the best solutions for my purpose. Or are there even better methods that I haven’t thought about?
Remember that most if not all of your users are running on a battery hungry devices, using a mobile network, which are usually (sometimes?) capped or have a cost-per-byte.
Using a peer-to-peer, either with one of the peers serving as a host, or all being equals, would cause them to use more power from the battery, and bytes from the network. With the 1st solution punishing one of the users more, and the 2nd punishing them all equally, albeit probably to a lesser extent than using one device as a host would.
Using a server trades the users’ costs in battery and network with your cost of running the server.
But it would cost you much less than it’d cost the users, and would keep the users happy with your game a hundred times more† than they would if they found out it also costs in data and battery.
† Assuming the game is fun in the first place.