I am porting my game Buggy Bang! Bang! to Android. The leaderboard/matchmaking in Android has no NDK support and looks complicated. So I think I will need to roll my own online game lobby. I've written a leaderboard service before, in Python, for some of my earliest iOS games. It worked pretty well, except for the unreliable web hosting I have, causing outages of the leaderboards. Writing a lobby should not be much more difficult than a leaderboard service. I will write down my thoughts in this weblog.
- I think this can be done based on UDP, to avoid managing connections.
- When a client wants to setup an online game, it could send a datagram with its gamer tag and IP to the lobby server.
- The lobby server can then respond when a second client sends a similar datagram, and create a match up between the two.
- It would send the IP and tag name of each to the other, so that from then on, the match can be played peer to peer.
- I would still need unique gamer tags. Where to get this? Use google plus account names?
- Alternatively, I could have the server assign unique IDs for the first time a client connects, and cache the ID in the client for use with subsequent sessions. Then I could just skip the gamer tag altogether and make the ID user-facing. If the ID increments from 1, it may become a form of pride, like low digit slashdot user IDs.
- What about NAT?
For nat, see hole pnching.
ReplyDeletehttp://en.m.wikipedia.org/wiki/UDP_hole_punching