-
Notifications
You must be signed in to change notification settings - Fork 84
Date
Dates are specified as a string in the format of y/m/w
(year, month, week) = for example 13/2/3
.
Based on the game settings Game Dev Tycoon can run in different game length modes:
game length | gameLengthModifier |
---|---|
30 years | 1 |
35 years (default game length) | 1.16667 |
42 years | 1.4 |
By default, the game runs for 35 years which, for historical reasons, is implemented by setting the gameLengthModifier
to 1.16667.
You don't have to worry about the modifier in code but when defining dates on an event (GDT.addEvent) for example, you need to be aware that all dates in code are based on a gameLengthModifier
of 1. This means that if you define a date as 30/1/1
and a player is playing with the default game length setting, the event will actually fire on 35/1/1
. If the player would play the 42 year version it would fire on 42/1/1
. (You can disable this for events by setting the event.ignoreGameLengthModifier
to true.)
In story events there are often situations where a future event is announced. Example:
Today, Ninvento has confirmed recent rumours and announced their plans to release a new home gaming console called 'TES' in two months.
Since the time span of when this actually happens depends on the gameLengthModifier
this is not hard-coded but rather a convenience method called General.getETADescription(now, target)
is used.
Code example:
"Today, Ninvento has confirmed recent rumours and announced their plans to release a new home gaming console called 'TES' {0}.\nThe console features cartridge based games and a uniquely designed controller.".localize("{0} is date referral sentence fragment").format(General.getETADescription('1/10/2', '2/1/2'))
General.getETADescription
takes two dates, first the date when the message is shown and second, a date that is referred to in the text. The method will return a sentence fragment like 'later this month', 'in two months' or 'later next year', as appropriate. This is a frequent technique used in story events relating to platform releases and should be used whenever referring to a future events when the event itself does not use event.ignoreGameLengthModifier
.