A downloadable tool

Buy Now$2.99 USD or more

Illusory Engine Server Clock

Introduction

There has been something that disturbs us whenever we try to implement a Daily Login system or anything that is tied to time in Unity. There's of course, the solution to just hook the machine's time.

This, however, leads to a very serious issue: Player can alter their internal clock and the game will get bugged up. The only way to resolve this is to accurately deduce the time through a server-sided time, thus preventing local time modifications from affecting a game (or other products) made in Unity.

With this in mind, we decided to create the Illusory Engine Server Clock as part of our future plan for an engine named Illusory Engine. While the engine might take months if not years before it has potential for public use, we believe that parts of it should be available to the community as we progress.


What do you get?

With the price, you received a .unitypackage that can easily be imported into your game. 

To use our Illusory Engine Server Clock, we provide a prefab that just needs to be placed on the first game scene. With our Singleton approach, you can make your code remains object-oriented and still get the full benefit of our Illusory Engine Server Clock.

There's no need to touch codes inside the Server Clock folder. 

DEFAULT SERVER TIME IS SET TO JAKARTA/INDONESIA (GMT+7). Check  'Use Own Server' if you need to have it in your local timezone. We are considering having something to allow the support of multiple timezones without much hassle in the future.


API List

public DateTime GetServerDTDate(): Retrieves a DateTime version of the server's date.

public DateTime GetServerDTDateTime(): Retrieves a DateTime version of the server's date and time.

public DateTime GetServerDTTime(): Retrieves a DateTime version of the server's time.

public string GetServerStringDate(): Retrieves a string version of the server's date.

public string GetServerStringDateTime(): Retrieves a string version of the server's date and time.

public string GetServerStringTime(): Retrieves a string version of the server's time.

public bool IsServerClockReady(): Checks if the server clock is ready to use.

public void UpdateWorldClock(): Request again to the server for an update of the clock.


Example Usage

Before using Illusory Engine Server Clock, make sure to put the prefab in your first game scene (if you have multiple scenes used for your game). This will allow the system to load-up and becomes available to all of your codes.

This example will show the current time in a TextMeshProUGUI object if it's available. It also shows debug logs of both DT and String variant of date and time.

The result of this code in work is shown as this page's gif.


Use Own Server

If you wish to use your own server, you can use our PHP script and then edit the Server Clock class to pinpoint your server. This can be done by changing the URL used in said class.

To change the timezone, you need to alter the PHP files' line. Specifically, this line:

 date_default_timezone_set('Asia/Jakarta');

Here is a list of available timezones.


EndNote

If you have any problems in getting this to work with your project feel free to contact us at Discord. We have a #unitypackage-support channel there. You can also contact our coders at the server as well.

Purchase

Buy Now$2.99 USD or more

In order to download this tool you must purchase it at or above the minimum price of $2.99 USD. You will get access to the following files:

IllusoryEngineServerClock.unitypackage 1 kB
UnityServerClock.php 161 bytes

Development log

Leave a comment

Log in with itch.io to leave a comment.