Download

In-game date/time/calendar system

*** Product released, please see this other thread. ***

This is a little system I have that is 90% finished and just wanted to gauge community interest in. The idea is to provide a structured system for working with in-game dates and times, rather than having to deal on a low level with things like GameTimeSeconds. It’s intended for any game that needs to simulate the passage of time in a persistent world.

Essentially, you first define a calendar system. You can either use the standard Gregorian calendar, or define a custom one with your own time periods - say a numbered Stardate system, or a calendar with named months/days or whatever unique to your game setting.

calendar1.png

You can then define dates/times in your calendar through a text shorthand, or by combining exists date/times with durations (also specified in your custom periods).
There is a clock object connected to your calendar, which can be scaled against realtime time progression and also paused/resumed independently of game pause if necessary.

You can register timers on the clock just like the built in UE4 timer events. You just give it the calendar date/time or custom duration when it should trigger, rather than working in realtime seconds. I’ve also extended the timer functionality to allow attaching arbitrary data to a timer event, so if you have some context information at the point you setup the timer, it will be stored with it and passed to the event node so you can access it from the event handler.

Here’s an example of registering a timer to fire on a specific date every year.

timer_example1.png

Date/time state can easily be transferred between the clock and a save game object. Network replication of clock state is also implemented.

This is just a shot of a demo setup I’m using.

demo1.png

Any thoughts appreciated.

I’d buy this but I’d want a clear example on how to hook this up to a dynamic time/day system that involves the sun going up and down. Not that you’d have to make the actual time/day system but I’d just like to see how it’s done. I believe most people who are interested in this would ask the same since the first thing they’d want to do is use it to make their sun/moon cycles work.

Absolutely, in fact I already have a quick demo setup that does that using a very basic orbiting light.
I don’t own any of the day/night systems from the marketplace so I’m not sure exactly how they expose their functionality, but it should be very straightforward. My system has a function to return the current proportional time within a given period, so for example given the period ‘Day’ on the standard calendar, 6am would give a result of 0.25, midday would be 0.5, etc. I’d imagine this would be all that was necessary to drive any night/day system.

Thanks for the feedback.

This is extremely cool, and useful. I’ve been looking into things similar to this for a game we’re working on. I would love to have something like this available to use. Just for example I would like to ask if I could setup your system with the following calendar setup - Say your year systems work in eras and years like its the “14th era year 401, 14th of march” and have 12 hours clock with daytime triggering around ~6-7am and nighttime ~8-9pm? It would be really cool to be able to setup seasons, so that dusk is later or earlier during certain times of the year, and you could trigger snow and things like that. Oh also I just thought of something else, could you set a year to be say only 100 days, like set the length of years months hours days and such to a custom amount… that is without much changing of your day cycle timings. Anyway it’d be really cool if you could get back with me, I know its a year later hopefully you’ve got some improvements…

Hi, I’ve posted a response in the product’s released thread in order to keep things in one place. I’ll get a moderator to close this thread so if you have any further questions, please post them there, or on my website which is linked from the other thread. Cheers.