Page 1 of 1

Clock needed to keep in touch with the outside world

Posted: Thu Sep 15, 2016 8:57 am
by mrvn
Factorio is seriously addictive. Which makes it hard to keep track of the outside world time. So here is my suggestion:

1) Have an (optional) clock displayed somewhere in the GUI showing outside world time.
2) Allow setting an alarm so the game will show a popup after
2a) X days/hours/minutes of playing
2b) at a certain time

Re: Clock needed to keep in touch with the outside world

Posted: Thu Sep 15, 2016 12:09 pm
by bobucles
There are these stores where you can get clocks so small you can wear on your ARM! Try it out sometime. FYI: Bitches love arm clocks.

Re: Clock needed to keep in touch with the outside world

Posted: Thu Sep 15, 2016 1:24 pm
by aubergine18
If the modding API exposed (from vague memory) os.time, then mods would be able to easily implement this feature. https://www.lua.org/pil/22.1.html

Re: Clock needed to keep in touch with the outside world

Posted: Thu Sep 15, 2016 8:52 pm
by ssilk
This was implement in the very early days of Factorio but has been removed, cause the external clock is a non-deterministic function. In simpler words: Every computer has a little bit different clock.

See viewtopic.php?f=71&t=13299

When implemented as event (as for example suggested as combinator in viewtopic.php?f=6&t=32691 -- as event is btw. the only way) this has the problem, that those events needs to be forwared to other players computers.

In other words: Really not so easy, as it sounds. :)

Re: Clock needed to keep in touch with the outside world

Posted: Thu Sep 15, 2016 10:56 pm
by Maharin
ssilk wrote:This was implement in the very early days of Factorio but has been removed, cause the external clock is a non-deterministic function. In simpler words: Every computer has a little bit different clock.

See viewtopic.php?f=71&t=13299

When implemented as event (as for example suggested as combinator in viewtopic.php?f=6&t=32691 -- as event is btw. the only way) this has the problem, that those events needs to be forwared to other players computers.

In other words: Really not so easy, as it sounds. :)
What if it was implemented as a local-only display of the local computer time and NOT considered part of the game? In other words, no adjustment for time zone or syncing involved, just a graphical representation of the local system time.

Granted, I play windowed so I see the time while playing anyway. :p

Re: Clock needed to keep in touch with the outside world

Posted: Fri Sep 16, 2016 9:44 am
by Deadly-Bagel
If this is a general problem for you, there's most likely an overlay of some description that works for all games which is what you should really aim to have this for =P

Re: Clock needed to keep in touch with the outside world

Posted: Fri Sep 16, 2016 9:59 am
by ssilk
It would be useful, if someone, which finds a good program to display the time in forground and has eventually also the other features (Alarm...), that he posts the links to it here.

Re: Clock needed to keep in touch with the outside world

Posted: Fri Sep 16, 2016 12:34 pm
by steinio
You could measure the seconds for Factorio start once and great a batch file which writes the current time to as a variable in a Lua file which is read by a mod. Now your real world time is in the game.

Add youre measured time as correction value and synchronize via game ticks.
Some seconds loss don't hurt I guess.

The rest is Lua magic.

Greetings steinio

Re: Clock needed to keep in touch with the outside world

Posted: Fri Sep 16, 2016 12:57 pm
by hoho
ssilk wrote:This was implement in the very early days of Factorio but has been removed, cause the external clock is a non-deterministic function. In simpler words: Every computer has a little bit different clock.
Quite weird reason considering displaying FPS/UPS has no problems in MP as far as I know.

Reading the clock from the computer and displaying is something I can't see any reasons why it has to be forwarded to anyone else. For time since startup, you could read that from OS threading API and also can't see how that could cause any more problems with deterministing (no idea if that's a word) considering massive differences in how the game can handle different hardware and OSes on lower level.

Re: Clock needed to keep in touch with the outside world

Posted: Fri Sep 16, 2016 2:37 pm
by Hannu
Why it can not show only player's computer's time? If players know it they do not use it to time their activities in game. Idea was to give the real world possibility to interrupt player. :)

But there are many alarm programs for all operating systems. You can set an alarm before beginning the game. If you want completely automated alarm and gaming restriction system, take a wife. :)

Re: Clock needed to keep in touch with the outside world

Posted: Fri Sep 16, 2016 2:45 pm
by Deadly-Bagel
Better yet, have a baby. Can't remember the last time I needed my alarm to get up in the morning, previously had 4-5 alarms and eventually one that made me go downstairs and scan a barcode on the fridge before it stopped beeping.

And nothing instils paranoia of time like having a sleeping baby in the house =/

Re: Clock needed to keep in touch with the outside world

Posted: Fri Sep 16, 2016 7:07 pm
by ssilk
hoho wrote:
ssilk wrote:This was implement in the very early days of Factorio but has been removed, cause the external clock is a non-deterministic function. In simpler words: Every computer has a little bit different clock.
Quite weird reason considering displaying FPS/UPS has no problems in MP as far as I know.
Yes, displaying. This suggestion is about making it usable in-game or with mods. That ain't gonna work.

Re: Clock needed to keep in touch with the outside world

Posted: Fri Sep 16, 2016 8:04 pm
by zebediah49
I agree that it would be a nice side-feature to have an option for a local time OSD, but that doing it in game would be somewhere between impossible and a terrible idea.

For some context, I present a thoroughly entertaining list, Falsehoods programmers believe about time. A few choice items relevant to the discussion at hand (all are false):
  • time on the server clock and time on the client clock would never be different by a matter of decades.
  • If the server clock and the client clock are not in synch, they will at least always be out of synch by a consistent number of seconds.
  • the duration of one minute on the system clock would never be more than an hour.

Re: Clock needed to keep in touch with the outside world

Posted: Fri Sep 16, 2016 9:05 pm
by ssilk
Synchronization with the server is not the problem. :)

Of course the times on all players computer are different. It would be a wonder if not. But calculating with the time is, because the determinism get's lost.

Simple example: an inserter, that requests iron plate by seconds of computer clock.

The game would immediately lose sync. Cause the chest will request all numbers between 0 and 59, but not at the same time at all player computers.

Re: Clock needed to keep in touch with the outside world

Posted: Sat Sep 17, 2016 7:46 am
by hoho
ssilk wrote:This suggestion is about making it usable in-game or with mods. That ain't gonna work.
I missed the part about mods, sorry about that.

Though, am I correct to assume that in MP, all players have always had equal amount of ticks/updates processed since they joined the game? I mean no one will skip updates. If someone is too slow, everyone else will wait for them.
Obviously, there could be a few milliseconds or even a second or two lag between people but when they are processing the same update, it should be "close enough".

If the host is the one who sends out the current date and time to clients, I can't see where the major issues would come.

Re: Clock needed to keep in touch with the outside world

Posted: Sat Sep 17, 2016 9:33 am
by afk2minute
ssilk wrote:It would be useful, if someone, which finds a good program to display the time in forground and has eventually also the other features (Alarm...), that he posts the links to it here.
That looks like the best solution for OP problem.

Re: Clock needed to keep in touch with the outside world

Posted: Sun Sep 18, 2016 5:48 pm
by steinio
I installed the MSI Afterburner with Rivatuner.

With this program you can configure an OSD which can display time, FPS, CPU, RAM and GPU load and as byproduct overclock your GPU :)

https://gaming.msi.com/de/features/afterburner
MSI Afterburner.png
MSI Afterburner.png (43.66 KiB) Viewed 8946 times
Greetings steinio

Re: Clock needed to keep in touch with the outside world

Posted: Mon Sep 19, 2016 1:26 pm
by mrvn
ssilk wrote:This was implement in the very early days of Factorio but has been removed, cause the external clock is a non-deterministic function. In simpler words: Every computer has a little bit different clock.

See viewtopic.php?f=71&t=13299

When implemented as event (as for example suggested as combinator in viewtopic.php?f=6&t=32691 -- as event is btw. the only way) this has the problem, that those events needs to be forwared to other players computers.

In other words: Really not so easy, as it sounds. :)
Oh I didn't mean the outside clock to interact in any way with the game engine (as for example with combinators). It just want it to be visible on the players screen and the events would be popups that interrupt the game. After all in a multiplayer game people might have different timezones and might want to leave at different times. E.g. player 1 has to catch the last bus home at 12:34 so he sets his alarm to 12:15.

Re: Clock needed to keep in touch with the outside world

Posted: Mon Sep 19, 2016 2:55 pm
by ssilk
mrvn wrote:Oh I didn't mean the outside clock to interact in any way with the game engine (as for example with combinators). It just want it to be visible on the players screen and the events would be popups that interrupt the game. After all in a multiplayer game people might have different timezones and might want to leave at different times. E.g. player 1 has to catch the last bus home at 12:34 so he sets his alarm to 12:15.
Ok, I repeat: that is possible somehow. It is not possible to have the system-clock inside the game (as combinator signal or in a mod-api-function).