[Mod] Timespeed [timespeed]

User avatar
Linuxdirk
Member
 
Posts: 1651
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

[Mod] Timespeed [timespeed]

by Linuxdirk » Sun Jan 07, 2018 04:38

Change time speed for day/night)

If you played Minetest for some time you might notice that the night gets annoying very quick. Slaying monsters can be done underground (if a mod is installed that adds them) and lighting the surface builds is done very quick but what’s then? Minetest nights are just dark (and feels even darker if you record your gameplay), so you either need to manually set the time to day or skip the night in a bed.

Another way to get rid of nights is setting the time_speed value to 0. But that completely disables the time speed so it will never become day or night again. Plus: there might be mods depending on time changes that may become dysfunctional or will act weird if time does not change.

So, if you ever wanted to have nights being over faster or ever wanted to have longer days (or both) maybe this mod is something for you. By default the daytime speed is not changed but the nighttime speed gets changed so a night is only around 2:30 minutes long.

Information

When shutting down the server (or leaving the singleplayer world) everything gets set back to normal wich is necessary because time speed is global and this likely won’t be changed in the foreseeable future.

All of the relevant values (daytime/nighttime start and speed, 4 values in total) are tweakable via the extended configuration (or by manually adding the corresponding settings to the configuration file.)

There are multiple configuration options to be set via advanced settings within the client or directly in minetest.conf and a chat command to stop and continue the functionality on permission basis. See the mod’s README.md file for details.

Obtaining the mod

Depends: Nothing
License (everything): GPLv3 or later
Download: Latest version (always compatible with latest non-dev Minetest version)
… or better use Git: https://gitlab.com/4w/timespeed.git
Last edited by Linuxdirk on Wed Sep 26, 2018 09:04, edited 6 times in total.
 

User avatar
cx384
Member
 
Posts: 492
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: [Mod] Timespeed [timespeed] (change timespeed for day/ni

by cx384 » Sun Jan 07, 2018 10:45

To make the day longer and night shorter seems unrealistic to me, but who doesn't want to get rid of the night?
So nice idea!
Can your read this?
 

User avatar
sorcerykid
Member
 
Posts: 860
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: [Mod] Timespeed [timespeed] (change timespeed for day/ni

by sorcerykid » Sun Jan 07, 2018 14:30

I don't think it's unrealistic. According to Wikipedia:

https://en.wikipedia.org/wiki/Daytime#D ... nd_seasons

Although the length of the daytime period is always twelve hours at the Equator, in all seasons, at all other latitudes the length varies with the season. During the winter, the daytime period is shorter than twelve hours; during the summer, it is longer than 12 hours. When it is winter north of the Equator, it is summer south of the Equator, and vice versa.


Even with that said, my primary concern is there is no way to alter the day-vs-night cycle except by constantly varying the time speed. For subgames that show a world clock in the HUD, this will look very silly since the hours and minutes will change pace as well. And that is unrealistic :P
 

User avatar
Linuxdirk
Member
 
Posts: 1651
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Timespeed [timespeed] (change timespeed for day/ni

by Linuxdirk » Sun Jan 07, 2018 18:33

Haha, yes, this isn’t aimed towards realism but convenience. It’s for when you play modded Minetest Game and don’t want to skip night manually or can’t disable time completely.

How realistic different time speeds for day and night are in a game where you can happily jump around while carrying 3168 cubic meters of cobblestone isn’t anything I want to judge :)

sorcerykid wrote:since the hours and minutes will change pace as well. And that is unrealistic :P

Wait a second (or minute, or hour, or whatever you want, that doesn’t matter because I am the master over time, so just wait …), are you denying time travel? :)
 

User avatar
sorcerykid
Member
 
Posts: 860
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: [Mod] Timespeed [timespeed] (change timespeed for day/ni

by sorcerykid » Sun Jan 07, 2018 19:26

I wonder what it would take under the hood to change the day/night cycle without modifying the world clock itself. Altho I haven't looked at the CPP network code, I imagine that immediately before the time_of_day packet is actually sent to the client, the value could be factored against a given day vs. night ratio.
 

User avatar
Linuxdirk
Member
 
Posts: 1651
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Timespeed [timespeed] (change timespeed for day/ni

by Linuxdirk » Sun Jan 07, 2018 19:32

sorcerykid wrote:I wonder what it would take under the hood to change the day/night cycle without modifying the world clock itself.

From what I had to code and look up It feels like the time system has to be reworked completely. What I did is nothing more than a simple hack.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Timespeed [timespeed] (change timespeed for day/ni

by Sokomine » Thu Jan 11, 2018 03:29

Getting rid of the night is always welcome. Hard to harvest materials and eventually use them if all is dark. I usually plaster my creations with tons of torches.
A list of my mods can be found here.
 

User avatar
sorcerykid
Member
 
Posts: 860
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: [Mod] Timespeed [timespeed]

by sorcerykid » Thu Jan 11, 2018 13:26

Sokomine, it's already possible to get rid of night by setting the time_speed server variable.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Timespeed [timespeed]

by Sokomine » Thu Jan 11, 2018 20:27

I'm aware of that. On servers, not all players have the privileges for setting the time, and not all moderators want to change it to day all the time. If the night is automaticly shortened by a mod that's certainly good :-) My singleplayer worlds have constant mid-day. That might get a bit boring on a server and make it tricky to prepare the house for the (never coming) night.
A list of my mods can be found here.
 

Chem871
Member
 
Posts: 863
Joined: Sat Aug 19, 2017 21:49
Location: SCP-2935
GitHub: Chemguy99
In-game: Nyx Serris

Re: [Mod] Timespeed [timespeed]

by Chem871 » Thu Jan 11, 2018 21:05

Some people might want the nights to be longer than the days, so....
What is SCP-055 again? I forgot.
 

User avatar
sorcerykid
Member
 
Posts: 860
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: [Mod] Timespeed [timespeed]

by sorcerykid » Fri Jan 12, 2018 00:02

Chem871 wrote:Some people might want the nights to be longer than the days, so....


Yes on my server I have seasons, and so I've long wanted to have longer nights during the winter but haven't found any way to do that without modifying the engine.
 

User avatar
Linuxdirk
Member
 
Posts: 1651
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Timespeed [timespeed]

by Linuxdirk » Fri Jan 12, 2018 02:07

Chem871 wrote:Some people might want the nights to be longer than the days, so....

It is of course possible with this mod. Set timespeed_nighttime_speed to 36 and the night will be twice as long as the day (normal speed is 72).
 

User avatar
sorcerykid
Member
 
Posts: 860
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: [Mod] Timespeed [timespeed]

by sorcerykid » Fri Jan 12, 2018 02:19

Like I said that alters the pace of the world clock, which is not really acceptable for my subgame since the time is shown in several places. Since I want some degree of realism for the day/night cycle, I need a constant timespeed :P
 

User avatar
Linuxdirk
Member
 
Posts: 1651
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Timespeed [timespeed]

by Linuxdirk » Fri Jan 12, 2018 02:37

sorcerykid wrote:Like I said that alters the pace of the world clock, which is not really acceptable for my subgame since the time is shown in several places. Since I want some degree of realism for the day/night cycle, I need a constant timespeed :P

“[engine change needed]”

:)
 

User avatar
sorcerykid
Member
 
Posts: 860
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: [Mod] Timespeed [timespeed]

by sorcerykid » Fri Jan 12, 2018 14:09

Me being curious, I checked the source code and discovered it's apparently just one line that needs to be changed :)

Code: Select all
         /*
                Send to clients at constant intervals
        */

        m_time_of_day_send_timer -= dtime;
        if(m_time_of_day_send_timer < 0.0) {
                m_time_of_day_send_timer = g_settings->getFloat("time_send_interval");
                u16 time = m_env->getTimeOfDay();
                float time_speed = g_settings->getFloat("time_speed");
                SendTimeOfDay(PEER_ID_INEXISTENT, time, time_speed);
        }


All that should be required is to alter the values of time_speed and time before sending them to the client via SendTimeOfDay( ), probably using the same algorithm that you are using in your mod. Of course a new setting would also have to be added to minetest.conf, but that part should be quite straighforward as you can see it's already reading two other related settings as well.

I might go ahead try implementing this change in my fork of the engine and seeing what happens, at least as a proof of concept :)
 

User avatar
bhree
Member
 
Posts: 66
Joined: Tue Jun 19, 2018 07:45
GitHub: bhree
In-game: bhree

Re: [Mod] Timespeed [timespeed]

by bhree » Wed Sep 26, 2018 08:23

I'm not sure this mod has better alternative or not but I see it very interesting although unrealistic, and I think quite a game changer. I see some code and I want to make sure it's correct. It seems working on my server.

Original code:
Code: Select all
local daytime_start = setting_get('daytime_start', 4300)
local nighttime_start = setting_get('nighttime_start', 19359)
local daytime_speed = setting_get('daytime_start', 72)
local nighttime_speed = setting_get('nighttime_start', 360)


I changed to :
Code: Select all
local daytime_start = setting_get('daytime_start', 4300)
local nighttime_start = setting_get('nighttime_start', 19359)
local daytime_speed = setting_get('daytime_speed', 72)
local nighttime_speed = setting_get('nighttime_speed', 360)


The 2 last lines should be speed instead of start. Please inform if MT has implemented internal system that can change time speed.
Regards.
 

User avatar
Linuxdirk
Member
 
Posts: 1651
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Timespeed [timespeed]

by Linuxdirk » Wed Sep 26, 2018 09:03

bhree wrote:I'm not sure this mod has better alternative or not but I see it very interesting although unrealistic, and I think quite a game changer.

Indeed :) But you can do it the other way round, too, and have super long nights and short days. It all depends on your type of server/game. Personally I don’t want to skip nights manually by sleeping but I also don’t want to freeze the time permanently – this was the main reason for the mod.

bhree wrote:The 2 last lines should be speed instead of start.

You’re correct, thanks for pointing that out. I just fixed that so simply pull the latest changes from GitLab and your custom values in minetest.conf will be loaded properly.

bhree wrote:Please inform if MT has implemented internal system that can change time speed.

Currently no. There only is a general setting for the general speed of time that is applied to all worlds but nothing even close to this mod. See this issue and the comments to it for further details.
 

User avatar
bhree
Member
 
Posts: 66
Joined: Tue Jun 19, 2018 07:45
GitHub: bhree
In-game: bhree

Re: [Mod] Timespeed [timespeed]

by bhree » Wed Sep 26, 2018 09:49

Personally I don’t want to skip nights manually by sleeping but I also don’t want to freeze the time permanently – this was the main reason for the mod.

when there are more than 1 player and not all of them has bed then skipping night is difficult. Very nice mod.
 


Return to Mod Releases



Who is online

Users browsing this forum: Google [Bot] and 4 guests