Sign In Register

How can we help you today?

Start a new topic
Answered

Change endTime of challenge

Is it possible to change endTime of running challenge?

Or we could create own logic to do that?


Thanks!


Best Answer

Hey Aleksey,

I'm afraid it's not possible to change the endTime of a challenge after it has been sent. You will need to start a new challenge with the correct endtTme.


Thanks,

Liam


Answer

Hey Aleksey,

I'm afraid it's not possible to change the endTime of a challenge after it has been sent. You will need to start a new challenge with the correct endtTme.


Thanks,

Liam

Since this is from 2 years ago I wanted to check if its still not possible to change the endTime of a challenge. 


What I want to do is give players a time limit in x number of days to make their move in a challenge. If they dont make their move in time then the challenge is ended, otherwise if they make a move the challenge endTime is set x number of days in advance for the other players turn.

Hi Jaayden,


It is still the case that the endTime of a challenge cannot be changed if it has already been issued. One possible work around for your use case may be to use a scheduler to schedule a module that will send a challengeWonMessage to run in X number of days, this will need to be specified in seconds. 

If the next player takes their turn within the allotted time, re-schedule the same scheduler to execute again in X number of days. Utilizing the challenegInstanceId as a key value within the Spark.getScheduler() will allow you to reset the same scheduler consistently until the desired outcome is achieved. i.e the allotted time has expired and a challengeWonMessage has been sent, or the desired outcome of your challenge has occured.

Does this method look like it might work for you?


Regards,

Ronan





Yes, it look like it is possible to time player turns with the scheduler.


The design would then be to have 1 scheduler running for every game/challenge instance. On average I would expect every active user in my game to have atleast 10 games running simultaneously as they are turn based games, so if there were 50,000 active users then there would be ~500k schedulers running. Are they designed to be used at scale like this?

Hi Jaayden,


This should be fine in regards to scalability as long as the scheduled jobs are nicely distributed, which they appear to be as they are all set to run at different times. You would run in to problems if that many scheduled jobs were to executed all at the same time, but since your games turn times etc will be sporadic with respect to execution time I believe there will be no issues with this type implementation.


Thanks,

Ronan

Login to post a comment