Button to reload all mods, super useful for mod devs!

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

Button to reload all mods, super useful for mod devs!

Post by vzybilly »

I would like to see a button to reload all mods completely. I've had to restart factorio a good 25 times in the past 30 minutes and waiting for it to load all the sprites and everything takes a nice bit of time, in my case, a minute per restart (yes, only 5 of the last 30 was actual work, rest was waiting for loading.). it would be even more amazing to have the option to reload while playing a world, having the mods kick their migrations (if any) then an game on_load event after for complete mod starting.

as for placement of this button, I could see it going in "options" -> "other" then a button saying something like "reload all mods/game data."

to make the process even more streamlined, when a mod gets loaded, make a hash (or something like last-modified attribute but that might get platform issues when not available on a platform) of all the mod files then check what mods were changed then re-run those scripts along with all of the mods that depend on that mod in the same order as the first run. same could be done for graphics and locale.

An example of this simplicity is: just made a new item that is a type of coal, get in the world and find out I need to set a fuel value for it, go into the item prototype and add that single value into the item, hit the reload mods button, game sees only the single item prototype file has changed, run that file which updates the item, game loads as if from a save and now the item can be burned, yay!
Will code for Food. I also have 11+ mods!


vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

Re: Button to reload all mods, super useful for mod devs!

Post by vzybilly »

nifty... well, that's all about the data but I was also thinking about locale and sprites as well... though the other thread does talk abit about the sprites...
Will code for Food. I also have 11+ mods!

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Button to reload all mods, super useful for mod devs!

Post by bobingabout »

I think data does imply everything, not just code, because after all, changing the code might change the required sprites/sounds too.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

Re: Button to reload all mods, super useful for mod devs!

Post by vzybilly »

bobingabout wrote:I think data does imply everything, not just code, because after all, changing the code might change the required sprites/sounds too.
on the other thread I've talked abit more about this but what I had came up with was to load all image files from all the mods and kinda separate the data scripts from the images... I forgot about sounds but it could also be included in the same type of process... I'm on my phone so I can't really get to into it but the other thread does talk about it and the way... I post a more detailed post tomorrow probably...
Will code for Food. I also have 11+ mods!

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Button to reload all mods, super useful for mod devs!

Post by bobingabout »

I think one of the biggest issues with images is that if you change an icon, you have delete the cropcache file too...
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

Re: Button to reload all mods, super useful for mod devs!

Post by vzybilly »

bobingabout wrote:I think one of the biggest issues with images is that if you change an icon, you have delete the cropcache file too...
cropcache? I haven't really worked with images very much, just using base till I actually sit down and work on them... (programmer, not an artist...)
Will code for Food. I also have 11+ mods!

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Button to reload all mods, super useful for mod devs!

Post by Rseding91 »

vzybilly wrote:An example of this simplicity is: just made a new item that is a type of coal, get in the world and find out I need to set a fuel value for it, go into the item prototype and add that single value into the item, hit the reload mods button, game sees only the single item prototype file has changed, run that file which updates the item, game loads as if from a save and now the item can be burned, yay!
This doesn't work. What if other mods read that value after your mod and do different things depending on it?

The entire data loading phase of the startup process is one large chain of each mod adding in and modifying the data.raw table. Changing any one part of the entire process requires the entire process be re-run as anything can change based off the one part.
If you want to get ahold of me I'm almost always on Discord.

vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

Re: Button to reload all mods, super useful for mod devs!

Post by vzybilly »

Rseding91 wrote:
vzybilly wrote:An example of this simplicity is: just made a new item that is a type of coal, get in the world and find out I need to set a fuel value for it, go into the item prototype and add that single value into the item, hit the reload mods button, game sees only the single item prototype file has changed, run that file which updates the item, game loads as if from a save and now the item can be burned, yay!
This doesn't work. What if other mods read that value after your mod and do different things depending on it?

The entire data loading phase of the startup process is one large chain of each mod adding in and modifying the data.raw table. Changing any one part of the entire process requires the entire process be re-run as anything can change based off the one part.
Alright, all the data scripts can be re-run which is still 2 seconds, give or take, which that is still better than 90+ for complete restart...
Will code for Food. I also have 11+ mods!

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Button to reload all mods, super useful for mod devs!

Post by orzelek »

Loading everything might not work as well as it seems. It would make game use more memory (and possibly also VRAM) and has potential to make actual atlases much less optimized. And mem usage esp on VRAM can be a problem now when you start adding lots of mods.

I do agree that ability to reload all the mods would be useful.

Are you aware that uncompressed mods code can be edited without restarting game?

vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

Re: Button to reload all mods, super useful for mod devs!

Post by vzybilly »

orzelek wrote:Are you aware that uncompressed mods code can be edited without restarting game?
Not the data scripts, which means prototypes can't change (like adding a fuel value to the new coal items). pretty much only control.lua, that is reloaded up each time you enter a world, if it's unzipped.
Will code for Food. I also have 11+ mods!

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Button to reload all mods, super useful for mod devs!

Post by Rseding91 »

vzybilly wrote:Alright, all the data scripts can be re-run which is still 2 seconds, give or take, which that is still better than 90+ for complete restart...
Using the largest set of mods I know of (the Shadow mod set with 81 mods) the data phase of the game startup is roughly 15 seconds - not 2 seconds. I don't know where you got that number from. Even still - the entire loading process involves both the data phase and the sprites loading phase. That *is* the entire startup process - there's not a part of it that can be "just re-run" instead of doing the entire thing. The entire startup process: load mod data files, create prototypes, load sprites, create sprite altas requires each step before to be done before the next can run.

As for the 90+ seconds - that's insane. Something is wrong with your computer if the game takes that long to startup - are you running the game in compatibility mode or do you not have Service pack 1 for Windows 7 installed?

Even with the massive shadow set of mods of the game starts In ~35 seconds for me.
If you want to get ahold of me I'm almost always on Discord.

vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

Re: Button to reload all mods, super useful for mod devs!

Post by vzybilly »

Rseding91 wrote:
vzybilly wrote:Alright, all the data scripts can be re-run which is still 2 seconds, give or take, which that is still better than 90+ for complete restart...
Using the largest set of mods I know of (the Shadow mod set with 81 mods) the data phase of the game startup is roughly 15 seconds - not 2 seconds. I don't know where you got that number from.

As for the 90+ seconds - that's insane. Something is wrong with your computer if the game takes that long to startup - are you running the game in compatibility mode or do you not have Service pack 1 for Windows 7 installed?

Even with the massive shadow set of mods of the game starts In ~35 seconds for me.
2 seconds was my time for mod startup, few light mods on a crappy computer should be about the average time I assumed, it's all mostly rough estimates anyway since everyone has different setups...
Computer info and sadness.

Code: Select all

  84.240 0 packages available to download (experimental updates enabled).
  84.299 Factorio initialised
  94.429 Goodbye
today seems to be a quick day, don't actually have to much up right now

EDIT: seemed to have accidentally skipped a small part of your post, as for the loading process, if we just say that all images in the mod directory will be loaded as sprites, doesn't that allow us to cut apart data phase from the sprites loading phase? all that would have to be done is maintain a table of file X = sprite ID Y then when we go into a world, mod wants a sprite from file X and gets it from the table. I don't really imagine that many images in a mod folder that aren't used, unless someone keeps every change they did to an image in the mod folder...
EDIT2: Seems you actually edited your post while I was working on my, lol...
Will code for Food. I also have 11+ mods!

Post Reply

Return to “Ideas and Suggestions”