I would like to create a multiplayer mobile game where players play together over an ad-hoc network, with no internet connection required. Players should be able to join and leave mid-game, and the game should not rely on a "host" device being online.

How can I coordinate game state across multiple devices in an ad-hoc network and allow any player to join and leave mid-game?

closed as too broad by gnat, Bart van Ingen Schenau, Robert Harvey, amon, user22815 Jan 17 '17 at 19:28

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Is it possible to make your question a little bit more focussed, and also remove anything from it which looks like a request for helping to find an existing library? In the current form, it is likely the community here will close it either as too broad, or because of the fact requests for third-party resources are off-topic for this site. – Doc Brown Jan 14 '17 at 7:41
  • @DocBrown Absolutely, I've edited it. Let me know if this is on-topic or still needs improvement in any areas. – Eric Jan 17 '17 at 19:27
  • I am pretty sure as long as your question contains parts like "which language to use", or if someone can tell if there exists library for your case, the community will not reopen it. This meta post may help you to understand which topics people here consider as beeing too broad. – Doc Brown Jan 17 '17 at 19:36
  • ... however, I "smell" a good question inside your post - the part about manage mobile multiplayer game state. By removing most or all of your "related concerns", the chances to get the question reopened might increase heavily. – Doc Brown Jan 17 '17 at 19:41
  • I think I've changed the question so that it "can be answered in a few paragraphs," as requested by the hold message. – Eric Jan 17 '17 at 20:07

What I would try for your case is to use a distributed database approach, shared among all players. Any "state machine" could be mapped to a database, and for a simple cards game the database will probably be so small you can replicate it quickly whenever a new player arrives.

For mobile devices, your know surely there are lots of db systems available, the most popular might be sqlite, and in this former SO post you find some different approaches how to replicate sqlite databases among different sites.

Not the answer you're looking for? Browse other questions tagged or ask your own question.