Sign In Register

How can we help you today?

Start a new topic
Answered

League Board KOT Style

I didn't want to thread necro(https://support.gamesparks.net/support/discussions/topics/1000075689), and I do have more questions. I'm working on setting up a King of Thieves style league board.


So here are my working requirements/questions

1. Dynamic number of league boards.

Each player has a league rank(1-9 for now). The player joins a 20-50(league rank dependent) member league based on their league rank. So 100 league rank 1 players will end up creating 4 league boards of that rank. Where as 300 league rank 2 players will end up creating 12 boards. The prior thread doesn't to me clarify this question.


2. Customized timing

I want to create the "season" at a variable amount of days. The current league options only present preset periods of time. Low rank rank leagues are 2/3 days, where as top leagues will be 7 days.


3. Rewarding and Processing

What would be the process to handle the processing of our customized timing. If capable of doing so. We need custom processing at the end to change the players league rank. I assume there is an event already, but those would seem linked to the pre defined time. 


4. Clearing

If we can control the time. How do we clear the league board.


5. ChallengeID

As proposed in the linked thread. How would we apply the challenge id's to leagueboards?


6. Is there a way to filter submitted scores

Is there way to filter say the top 10 scores a player submits.



Best Answer

Hi Jason,


Yes the challenge leaderboards should do the trick here. You could play around with the time set up so that leagues that were created 3 days into the 7 day run only ran for 4 days so they all ended at the same time. That would be up to designers to decide but you can set the end time to whatever suits in the challenge.


For a player to be able to submit multiple scores to a single leaderboard and custom ID must be attached to each score so they can be differentiated. I've set up a basic example to show this for you below.


Event Config.


AFb6lTiAiPmNOEXtVW2w7DzMrZ5sMrMUXg.png


Leaderboard Config


8OO0EjEkMGti1q-jD7ETRW8p4aqwPnf9rQ.png


Next you can some submit some score but make sure the ID fields are different. For mine I sent a score of 505 with and ID of 1 and 501 with an ID of 2. Then I sent a LeaderBoardEntriesRequest. This will return an array of leaderboard entries that the player has in the given leaderboard. So in my case I got this response.


{
 "@class": ".LeaderboardsEntriesResponse",
 "ID_LB": [
  {
   "userId": "5800f32a8b146964b4b4038f",
   "score": 505,
   "ID": "1",
   "when": "2016-12-12T18:35Z",
   "city": null,
   "country": "IE",
   "userName": "Liam",
   "externalIds": {},
   "rank": 2
  },
  {
   "userId": "5800f32a8b146964b4b4038f",
   "score": 501,
   "ID": "2",
   "when": "2016-12-12T18:34Z",
   "city": null,
   "country": "IE",
   "userName": "Liam",
   "externalIds": {},
   "rank": 3
  }
 ]
}


Yes you can send Request on behalf of other players. You can use a SparkRequest to do this. I'll show you an example using the event I created above.


  

var request = new SparkRequests.LogEventRequest();
request.eventKey = "postScore_ID";
request.score = score;
request.ID = ID

//sendAs is important here. This will send the request for the given playerId
var response = request.SendAs(playerdId)


//just to note you can also use "ExecuteAs()" here, this will send the request as the given player and execute any Cloud code attached to that event. As my event doesn't have any Cloud code attached, SendAs() will suffice here.

  


Try that out and let us know if you have any further questions.


Thanks,

Liam


Hi Jason,


Our Score Based Challenges guide may be of use to you here. With these set up correctly the endTime of the challenge can be customised and set to whatever suits your needs. Is a season a period of time between two specific dates ? Or when a challenge is initiated does it run for a full season length, 3 or 7 days depending on rank ? If you use challenge leaderboards the leaderboard will be associated with the created challenge and the challengeID can be used to retrieved using the leaderboard for that challenge with a LeaderboardDataRequest. You can drop a leaderboard in Cloud Code using SparkLeaderboards drop method. Point number 6. Is this to retrieve the top 10 scores a player has submitted to a single leaderboard or for all ? If you have any further questions just let us know.


Thanks,

Liam

Thank you for the response. This is very promising 


"Is a season a period of time between two specific dates ?"

The time periods are sequential. We are aiming to have some league boards last 3 days, where as some boards will last 7. After x days we process the leaderboard/challenge and send the results. Then a new league starts for the next "season", we would probably want a few hours of down time before the next league starts, but that's flexible.


The idea of specific periods of time is something our game designers have talked about. With some day the plan to have weekend tournaments, but not our target right now.



Point number 6. Is this to retrieve the top 10 scores a player has submitted to a single leaderboard or for all ?

Yes, top 10 for that leaderboard only.


I do have one more question to add to these.

Is there a way to submit a score for a player that isn't the client. At the end of a match the results are sent to a gamesparks callback  end_match_battle_process by our real time game server(not the client). We would like to submit the score at this point rather than from client. If it's possible.

Answer

Hi Jason,


Yes the challenge leaderboards should do the trick here. You could play around with the time set up so that leagues that were created 3 days into the 7 day run only ran for 4 days so they all ended at the same time. That would be up to designers to decide but you can set the end time to whatever suits in the challenge.


For a player to be able to submit multiple scores to a single leaderboard and custom ID must be attached to each score so they can be differentiated. I've set up a basic example to show this for you below.


Event Config.


AFb6lTiAiPmNOEXtVW2w7DzMrZ5sMrMUXg.png


Leaderboard Config


8OO0EjEkMGti1q-jD7ETRW8p4aqwPnf9rQ.png


Next you can some submit some score but make sure the ID fields are different. For mine I sent a score of 505 with and ID of 1 and 501 with an ID of 2. Then I sent a LeaderBoardEntriesRequest. This will return an array of leaderboard entries that the player has in the given leaderboard. So in my case I got this response.


{
 "@class": ".LeaderboardsEntriesResponse",
 "ID_LB": [
  {
   "userId": "5800f32a8b146964b4b4038f",
   "score": 505,
   "ID": "1",
   "when": "2016-12-12T18:35Z",
   "city": null,
   "country": "IE",
   "userName": "Liam",
   "externalIds": {},
   "rank": 2
  },
  {
   "userId": "5800f32a8b146964b4b4038f",
   "score": 501,
   "ID": "2",
   "when": "2016-12-12T18:34Z",
   "city": null,
   "country": "IE",
   "userName": "Liam",
   "externalIds": {},
   "rank": 3
  }
 ]
}


Yes you can send Request on behalf of other players. You can use a SparkRequest to do this. I'll show you an example using the event I created above.


  

var request = new SparkRequests.LogEventRequest();
request.eventKey = "postScore_ID";
request.score = score;
request.ID = ID

//sendAs is important here. This will send the request for the given playerId
var response = request.SendAs(playerdId)


//just to note you can also use "ExecuteAs()" here, this will send the request as the given player and execute any Cloud code attached to that event. As my event doesn't have any Cloud code attached, SendAs() will suffice here.

  


Try that out and let us know if you have any further questions.


Thanks,

Liam


1 person likes this

Yes, thank you so much. We were looking at manually doing leader board documents, and having to process them, but all your responses have been very helpful. If we have and I'm sure we will, I will then ask them. Thanks Liam, Thmubs up in my book.

Hi Jason,


No problem, will be here to assist if you have any further questions.


Thanks,

Liam

Hi Liam, I'm also working with Jason on this project. I'm fairly new to Gamesparks and wanted to ask:

For this, is there a way to trigger cloud code when a challenge ends? Or would I need to manually process the state of the challenge associated to each player?  I want to process the results of the league when it ends and inform the players. 


Thanks,

Cameron

Hi Cameron,


The winner of the Challenge will receive a ChallengeWonMessage. If you navigate to Cloud Code>Global Messages>ChallengeWonMessage you can place your custom code in there for additional processing on challenge end. You could also place similar code in the Global ChallengeDrawnMessage to handle a drawn challenge. If you have any further questions just let us know.


Regards,

Liam


Login to post a comment