Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7975299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:36:38+00:00 2026-06-04T08:36:38+00:00

I’m doing a turn based game… the only information transferred is the score of

  • 0

I’m doing a turn based game… the only information transferred is the score of the player and whether a turn has been sent.

When the next player receives the turn. The data gets stored into “scoreToBeat” and turnSent=1. The player then takes their turn. Afterward the game ended gets called because turnSent=1. I used the turn based tutorial by Ray Wenderlich at http://www.raywenderlich.com/5480/beginning-turn-based-gaming-with-ios-5-part-1.

In his case the game ends and is a tie. Like this… I can’t seem to get it to show the person that lost.

   for (GKTurnBasedParticipant *part in currentMatch.participants) {           
          part.matchOutcome = GKTurnBasedMatchOutcomeTied;
           }

I can’t seem to get it to show the person that lost it always shows a win. This is my latest attempt of many… Exactly 2 players in the match btw… Any ideas would be greatly appreciated.

    for (GKTurnBasedParticipant *part in currentMatch.participants) {           
           if(part==currentMatch.currentParticipant)
           {
               if(points>scoreToBeat)
               {
                   part.matchOutcome=GKTurnBasedMatchOutcomeWon;   
               }
               else {
                   part.matchOutcome=GKTurnBasedMatchOutcomeLost;
               }
           }
           else {
               if(points>scoreToBeat)
               {
                   part.matchOutcome=GKTurnBasedMatchOutcomeLost;   
               }
               else {
                   part.matchOutcome=GKTurnBasedMatchOutcomeWon;
               }

           }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:36:39+00:00Added an answer on June 4, 2026 at 8:36 am

    This is an excerpt from my latest project, good for a 2 player game. It’s called during the sendTurn process, when the game is decided to be ending. This is more correct than the previous answer (first code block), in my opinion, because you must set the matchOutcome for all participants before ending the game.

    If you had more than 2 players, then you’d have to loop through all participants and set the matchOutcome accordingly.

       GKTurnBasedParticipant *curr = currentMatch.currentParticipant;
        NSUInteger currentIndex = [currentMatch.participants indexOfObject:currentMatch.currentParticipant];
        NSUInteger nextIndex = (currentIndex + 1) % [currentMatch.participants count];
        GKTurnBasedParticipant *next = [currentMatch.participants objectAtIndex:nextIndex];
    
        if (currScore < otherScore)
        {
            // Curr player lost
            curr.matchOutcome = GKTurnBasedMatchOutcomeLost;
            next.matchOutcome = GKTurnBasedMatchOutcomeWon;
        }
        else if (currScore == otherScore)
        {
            // Tied
            curr.matchOutcome = GKTurnBasedMatchOutcomeTied;
            next.matchOutcome = GKTurnBasedMatchOutcomeTied;
        }
        else 
        {
            // Won
            curr.matchOutcome = GKTurnBasedMatchOutcomeWon;
            next.matchOutcome = GKTurnBasedMatchOutcomeLost;
        }
    

    Note that you will see “Won” on both devices by design.

    One will say “Me” with “Won” underneath, and the other will say “(Winners Name)” with “Won” underneath.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing a 2D turn based RTS game with 32x32 tiles (400-500 tiles per
I've got a medium scale project (a turn-based game) that's currently written in C/C++.
I'm making a Turn-Based game, and trying to figure out when the last turn
I'm making a turn based game, and trying to construct the matching function, when
I'm making a very simple turn based battle game using ActionScript 2.0. I'm VERY
I'm making a turn based rpg game with some multiplayer functions using GAE. I
I'm working on a turn based board game for iPhone and eventually Android. I'm
Doing my first SL4 MVVM RIA based application and i ran into the following
I want to turn auto-correction on/off based on the content in the text field.
I'm creating a web-based online game and am trying to find the best fit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.