im migrating my game servers from my custom AWS Structure to GameSpark and have some questions about the functionality.
1. What is the difference between EndDate and ExpiryDate ?
2. I got 5 turns each per Challenge, and each player has 24hours to complete 1 turn, is that what expiryDate is for ? How can i extend the expiryDate by 24hours ?
3. I want to send a Notification to the Player when there is only 1 hour left after the match expires. I would realise that as follows :
3.1 Player A makes a turn and fires a SparkScheduler with the needed Information (ID from the other Player).
3.2 If the Scheduler times runs out, i check if the other player allrdy made his move, if yes, ill just skip the code, if not, ill fire a Push Notification to Player B
Is that a good approach or is there a simpler solution ?
Have a nice day !
1. The EndTime is when a challenge will finish; once this is reached a winner will be decided and no more turns can be taken. The ExpiryTime is a time between your creating a challenge and the StartTime you set for it. It dictates the latest time at which your challenge can be joined (the challenge will change state from 'ISSUED' to 'WAITING', after which it cannot be joined).
2. Probably the best way to achieve this would be to store the deadline for the next move against the challenge itself (updating the value when a turn is made), then checking it in one of our system scripts (say, in our 'Every Hour' script, for example).
3. Yes, the SparkScheduler would be a good approach to take here. Though rather than waiting for the scheduler to expire before checking if the turn has been made, you could cancel the scheduler (using a key you provide to identify it - again this key could be stored against the challenge) when a player takes their turn, preventing the scheduled code from being executed.
If you need any more detail on how to implement any of this, please don't hesitate to get in touch.
Hello Vinnie and thanks for your answer !
1. You made it very clear !
2. For my understanding, the every Hour script would run in no user context. So what would be a good approach to handle that in the script ? How can i do a bulk job over each challenge ?
3. Thank you that made it clear !
Maybe i should specify my problem more:
I want to look over each challenge that has a specific key set to his scriptData.
When the scriptData meets some criteria, it should run some piece of code.
So how do i get all those challenges in the every hour script and run some code for each of those ?