Page 1 of 1
Send players current time as event to all others
Posted: Thu Jul 02, 2015 5:52 pm
by ssilk
There are reasons, why the current time of the computer the game is running on, cannot be read: It breaks determinism.
But knowing that in the game is useful.
It would be possible, if the current time is an event, just as if the player is clicking an input box and inputs the current time; that would not break the determinism, it is just an event like clicking on an item.
So, that is the suggestion: Send in regular intervals the current time of the hosting computer as an event (typically every minute
). That would help to implement special functions, like timers (which will go wrong, when you relied on the game-time) or other useful things.
For multiplayer and for saved replay-games this means, that everybody knows, how late it is on your computer, which breaks the data-security: For that reason, this function should be off by default, but could be turned on in the options.
Re: Send players current time as event to all others
Posted: Thu Jul 02, 2015 7:17 pm
by ratchetfreak
timers relying on game time would be more accurate than relying on wall clock time, lag delays everything equally
Re: Send players current time as event to all others
Posted: Thu Jul 02, 2015 11:03 pm
by ssilk
That is not correct, because you cannot know, how much FPS you currently have (that information wold be also non-deterministic
). The speed changes, even with very small bases. 60 FPS is normally right, but not always.
Re: Send players current time as event to all others
Posted: Thu Jul 02, 2015 11:40 pm
by sillyfly
Ssilk, could you explain why this is necessary?
I can't think of any reason why I should want to know (in-game) the local time for one of the other players. If I really want to know I can just ask them in chat
For timers, I have to agree that game-time sounds like a better option, so for example a mechanism could be - send all players a message to fire a specific event at game-tick n, and then it stays deterministic.
Re: Send players current time as event to all others
Posted: Fri Jul 03, 2015 5:55 am
by ssilk
The problem is, that if I do any action in game it needs to be send to all other clients. Thats in general also true for this.
Well, the simple thought is then, this event could be filtered, so that it is not send to the others. But then it looses the determinism, too, cause there are then events, that are not happening on all clients in the same way.
Well, I'm out here. I mean, there are surely ways to do this without sending, but I don't know, how. Your idea looks like a cool solution of this problem, but it will make a replay also non-deterministic, cause the time when playing is then different to the time, when replayed. And if I use the generated event and save that, we are again at sentence #3 of this post.
Well, I'm out here.
Re: Send players current time as event to all others
Posted: Fri Jul 03, 2015 9:41 am
by ratchetfreak
ssilk wrote:The problem is, that if I do any action in game it needs to be send to all other clients. Thats in general also true for this.
Well, the simple thought is then, this event could be filtered, so that it is not send to the others. But then it looses the determinism, too, cause there are then events, that are not happening on all clients in the same way.
Well, I'm out here. I mean, there are surely ways to do this without sending, but I don't know, how. Your idea looks like a cool solution of this problem, but it will make a replay also non-deterministic, cause the time when playing is then different to the time, when replayed. And if I use the generated event and save that, we are again at sentence #3 of this post.
Well, I'm out here.
or save those events in the replay as well (overriding cpu time)
Re: Send players current time as event to all others
Posted: Fri Jul 03, 2015 9:43 am
by sillyfly
I still don't understand why this is needed....
Re: Send players current time as event to all others
Posted: Fri Jul 03, 2015 10:10 am
by ssilk
Usage: To calculate the true length of playing for example. Or displaying the current time. Or for example, automatically shutting down Factorio, when in server mode...
Re: Send players current time as event to all others
Posted: Sun Jul 05, 2015 10:49 am
by Bytenex
As SillyFly already mentioned: I don't get it. Who needs the current time in-game?
1. Local time
E.g. my chat reads this:
[Player 1]: 12:00 - 01.01.1970
[Player 2]: 18:00 - 01.01.1970.
What information do I get from this? Oh my american friend is in America and I'm in Europe... Fine I already know that.
2. Actual time played
This could be nice if you are a speedrunner or something but I don't think that it matters in normal singleplayer games. I mean if there is a time difference of let's say 5 Minutes. I don't care.
3. Shutting down the server
Sorry my friend but I would never stop my headless server. The real purpose of a client - server system is to let the server run indefinetly. I would rather do this with "cron" (Linux) or "scheduled tasks" (Windows) than let the software decide when to shut down.
Re: Send players current time as event to all others
Posted: Sun Jul 05, 2015 11:22 am
by sillyfly
For 'actual time played' for speed-running etc. it would actually be better to use game-time. If your game somehow slowed to 30 fps it shouldn't meet you took twice as much time to complete the game, as all tasks, crafting etc. would be stretched proportionally.
Re: Send players current time as event to all others
Posted: Sun Jul 05, 2015 11:42 am
by ssilk
Bytenex wrote:
[Player 1]: 12:00 - 01.01.1970
[Player 2]: 18:00 - 01.01.1970.
The time from player 2 is needed to keep the game deterministic. Deterministic means: All events have to happen on all clients in the same way. Sending time is an event.
What information do I get from this? Oh my american friend is in America and I'm in Europe... Fine I already know that.
I my own real-time into game. But maybe you're right: The usage-cases are limited.
Re: Send players current time as event to all others
Posted: Sun Jul 05, 2015 11:50 am
by Bytenex
ssilk wrote:Bytenex wrote:
[Player 1]: 12:00 - 01.01.1970
[Player 2]: 18:00 - 01.01.1970.
The time from player 2 is needed to keep the game deterministic. Deterministic means: All events have to happen on all clients in the same way. Sending time is an event.
I think you don't get the definition of deterministic. It means that a world is bound to its rules. E.g. you can't let a ball fall upwards because it is not permitted by physical laws. Same applies to your external time. It doesn't make sense to implement actions based on a rule of an outside system.
Re: Send players current time as event to all others
Posted: Sun Jul 05, 2015 12:13 pm
by ssilk
Uh. So you need to remove intermediately your mouse and keyboard, when playing! Hurry up, you are injuring the rules of determinism!
Deterministic in this case (Factorio) means of course, that the events, that needs to be triggered from outside are handled in the same way on all instances (clients). That was the reason, why the time-functions where removed - I think 2 years ago - because they are different on each client.
Re: Send players current time as event to all others
Posted: Sun Jul 05, 2015 12:22 pm
by Bytenex
ssilk wrote:Uh. So you need to remove intermediately your mouse and keyboard, when playing! Hurry up, you are injuring the rules of determinism!
Deterministic in this case (Factorio) means of course, that the events, that needs to be triggered from outside are handled in the same way on all instances (clients). That was the reason, why the time-functions where removed - I think 2 years ago - because they are different on each client.
You are right. But still the game-time would be a better indicator to trigger events than an external time. Your headless server (0.12) could handle this. Clients will always be synchronized to his game-state. You also said that these events triggered by the server could be filtered. Yes; but that would be cheating, wouldn't it?
Re: Send players current time as event to all others
Posted: Sun Jul 05, 2015 4:24 pm
by ratchetfreak
sillyfly wrote:For 'actual time played' for speed-running etc. it would actually be better to use game-time. If your game somehow slowed to 30 fps it shouldn't meet you took twice as much time to complete the game, as all tasks, crafting etc. would be stretched proportionally.
Exactly speed runners prefer in-game time if they can get it.
Re: Send players current time as event to all others
Posted: Mon Jul 06, 2015 4:38 pm
by ssilk
I move that to won't implement. This suggestion is missing the concrete usage case and only to implement it for speed runners or other questionable stuff and such is not reason enough.