[MOD 2.0] Global Tick Time Scale - Change the UPS/FPS of Factorio without changing the game pace.

Topics and discussion about specific mods
Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Zanthra »

jonatkins wrote:Ditto, thanks! In fact, it seems like you only need to remove/replace half the reactors - enough that the neighbour bonuses are recalculated - hints to what the bug is.

And as for solar, yes, I noticed that after trying this mod again my solar output hasn't doubled in the power usage graphs, unlike the production/consumption for everything else.
if you only replaced half the reactors, take a look at the speed at which the fuel cells are consumed between one that was replaced and one that was not and see if they are the same. If I recall when I replaced a reactor I watched it burn through most of a fuel cell while an adjacent reactor that I did not replace barely touch its, perhaps only the output is recalculated.

I'll take a look again at solar panels and roboports when I get a chance. I really appreciate the reports, thanks!

Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Zanthra »

jonatkins wrote:Also, now my factory wasn't falling apart with power issues, and I've had a chance to monitor it for a while, I noticed more logistics bots were active than expected. Looked like more were waiting to charge than usual, and on checking I saw that roboports "Robot recharge rate" was still 4 x 1MW, as it is without GTTS. Global energy consumption by roboports was also low - hadn't doubled compared to pre-GTTS like everything else.

Adding charging_energy to prototype_power_rates seems to fix the problem.
Alright, I added the "charging_energy" to fix roboports, and added "production" to fix the solar panels, and added a few values specific to the rocket silo. Should be working proper now with 1.1.2 .

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2167
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Ranakastrasz »

Some things are not adjusted by this mod, some due to a reluctance on my part
to adjust anything saved in the game file any more than is necessary to make
the mod easy to add and remove. Hand crafting speeds is one such rate, as there
is no prototype value, and I would instead have to rely on a game variable. To
manually adjust hand crafting speeds you can use:
I'm not sure I see why that was a problem? Why not change crafting times instead? Loop through all recipes, double "Energy cost" or whatever it was, and make sure it applies to normal, and hard/normal crafting.

Had to do something like that with my Bulk Intermediaries mod.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Zanthra »

Ranakastrasz wrote:I'm not sure I see why that was a problem? Why not change crafting times instead? Loop through all recipes, double "Energy cost" or whatever it was, and make sure it applies to normal, and hard/normal crafting.

Had to do something like that with my Bulk Intermediaries mod.
It's simply that I was already adjusting values in entity prototypes, which is where crafting speeds are located. It made it very simple to just include crafting speeds into the adjustments the same way I adjusted everything else. At this point I think it would be a big change for a little gain when an alternative is available.

I have learned since making the mod that there is a global table that can be used to store data in the save file, and the way I adjust the game speed is based on that now. I could add the option to have the mod adjust the player crafting speed itself, and store the original crafting speed, and target crafting speed in the global table. I check the crafting speed target against the current crafting speed every 60 ticks, and if the crafting speed has been changed by another mod, I can update the original crafting speed and compute a new target crafting speed and apply it. If the option is disabled, I can restore the original crafting speed. This seems to me to be a reasonable way to handle most of the adjustments that are saved in the game file.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2167
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Ranakastrasz »

Zanthra wrote:
It's simply that I was already adjusting values in entity prototypes, which is where crafting speeds are located. It made it very simple to just include crafting speeds into the adjustments the same way I adjusted everything else. At this point I think it would be a big change for a little gain when an alternative is available.

I have learned since making the mod that there is a global table that can be used to store data in the save file, and the way I adjust the game speed is based on that now. I could add the option to have the mod adjust the player crafting speed itself, and store the original crafting speed, and target crafting speed in the global table. I check the crafting speed target against the current crafting speed every 60 ticks, and if the crafting speed has been changed by another mod, I can update the original crafting speed and compute a new target crafting speed and apply it. If the option is disabled, I can restore the original crafting speed. This seems to me to be a reasonable way to handle most of the adjustments that are saved in the game file.

No, I mean, I read it like this.
-I was able to double global tick speed, by cutting the speed of everything in the game in half, except for player crafting speed. As such, you need to do that manually.

My immedate thought was, Oh, so you cut assembly machine crafting speed in half instead of doubling the timecost/energycost of the recipes. If you do it this way you won't have that problem.

I then built off of those two assumptions and made a suggestion.

Your response suggests that my assumptions were incorrect, so I do not understand the initial statement or what the reason for you wanting to change player crafting speed.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Zanthra »

No, your assumptions are not incorrect at all. As you say, there are two ways of changing crafting times, either change crafting speeds, or recipe durations. I'm not really sure what you want to know. I definitely would like the mod to be able to automatically adjust the player crafting speeds, because it is a core part of the game. There are three things leaning me away from chaning the recipe durations though.

1) Recipe durations tend to have really nice numbers, a number of whole seconds or .5 seconds, which makes ratios between them easier to work with. With some time scale factors, such as at a target framerate of 40 would make some recipe durations difficult to read and compare, such as 1 second -> 0.666667 seconds. This could make figuring out ratios more difficult. What ratio do I need if I need 5 things crafted with a duration of 0.666667 for each one thing at 2.666667 in the same crafting machine? Naturally, comparing crafting speeds between different types of machines suffer the same problem, but their numbers have always been worse for figuring ratios than the recipe durations.

2) The mod makes more sense affecting all speeds and rates before durations. If I was to adjust the crafting times instead of crafting speeds, I would also like to change it so that it affects fuel values and energy storage instead of energy consumption and production. This sort of dichotomy is not available for belt speeds, movement speeds, and the like. For the time being things are mostly working as expected the way I have it now.

3) I want to add code to change other game saved variables, such as pollution aging and dispersion and biter expansion rates, and player crafting speed adjustment with character_crafting_speed_modifier can use the same code.

I appreciate the suggestion. I just don't think the change from crafting speed to recipe time is worth it.

PS: One of my goals for this mod was to make something people could toggle on or off, or remove from a save game without causing problems. If I changed the crafting speed, then someone removed the mod, their crafting speed would not return to normal. I figured if I provided instructions on how to manually change the crafting speeds, then they would be able to use those instructions to get it back to normal if they removed the mod. Whether this was a good idea or not, I don't know, but I have plans to allow those to be automatically adjusted as well.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2167
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Ranakastrasz »

Sensible and answers my question.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

jonatkins
Fast Inserter
Fast Inserter
Posts: 155
Joined: Wed Sep 30, 2015 7:29 pm
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by jonatkins »

Good news is that I've been playing solidly with this mod enabled for some time now, seems to be working well for a 30 FPS target now.

However, I just had an interesting incident - a train collision. Was manually reversing a train and didn't spot the automatic train coming at full speed. Now without GTTS, I've never seen such a collision destroy anything - severe damage at most. However, as GTTS at 30FPS increases train speed, I guess it'll increase the damage from vehicle collisions too? In this case, the automatic train completely destroyed two(!) empty cargo wagons on the train I was reversing - didn't hit the locomotive I was driving as it was still off the main line at a junction, but that automatic train barely slowed down in the process.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2167
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Ranakastrasz »

jonatkins wrote:Good news is that I've been playing solidly with this mod enabled for some time now, seems to be working well for a 30 FPS target now.

However, I just had an interesting incident - a train collision. Was manually reversing a train and didn't spot the automatic train coming at full speed. Now without GTTS, I've never seen such a collision destroy anything - severe damage at most. However, as GTTS at 30FPS increases train speed, I guess it'll increase the damage from vehicle collisions too? In this case, the automatic train completely destroyed two(!) empty cargo wagons on the train I was reversing - didn't hit the locomotive I was driving as it was still off the main line at a junction, but that automatic train barely slowed down in the process.
Huh. Makes sense. Since I don't think you can manipulate the damage you might need to double the resistance values instead. Perctentage and flat should work, assuming ofc double speed is double damage.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by d3x0r »

Re: excessive power draw; couldn't you update the burner.efficiency to x2 for 120fps or 0.5 for 30 fps?
should work for nuclear reactors;

Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Zanthra »

Ranakastrasz wrote:
jonatkins wrote:Good news is that I've been playing solidly with this mod enabled for some time now, seems to be working well for a 30 FPS target now.

However, I just had an interesting incident - a train collision. Was manually reversing a train and didn't spot the automatic train coming at full speed. Now without GTTS, I've never seen such a collision destroy anything - severe damage at most. However, as GTTS at 30FPS increases train speed, I guess it'll increase the damage from vehicle collisions too? In this case, the automatic train completely destroyed two(!) empty cargo wagons on the train I was reversing - didn't hit the locomotive I was driving as it was still off the main line at a junction, but that automatic train barely slowed down in the process.
Huh. Makes sense. Since I don't think you can manipulate the damage you might need to double the resistance values instead. Perctentage and flat should work, assuming ofc double speed is double damage.
The property "energy_per_hit_point" actually does affect the damage done (which I think I had been adjusting the wrong way) . The thing is that train max speed/acceleration is quite complicated. Having to do with the max power, weight, air resistance, friction force, and max speed. My understanding of all of these is not guaranteed, and I don't really know what either max_speed or friction_force do. I'll play around with them some more and see if I can find something more accurate. Increasing the resistances should not be necessary.
d3x0r wrote:Re: excessive power draw; couldn't you update the burner.efficiency to x2 for 120fps or 0.5 for 30 fps?
should work for nuclear reactors;
The bug related to nuclear reactor entities not updating when the prototype is updated is listed as fixed for the next release. So I won't worry about that, unless this is referring to something else.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2167
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Ranakastrasz »

If the simulation is semirealistic then energy quadruples at double speed. It was so much fun learning calculus amd eventually realizing WHY.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by d3x0r »

Zanthra wrote:
d3x0r wrote:Re: excessive power draw; couldn't you update the burner.efficiency to x2 for 120fps or 0.5 for 30 fps?
should work for nuclear reactors;
The bug related to nuclear reactor entities not updating when the prototype is updated is listed as fixed for the next release. So I won't worry about that, unless this is referring to something else.
Oh - just add a loop though all interesting edntities and update them yourself? I ran into the same thing trying to modify an accumulator's buffer... https://github.com/d3x0r/train-speed-li ... l.lua#L185

Oh it's fixed for next revision? Good :)

Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Zanthra »

New version with runtime map options to adjust hand crafting speeds as well as pollution, evolution, expansion, and group formation times. Also hopefully fixed the issue with trains doing too much damage (my tests show similar damage now between 60fps and 30fps in one test environment), and hopefully fixed some acceleration differences due to air resistance between different target frame rates.

Also does anyone know how to get GIT to see the folder as having it's name changed instead of being deleted and recreated with a different name? Every time I change the mod version, GIT will forget all the history for all the subfiles.

d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by d3x0r »

Zanthra wrote: Also does anyone know how to get GIT to see the folder as having it's name changed instead of being deleted and recreated with a different name? Every time I change the mod version, GIT will forget all the history for all the subfiles.
git doesn't support rename, it only supports delete and recreate.
my repos have the content of the mod folder instead of having the mod folder itself; which if you have multiple mods, requires multiple repositories. There is a mechanism in git for modules, so a parent project can be composed of multiple other git repositories but I had a hard time getting it to work cleanly.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2167
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Ranakastrasz »

d3x0r wrote:
Zanthra wrote: Also does anyone know how to get GIT to see the folder as having it's name changed instead of being deleted and recreated with a different name? Every time I change the mod version, GIT will forget all the history for all the subfiles.
git doesn't support rename, it only supports delete and recreate.
my repos have the content of the mod folder instead of having the mod folder itself; which if you have multiple mods, requires multiple repositories. There is a mechanism in git for modules, so a parent project can be composed of multiple other git repositories but I had a hard time getting it to work cleanly.

Exactly. You can then rename the containing folder, and I am pretty sure GIT will point at the new folder. or maybe you have to "Find Folder" it when it can't find the new folder, which doesn't check the name.

This was soooooo annoying until I figured it out.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: [MOD 0.15.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Zanthra »

So I relicensed this mod under the unlicense (basically public domain) so that others can modify and rerelease this mod as they see fit. A lot of the folks who seem to be using this mod are definitely using it to speed up slower factories, but since I have not built factories that large, I have not had need to use the mod at 30 UPS myself, so I don't know all the issues or problems that may be caused by its use as such. That's why I am reluctant to "advertise" the mod as being something for improving performance of slow factories. I have been regularly checking the forum and the mod portal for any reported issues, even though I have not been playing factorio a whole lot in the past couple months.

I was thinking of having this mod along side another pair of mods: "GTTS - 30 UPS" and "GTTS - 120 UPS" that simply change the default UPS that the mod will select (still adjustable in mod options) so that I could better describe the mod's applications in the short description on the mod portal. It would also benefit folks who might have their mod settings reset for one reason or another, in that it would not reset to a likely rarely used 120 UPS default (which I am tempted to change to 60 UPS). I am not entirely clear on how to do the inter-mod communication. Would it be best to have some shared function or variable that the submods call to change the defaults, or should I rather have GTTS look for and detect the presence of the submods and set the proper default itself. Would it be considered discourteous to clutter the mod list with such submods that simply change the defaults of something that's already adjustable in the mod settings?

Any advice on the defaults for the mod's UPS setting, and whether and how to create submods to change the defaults would be appreciated. Also if anyone wants to help me out rewriting the short description for the mod on the ingame mod list, and the long description and readme for the mod portal and forum would be appreciated. I tend to be long and wordy in how I write descriptions, and I think it could definitely use a rewrite to make it clearer why and how someone would want to use this mod.

Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: [MOD 0.16.x] Global Tick Time Scale - (Supports 120 FPS)

Post by Zanthra »

I released a new version of this mod 1.3.0 . It has a welcome message ingame that I hope is not too annoying, due to the unusual nature of what this mod is intended to do. I also rewrote the readme and made a more succinct short description. There are also some modifications to the core code that adjusts the prototype speeds fixing a longstanding issue with the player movement animation and pickaxe mining speed. I also did some experiments to find the combination of factors that gave the closest match between low and high framerates for vehicle acceleration, deceleration and the like. Not a whole lot new, but a bit more polished.

PS: 1.3.1 fixes the check of the welcome message setting so that it actually disables the welcome message when unchecked.
1.3.2 makes it so the popup does not appear on tick 1, preventing it from displaying over the tips that need to have <TAB> pressed in order to close and preventing the button from being pressed. Plus made the welcome message only show once for each game.
1.3.2015 is a version of the mod tagged for use with version 0.15 of factorio.

Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: [MOD 0.16.x] Global Tick Time Scale - Change Base UPS/FPS

Post by Zanthra »

I made an update to remove the welcome window as I ran into an issue with that which I could not track down. Adding and removing, and in general using UI elements in LUA makes me somewhat nervous. I figure if someone is looking to do something with this mod, they will hopefully look at the mod settings, and or check the forums for information.

Additionally, I added a safe mode that stops the mod from attaching the event handlers. This prevents GTTS from making any changes to the game beyond the prototypes it configures when the game is loaded in order to improve reliability and compatibility for multiplayer and when working with other mods. This does keep it from making any changes to the game speed or hand crafting speeds, as well as preventing it from changing map settings (although those can be adjusted when creating the map to match the change in game speed). I added the necessary commands to the readme needed to make the game speed and crafting speed changes manually in this mode.

PS: There are some issues I am still having problems with if anyone has a solution.

Belt animations and objects on the belts tend to get out of sync at target FPS values that are coprime to 60 UPS (or much higher than 120 UPS). I think this is related to rounding errors in either the distance objects are moving, or the number of frames per animation. I don't think this is an issue I can solve, but if anyone has any suggestions, let me know.

Splitter animation seems to be unaffected by the changes of the mod, and I am not sure why. Other belt related entities have their animation based on the belt speed, and between red and blue splitters, they use the same animation speed coefficients and other things.

Radars use a direction rather than an animation, and they rotate, but they don't have a rotation speed. I think it's one frame of rotation per update, but I am not sure. Either way, I don't yet have a way to slow down their animation either.

Vehicle speeds and acceleration. While I seem to have made a reasonable adjustments that work between 1/2 to 2x standard UPS, vehicle speeds and accelerations are very sensitive to the tick rate simply due to the nature of the simulation. If anyone has suggestions for more accurate adjustments, let me know.

Robot bobbing. The bobbing motion robots make up and down does not seem to have a prototype parameter. As the UPS goes up, the robots bob up and down faster and faster.

PPS: After a discussion with Klonan on the Factorio Discord, I learned that adjusting day length is not as complex as I thought. I added it to the runtime adjustments along with wind speed, and removed the adjustment to smoke frequency as it seems that seems to already be related to the fuel burn rate of the energy source.

Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: [MOD 0.16.x] Global Tick Time Scale - Change Base UPS/FPS

Post by Zanthra »

It looks like the belt speed losses were due to 1/256 tile steps used for item positioning on belts (or at least using that as a model allows me to avoid the problem). The maximum UPS yellow belts work at all is 480 UPS, I have made that the limit for this mod's UPS setting. I also added a list of UPS values that give accurate belt calculations with vanilla yellow belt in the readme.

Klonan mentioned that radars might get changed to be able to adjust the rotation speed at some time, but not currently possible with a mod. That just leaves the splitter animations, and robot bobbing, and any improvements to vehicle speeds as things that I feel might be possible to improve in the mod.

Post Reply

Return to “Mods”