Jump to: navigation, search


Time may refer to:

Accessing the current time/date via the SYSTEM.TIME.NOW system variable.
Time values on clients are synchronized to the Area server time.
The data type for fields and variables, which holds a specific point in time.
The data type for fields and variables, which covers a duration of time.
Some animation-related functions.
Syntax for time-related parameters in asset properties, and description of the Timeline GUI.
How to get HSL calls at regular specified intervals.
Setting the time of day and associated lighting and weather in a gameworld

Time FAQ

What is the maximum resolution for Time in HeroEngine?

Time is one of those very tricky subjects about which there are entire articles written, from HeroScript the maximum resolution supported is approximately 15 milliseconds(as seen in SYSTEM.TIME.RAW). Ultimately, we may choose to switch SYSTEM.TIME.RAW to utilize multimedia timers (or the linux equivalent when talking about servers running on linux) which would give us a resolution of approximately 1 millisecond. Tracking time at even greater resolution requires even greater trickery using QueryPerformanceCounter...which has a hardware dependent resolution, the profiling external functions use the QueryPerformanceCounter to achieve their resolution.

So....the greatest resolution you can get using SYSTEM.TIME.* is around the 15 millisecond resolution (using RAW), if it takes less than 15 milliseconds then it'll appear as 0.

SYSTEM.TIME.NOW is only updated at the beginning of script invocation to provide fast access to a date time.

How do you keep track of when something happened?

When the event occurs, save the value of the system variable SYSTEM.TIME.NOW in a field of the DateTime datatype. The system variable SYSTEM.TIME.NOW is set once per frame on the client, using synchronized time.

How do you keep track of when something should happen?

This can be done in one of two ways:

How do you measure how long something took?

Use a timestamp at the beginning and end of the event that you wish to measure. The exact system for doing this, may depend on the length of time involved and/or the accuracy desired.

For long time intervals (10 seconds or more), try saving the begin and end values of SYSTEM.TIME.NOW into a DateTime variable, and compute things manually, which results in a value of the TimeInterval datatype. See DateTime for sample code. This is nice for longer intervals because you get to use the strong typing to avoid any confusion about the units.

For shorter time intervals, use the system variable SYSTEM.TIME.RAW, which measures time in microseconds, and is not synchronized between client and server. This can only be used within a single process, and not between different processes.

What is synchronized time?

Clients have their clocks automatically synchronized to the Area server clock they are logged into. For details, see: Synchronized Time.

See also

Personal tools