GS2-Schedule
It provides the ability to manage schedules for in-game events and other events.
Since this microservice does not function by itself, it is assumed to be used in conjunction with other microservices.
There is a mechanism called “trigger” to realize relative periods. After executing a trigger, the specified period (ttl) is treated as the duration of the event.
Absolute period
This type of period is used for cases such as “New Year’s event will be held from January 1 to January 3.
Relative period
“Relative period” is used in cases where the event duration differs from player to player, such as “1 week from the start of the game” or “24 hours after the first boss is defeated”.
There is a “trigger” mechanism to achieve relative periods. The specified period after the trigger is pulled is processed as the event period.
Types of triggers to pull
When pulling a trigger, there are two types of ways to specify the event duration if the trigger has already been pulled.
- Restart the trigger (renew)
- Do nothing (drop)
If a trigger is pulled at 00:00 on January 1, 2020 and a 7-day relative duration event is started, when the trigger is pulled again at 00:00 on January 3, 2020, each action will be as follows.
Method | Event End Date and Time | |
---|---|---|
renew | January 10, 2020 00:00 | Add 7 days at the time of trigger activation January 3, 2020 00:00 |
drop | January 7, 2020 00:00 |
Example implementation
Trigger Pulling
Triggering cannot be handled by the game engine SDK.
Please implement it in the GS2 account creation script or as a reward for completing the GS2 quest.
Obtaining a list of current events
var items = await gs2.Schedule.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).EventsAsync(
).ToListAsync();
const auto Domain = Gs2->Schedule->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->Events(
);
for (auto Item : *It)
{
}