In other languages: Česky Deutsch Español Français 日本語 한국어 Nederlands Polska Português do Brasil Русский 中文

Time: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
m (Applying capitalization rules)
(merged game-day, game-second and game-tick into the page)
Line 1: Line 1:
{{Languages}}
{{Languages}}__NOTOC__
[[File:Time.png|128px|left]]
[[File:Time.png|128px|left]]
The concept of '''Time''' in Factorio is used for many different implements, most notably crafting time and game time.


The concept of ''Time'' in Factorio is used for many different implements, most notably crafting time and game time. When hovering over an item recipe, the player may see a clock symbol and a number. This is the amount of time needed to craft the item in [[Game-second|game seconds]]. [[Assembling machine|Assembling machines]] have a multiplier that determines their crafting speed. [[Module|Modules]] may also affect crafting time, either speeding it up or slowing it down for some other benefit. The player, when handcrafting, crafts with a multiplier of 1, so items that claim to take 10 seconds to craft will take 10 seconds, but an [[assembling machine 1]] with a multiplier of 0.5 will take 20 seconds. It is important to take this into consideration when creating setups with proper ratios.
== Crafting time and speed ==
When hovering over an item recipe, the player may see a clock symbol and a number. This is the amount of time needed to craft the item in seconds at crafting speed 1. The player always crafts at speed 1 while [[assembling machine]]s have different crafting speeds. [[Module]]s may also affect crafting time, either speeding it up or slowing it down for some other benefit. The player, when handcrafting, crafts with a multiplier of 1, so items that claim to take 10 seconds to craft will take 10 seconds, but an [[assembling machine 1]] with a multiplier of 0.5 will take 20 seconds. It is important to take this into consideration when creating setups with proper ratios.{{clear}}


Time in Factorio may also refer to:
== Ticks ==
The base unit of all time inside Factorio. When running at game speed 1, there should always be 60 ticks in every real-time second leading to the figure of 60 updates per second, short UPS. This means that 1 tick should ideally always take 1/60th of a real-time second (0.01667 seconds). However, it is possible to change the [http://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.speed game speed] using mods or console commands, so it is possible that ticks don't take 0.01667 real-time seconds. Furthermore, game speed will automatically slow down when the computer that is running the game is unable to do all needed calculations in the wanted 0.01667 real-time seconds. The "show-fps" [[debug mode|debug option]] allows to see the current UPS which can be used to estimate how long a tick currently takes.


* [http://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.tick Game time]: measured in [[game-tick]]s or [[game-second]]s.
== Seconds ==
* [http://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.speed Game speed factor]: The factor that is used to multiply real time to achieve game time. When game.speed is set lower, everything in the game happens slower, and the [[Glossary#U|UPS]] will drop. For example, the game normally simulates at 60 <abbr title="Updates Per Second">UPS</abbr>, at game.speed 1. When this is set to 0.5 via the [[console]], UPS will become 30, and everything will move 50% slower. On the other hand, game speed may be set higher than 1, which results in UPS climbing beyond 60, and everything being faster.
As stated above, there should always be 60 ticks in every second, so 1 in-game second equals 60 in-game ticks. The 60 to 1 ratio is also applied when the runs at lower speeds, so an in-game second can take longer than a real-time second.


Game speed will be automatically adjusted by the game if it cannot keep up, due to a laggy system or busy script. This will be denoted by a lowered UPS.
== Days ==
[[File:day_night_comparison.png|thumb|270px|right|Juxtaposition of day and night.]]


== Ratios of time ==
An in-game day lasts 25000 ticks or 416.66~ in-game seconds.


Factorio's UPS is directly tied to its tick rate, which means that when running on optimal conditions, there are 60 ticks per second. As an example, a minute converted down:
The light varies throughout the day in a cycle consisting of 4 phases:
{| class="wikitable"
! Phase Name !! Internal name !! Behaviour !! Time of day at start !! Time of day at end !! Duration (in ticks) || Duration (in seconds)
|-
|day || dawn ||fully light ||0.75 ||0.25 ||12500 ||208.33~
|-
|sunset|| dusk ||darkening ||0.25 ||0.45 ||5000 ||83.33~
|-
|night || evening ||fully dark ||0.45 ||0.55 ||2500 ||41.66~
|-
|sunrise || morning ||lightening ||0.55 ||0.75 ||5000 ||83.33~
|}


* 1 minute
  ------------- day -------><----- sunset ----->< night -><----- sunrise ----><-------- day ------------
* 60 seconds
 
* 3600 ticks
% 0    5    10  15  20  25  30  35  40  45  50  55  60   65  70  75  80  85  90  95  100
  |----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|


=== See also ===
During sunset, the light level decreases linearly from fully light to fully dark. During sunrise, it increases linearly from dark to light. This linear slope does not necessarily apply to the values returned by [https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.darkness LuaSurface.darkness]. During night time, [[player]]s will passively activate their flashlights (or headlights if in a [[vehicle]]), and placed [[lamp]]s will turn on automatically if powered.


* [http://lua-api.factorio.com/latest/LuaGameScript.html The game scripting interface]
Note: The actual time between phases can vary +/- a tick due to rounding errors.
* [[Game-tick]]
* [[Game-second]]
* [[Game-day]]
* [[Units]]

Revision as of 12:05, 30 March 2019

Time.png

The concept of Time in Factorio is used for many different implements, most notably crafting time and game time.

Crafting time and speed

When hovering over an item recipe, the player may see a clock symbol and a number. This is the amount of time needed to craft the item in seconds at crafting speed 1. The player always crafts at speed 1 while assembling machines have different crafting speeds. Modules may also affect crafting time, either speeding it up or slowing it down for some other benefit. The player, when handcrafting, crafts with a multiplier of 1, so items that claim to take 10 seconds to craft will take 10 seconds, but an assembling machine 1 with a multiplier of 0.5 will take 20 seconds. It is important to take this into consideration when creating setups with proper ratios.

Ticks

The base unit of all time inside Factorio. When running at game speed 1, there should always be 60 ticks in every real-time second leading to the figure of 60 updates per second, short UPS. This means that 1 tick should ideally always take 1/60th of a real-time second (0.01667 seconds). However, it is possible to change the game speed using mods or console commands, so it is possible that ticks don't take 0.01667 real-time seconds. Furthermore, game speed will automatically slow down when the computer that is running the game is unable to do all needed calculations in the wanted 0.01667 real-time seconds. The "show-fps" debug option allows to see the current UPS which can be used to estimate how long a tick currently takes.

Seconds

As stated above, there should always be 60 ticks in every second, so 1 in-game second equals 60 in-game ticks. The 60 to 1 ratio is also applied when the runs at lower speeds, so an in-game second can take longer than a real-time second.

Days

Juxtaposition of day and night.

An in-game day lasts 25000 ticks or 416.66~ in-game seconds.

The light varies throughout the day in a cycle consisting of 4 phases:

Phase Name Internal name Behaviour Time of day at start Time of day at end Duration (in ticks) Duration (in seconds)
day dawn fully light 0.75 0.25 12500 208.33~
sunset dusk darkening 0.25 0.45 5000 83.33~
night evening fully dark 0.45 0.55 2500 41.66~
sunrise morning lightening 0.55 0.75 5000 83.33~
  ------------- day -------><----- sunset ----->< night -><----- sunrise ----><-------- day ------------
  
% 0    5    10   15   20   25   30   35   40   45   50   55   60   65   70   75   80   85   90   95  100
  |----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|

During sunset, the light level decreases linearly from fully light to fully dark. During sunrise, it increases linearly from dark to light. This linear slope does not necessarily apply to the values returned by LuaSurface.darkness. During night time, players will passively activate their flashlights (or headlights if in a vehicle), and placed lamps will turn on automatically if powered.

Note: The actual time between phases can vary +/- a tick due to rounding errors.