Skip to content

An external module (gem) for O3DE to work with time and recurring events

License

Notifications You must be signed in to change notification settings

loherangrin/addons.o3de.date-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Date & Time Gem

This extension (gem) for O3DE (Open 3D Engine) provides a set of classes and components to work with time. Its modular architecture allows to instance at runtime only what you need:

Time

  • A class to manage time in a human-readable format, such as Hours, Minutes and Seconds. It supports basic arithmetic operations on individual fields (e.g. AddMinutes, SubtractHours) or on its entirety (e.g. FromSeconds with a standard timestamp).
  • A runtime component to count time using an event-based approach. Other components in the scene can listen for time changes from it, filtering only on the required fields.
  • Different options to separate the simulation time from the real one, converting values in both directions.

Dates

  • A class to manage dates in a human-readable format, such as Year, Month and Day. It supports basic arithmetic operations on individual fields (e.g. AddMonths, SubtractYears) or on its entirety (e.g. FromSeconds with a standard timestamp).
  • A runtime component to count dates using an event-based approach. Other components in the scene can listen for date changes from it, filtering on the required fields only.
  • Designed to support different calendars (only Gregorian is implemented at the moment).

Alarms

  • A runtime component to set alarms at specific simulation instants, in order to execute code callbacks or to notify a list of entities in the scene.
  • Multiple helper classes to define how an alarm can be repeated multiple times, setting its repeating interval (e.g. Every <X> Minutes, Every <X> Months) or its end condition (e.g. For <N> Times, Not After <Y>). Date rules can be combined with time rules to achieve complex schedules of actions.
  • A convenient widget with constrained fields to assist setting alarms directly from the editor interface, without the need to write any line of code.
DateTime_Example.mp4

Install

Please choose one of the following options to install this gem in your O3DE projects:

Automatic installation

Following steps require to install O3Tanks, a version manager for O3DE to streamline the development workflow. You can find additional information at its main repository.

o3tanks install gem https://<this_repository_url>.git --as <any_name>
o3tanks add gem <any_name> --project <project_path>

Manual installation

  1. Clone this repository into a directory of your choice:
git clone https://<this_repository_url>.git <gem_dir>
  1. Register the gem to your engine, following the steps that are described in Registering Gems to a Project page of the official O3DE documentation.
  2. Activate the gem in your project, following the steps that are described in Adding and Removing Gems in a Project. You will have to look for Date & Time as gem name in the Catalog list.

Examples

A sample project showing the basic usage of this gem is located under /examples/ directory. Three different variants are available:

  • examples/cpp: implementation using C++ (native code).
  • examples/lua: implementation using Lua (scripting).
  • examples/script-canvas: implementation using ScriptCanvas (visual scripting).

You can inspect each project variant adding it to your O3DE Project Manager (at least version 2111.2 is required). Or, if you are using O3Tanks, you can even run it directly as a standalone application:

cd <gem_dir>/examples/<implementation>
o3tanks build client
o3tanks run client

Contribute

We are happy to receive your feeback! Please open an issue in our tracker if you would like to propose a new feature or you have encountered any error.

To get involved in the development of o3tanks, please refer to our contribution guidelines.

License

Date & Time Gem is licensed under the Apache License, version 2.0. Please see LICENSE and NOTICE files for further details.

About

An external module (gem) for O3DE to work with time and recurring events

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published