Balancing Night Length with Day Length
- thereaverofdarkness
- Filter Inserter
- Posts: 561
- Joined: Wed Jun 01, 2016 5:07 am
- Contact:
Balancing Night Length with Day Length
Currently, full day is half of the day/night cycle, and full night is only a tiny bit of the cycle. I'm trying to make the day and night have the same length. I also want to shorten the time spent on twilight, so that most of the time is either full day or full night.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Balancing Night Length with Day Length
The day/night cycle is, what I would call "hard coded" into the game.
the only way to really play with this is to write your own script to keep track of your "Time of day", and change the game's time of day to match what you want it to be.
The value counts up from 0 to 1 over the span of a day
As an example, I think 0/1 is mid-day and 0.5 is midnight. To shorten the day, you might do a check for exactly 0, and when you get it, change it to 0.2, which skips a 5th of the day length. Then similarly monitor for 0.6, and change it back to 0.4 to make the night longer. Of course, when jumping backwards you'll need to keep track of when you jump back, to make sure you only do it once a day, else you'll be stuck in an infinite night cycle.
for more information, see this link: https://wiki.factorio.com/Game-day
(Note, turns out that 0.6 is dawn, and 0.4 is dusk, so that 0.2 span is wider than the whole night cycle... it was just an example to demonstrate the idea)
Of course, if you start playing with the time value, if you have a clock installed, like my mod, then the time it tells you will jump around all over the place as you edit the game time.
the only way to really play with this is to write your own script to keep track of your "Time of day", and change the game's time of day to match what you want it to be.
The value counts up from 0 to 1 over the span of a day
As an example, I think 0/1 is mid-day and 0.5 is midnight. To shorten the day, you might do a check for exactly 0, and when you get it, change it to 0.2, which skips a 5th of the day length. Then similarly monitor for 0.6, and change it back to 0.4 to make the night longer. Of course, when jumping backwards you'll need to keep track of when you jump back, to make sure you only do it once a day, else you'll be stuck in an infinite night cycle.
for more information, see this link: https://wiki.factorio.com/Game-day
(Note, turns out that 0.6 is dawn, and 0.4 is dusk, so that 0.2 span is wider than the whole night cycle... it was just an example to demonstrate the idea)
Of course, if you start playing with the time value, if you have a clock installed, like my mod, then the time it tells you will jump around all over the place as you edit the game time.
- thereaverofdarkness
- Filter Inserter
- Posts: 561
- Joined: Wed Jun 01, 2016 5:07 am
- Contact:
Re: Balancing Night Length with Day Length
I don't want to change the time, I just want to change how it interprets the light level relative to the time.
Re: Balancing Night Length with Day Length
There is no way to do that, you'll have to change the time. If you choose to do this I suggest just freezing time (game.surfaces['nauvis'].freeze_daytime(true) http://lua-api.factorio.com/latest/LuaS ... ze_daytime) and modifying the surface.daytime value yourself in the tick event. It will be easier to choose your own day/night length and skip specific time sections at will than having to selectively check and change the vanilla time as it ticks. The performance impact should be negligible as long as you don't go totally overboard with complex math/logic in some way.