Persistent Time?

Hello everyone,

I’m building a Tycoon style of game using blueprints, and game play relies heavily on time. I have tried searching the net for any tutorials on timelines, but all I can find is day/night cycles. I need a system that I can call upon minutes/hours/days/months/years to be able to accurately fire off events in the game. For example I want to record data points every 24 hours, or be able to make scripted events like holidays or disasters.

Is there a function already in the engine that I can use to reference or manipulate time and attach it to scripted events?

I would seriously doubt timelines are going to be of any use in this situation. What you need is to save a current time stamp when the game is closed, load current time stamp when loading the game up again, and compare them to see how much time has passed.

The “Now” node will return the local machine’s current date/time in local format, and the “UtcNow” node will return the current local time as UTC (Coordinated Universal Time) which would personally be my choice for this. The object returned is a date time structure that can be manipulated with other nodes to get the current day, time, time since midnight, etc. Should be able to find a way to compare the two using a timespan, and then use that data to determine what should have happened during that time.

I think that he is talking about time passed within the game, not time in real life.

You can just use timers for this and then the rest is just math.Create a variable for each and every second on a timer fire off a ++ to seconds and then have minutes increment when it’s 60, hours 60, days 24, years 365 etc etc. Then you just do some checks when you want other events to happen on those particular days.