Button to reload all mods, super useful for mod devs!
Posted: Sun Sep 20, 2015 5:00 am
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!
Re: Button to reload all mods, super useful for mod devs!
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...
Re: Button to reload all mods, super useful for mod devs!
Posted: Mon Sep 21, 2015 12:38 am
by bobingabout
I think data does imply everything, not just code, because after all, changing the code might change the required sprites/sounds too.
Re: Button to reload all mods, super useful for mod devs!
Posted: Mon Sep 21, 2015 5:27 am
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...
Re: Button to reload all mods, super useful for mod devs!
Posted: Mon Sep 21, 2015 6:53 am
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...
Re: Button to reload all mods, super useful for mod devs!
Posted: Mon Sep 21, 2015 5:47 pm
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...)
Re: Button to reload all mods, super useful for mod devs!
Posted: Mon Sep 21, 2015 6:53 pm
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.
Re: Button to reload all mods, super useful for mod devs!
Posted: Mon Sep 21, 2015 7:42 pm
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...
Re: Button to reload all mods, super useful for mod devs!
Posted: Mon Sep 21, 2015 7:54 pm
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?
Re: Button to reload all mods, super useful for mod devs!
Posted: Mon Sep 21, 2015 8:35 pm
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.
Re: Button to reload all mods, super useful for mod devs!
Posted: Wed Sep 23, 2015 7:46 pm
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.
Re: Button to reload all mods, super useful for mod devs!
Posted: Wed Sep 23, 2015 8:43 pm
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.
As for my computer (my newest one), a 7ish year old (I think so, got it for $400 brand new) I3 Laptop, overclocked turbo mode to 2.53GHz, "4 cores" by the task manager. I've had the whole thing turn off from getting to hot. OS is currently Lubuntu 14.04 because I wanted a lighter OS footprint. vanilla minecraft gives me 0.5 to 2 FPS while I was on windows, switching to Lubuntu gave me 5 to 8 FPS. I very rarely see 60/60 (FPS/UPS) for factorio, even on new worlds. most of the time I get about 30/57, sometimes I can get 5/15 or lower. Integrated Intel Graphics, no drivers for them (allot of games can't be played because of this.), I've tried many times to get drivers. At least I have 8GB of ram. Next newest has 2GB of ram, my oldest boasts a 4GB HARD DRIVE with I think 128MB of ram. All in all, I'm doing well as a jobless, homeless, eagle scout, 25 year-old, 10 year programmer who's trying for any job for the past 3 years.[/self-pity]
I do actually get to maintain a good 7.5GB of RAM and 95% CPU for my programs after OS, I do see some programs flatline a core every now and then. mostly games or fork-bombs for fun but other than that, computer is pretty nice.
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...