Asynchronous simultaneous turn-based play in Game Center?

Discussion in 'Public Game Developers Forum' started by Adams Immersive, Nov 9, 2012.

  1. Adams Immersive

    Adams Immersive Well-Known Member
    Patreon Bronze

    Dec 5, 2008
    1,718
    5
    38
    Freelance interactive design and programming
    Ohio
    Does Game Center’s asynchronous turn-based multiplayer support allow both players to submit turns simultaneously instead of alternately? In other words, Game Center would advance the game and send the notification only after both players have transmitted their turn. Then, EITHER player would be allowed to submit the next turn immediately—neither has to wait for the other.

    Kil-A-Ton is an example of simultaneous turn-based play (but it’s not Game Center).

    Thanks in advance! I have some simultaneous game ideas that wouldn’t be practical (for a team of me!) without Game Center on the back end.
     
  2. DemonJim

    DemonJim Well-Known Member

    Nov 19, 2010
    416
    5
    18
    App Developer
    UK
    Nope - in Game Center's turn-based API only one player can ever affect the state of play. Even if somebody resigns the player who's turn it is has to actually view it for the game state be affected.

    You can pass the turn back to yourself (to update other players 'mid-turn') as I do in my game, but this has its own woes - especially when you're signed into multiple devices (constant alerts about your own moves!). I've requested Apple don't show alerts from yourself as a bug report but clearly if mine is the only game that would benefit from this I understand they don't see it as a priority :)
     
  3. Adams Immersive

    Adams Immersive Well-Known Member
    Patreon Bronze

    Dec 5, 2008
    1,718
    5
    38
    Freelance interactive design and programming
    Ohio
    Thanks for the info!

    Too bad—but by the time I get around to making such a game maybe there will be new options.
     
  4. influx

    influx Well-Known Member

    Aug 12, 2012
    127
    28
    28
    Male
    Developer
    Sydney, Australia
    As he said above, game center won't support it. In my upcoming title RoboArena I'm implementing simul turn based via game center but have to either do a clunky turn based thing which I didn't like, or make it just regular peer to peer networked (I'm envisaging short gaming sessions rather than long ones).

    I actually spent a whole month writing my own server via google app engine and push notifications through an AWS instance but in the end I think it was inferior to just natively supporting GC.

    Hope that helps!
     
  5. Adams Immersive

    Adams Immersive Well-Known Member
    Patreon Bronze

    Dec 5, 2008
    1,718
    5
    38
    Freelance interactive design and programming
    Ohio
    #5 Adams Immersive, Nov 12, 2012
    Last edited: Nov 12, 2012
    A peer to peer realtime connection is probably the best GC solution for some games. Good luck with RoboArena!

    At the same time, I like the “play at your own pace” low-pressure nature of asynch.

    Here’s a crazy workaround idea, just thinking out loud, to make GC act like it supports simultaneous turns:

    1. Have each game be TWO games in GC. (Filter the games list so the user only sees one copy.)

    2. So when you start a match, the app actually starts TWO matches: one with the first player (alphabetical?) going first, and one with the other player going first). This is all internal and hidden of course.

    3. So, right from the start BOTH players are able to take a turn.

    4. When you take a turn, your turn is also remembered for later—for the time when the other game comes around to you. Then your turn is sent a second time, automatically, keeping both “version” in synch.

    5. The app will not proceed until both “versions” are ready for the next turn (meaning, both players are now allowed to play). Repeat from Step 2.

    6. Downside: the need for two turn alerts to arrive? But maybe it’s worth it for the added speed/convenience of simultaneous turns.

    Doable? Can an app start TWO games from ONE single random GC pairing? Even if it meant both players saw an invitation they had to accept (despite both having already requested a random matchup) that would be OK.

    I’m thinking it would work this way from the player’s perspectives. In this example, you’re the one who happened to play first:

    1. You submit your turn and get back to your life (if any).

    2. Your opponent gets an alert that you have taken your turn, but responding to the alert won’t let them see it: they must submit THEIR turn first. (The app, not GameCenter, enforces the “hiding” of the game so you don’t get a sneak peek at enemy moves.)

    3. Once they play, they can now see your turn plus their turn and are allowed to submit a future turn too.

    4. An alert comes in that your opponent has played. When you respond to the alert, the app now has BOTH turns and can proceed: you can now play a future turn too.

    5. Invisibly, your previous turn has been sent again (as soon as you respond to the alert) to the other version of the game: the version that allowed the other player to play without waiting for you.

    6. Unfortunately, they now get an extra alert, for a turn that has already been dealt with. And they must respond to the alert: they must launch the app so that their turn can be sent to the other version. But hopefully, with proper wording of the alert, it wouldn’t bee too confusing.

    Not ideal, I know.

    OK: 7. Apple sees what a mess that is and adds simultaneous turn support :)

    I’ll keep plugging away at my single-player game for now, but I’d love to do a multiplayer game sometime as well.
     

Share This Page