Working on a time system, and I'd like a bit of help

I know you all have heard this before, but here I am working on a time system for my game. I got curious, though, and wondered if I could use IRL time as the in-game time system. I tried experimenting with it but I’ve got nothing so far.

Anybody got any tips?

1 Like

What will the time system affect in the game? If it affects more than just flavor, remember that people might not be able to play your game at exactly the right moment.

1 Like

@moderators, please move this to Authoring: Twine

At the moment, I just want to see if it’s possible. At most, it’d affect a few events based on the time of day, but otherwise, that’s it.

1 Like

It is possible with some JavaScript (the whole Date global object). IIRC someone attempted it on the Twine Discord server, with some success.
SugarCube is based on JavaScript, and can use all of the JavaScript library if needed.

HOWEVER: if time has an impact on the story (stuff only available at night/morning), you will need to take into account that not everyone lives in the same timezone (there’s a difference between local and UTC Date in JavaScript), nor would they be able to open the game in those specific time (like limiting an object to drop only at midnight).

If your story already includes a day/night system (like you do a quest in the in-game morning and when you’re done it’s supposed to be in-game evening), I would suggest creating a date-system in-game (like with this custom macro.

Hope this helps!

It did help. Thank you for everything!

Truth be told, though, I’ll probably just do a self-contained time system/