Faster startup (e.g. for iterating on mod code)

Place to post guides, observations, things related to modding that are not mods themselves.
User avatar
zx64
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Fri Dec 16, 2016 3:57 pm
Contact:

Faster startup (e.g. for iterating on mod code)

Post by zx64 »

While getting my head around the modding functionality of Factorio, I couldn't help but notice just how punishing a full restart of the game can be even with an SSD, so I had a look to see if there were any options that would speed things up (e.g. lowering texture quality etc.).

I can't remember if tree mipmaps and/or trilinear filtering are on by default, but for me these two options add a significant amount of time to the time taken between creating the atlas and moving onto loading sounds:

Code: Select all

   1.318 Initial atlas bitmap size is 16384
   1.320 Created atlas bitmap 16384x5589
   1.320 Created atlas bitmap 4096x968
   1.320 Created atlas bitmap 4096x3652
  19.545 Sprites loaded
  19.546 Convert atlas 4096x968 to: trilinear-filtering
  19.584 Convert atlas 4096x3652 to: mipmap
  20.249 Loading sounds...
I also noticed there's a "cache-sprite-atlas" setting in config.ini. While I imagine this setting is unhelpful if you're changing the artwork, enabling it can significantly speed up the time it takes to start Factorio when combined with disabling both those features.

With these changes combined, i.e.:

Code: Select all

cache-sprite-atlas=true
tree-sprite-mipmaps=false
trilinear-filtering=false
the game takes significantly less time to reach the "loading sounds" stage:

Code: Select all

   1.291 Initial atlas bitmap size is 16384
   1.295 Created atlas bitmap 16384x9492
   2.506 Atlases loaded from disk cache.
   2.703 Sprites loaded
   3.391 Loading sounds...
This is after several runs with each setting, the first time after changing the settings you'll probably see it take longer to start because the game has to build the cached data.

Also having a e.g. sandbox save that you can auto-load by passing "--load-game yoursandbox" on the command line also helps from a workflow perspective since all the loading/waiting happens up front rather than having to explicitly click through the main menu each and every time.

One final startup "optimisation" I made was to replace all oggs in data\base with a short, silent file.

Before:

Code: Select all

   3.389 Loading sounds...
   5.699 Custom inputs active: 0
After:

Code: Select all

   3.403 Loading sounds...
   4.037 Custom inputs active: 0
Obviously I recommend you make a separate "development" install of standalone Factorio - the standalone version uses completely separate config/save/etc. directories which is perfect for these sorts of potentially destabilising changes that you don't want in your proper install.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Faster startup (e.g. for iterating on mod code)

Post by Nexela »

Another quick tip If all you are changing is control.lua code a full restart isn't needed, simply restarting the map, or loading a save will work. Keep in a mind what events are ran when doing this though. As loading/new/upgrading existing all run different events.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Faster startup (e.g. for iterating on mod code)

Post by ssilk »

Added to viewtopic.php?f=80&t=16136 Faster start sequence / Update check / Load order
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Faster startup (e.g. for iterating on mod code)

Post by daniel34 »

Moved from Ideas and Suggestions to Modding discussion, as there is no actual suggestion found in the OP and most of this topic will only be relevant to modders.
quick links: log file | graphical issues | wiki
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: Faster startup (e.g. for iterating on mod code)

Post by Mooncat »

FYR, FFF #168 has mentioned that we will be able to force the game to update sprites, as well as some prototype values in runtime. Hopefully this will eliminate the need to restart the whole game.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14272
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Faster startup (e.g. for iterating on mod code)

Post by Rseding91 »

Mooncat wrote:FYR, FFF #168 has mentioned that we will be able to force the game to update sprites, as well as some prototype values in runtime. Hopefully this will eliminate the need to restart the whole game.
*if* that option is still enabled in the release build it makes the entire game slower because of how it works. It's not some kind of optimization - it's simply for development.
If you want to get ahold of me I'm almost always on Discord.
orzelek
Smart Inserter
Smart Inserter
Posts: 3923
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Faster startup (e.g. for iterating on mod code)

Post by orzelek »

Rseding91 wrote:
Mooncat wrote:FYR, FFF #168 has mentioned that we will be able to force the game to update sprites, as well as some prototype values in runtime. Hopefully this will eliminate the need to restart the whole game.
*if* that option is still enabled in the release build it makes the entire game slower because of how it works. It's not some kind of optimization - it's simply for development.
Having a parameter that allows to use it for mod development would be enough I think.
User avatar
zx64
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Fri Dec 16, 2016 3:57 pm
Contact:

Re: Faster startup (e.g. for iterating on mod code)

Post by zx64 »

How complete is the sprite atlas caching feature intended to be? e.g. it doesn't seem to properly cache if you enable treemips or filtering (see timing in my logs), but it seems like a useful thing for normal users to have on.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14272
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Faster startup (e.g. for iterating on mod code)

Post by Rseding91 »

zx64 wrote:How complete is the sprite atlas caching feature intended to be? e.g. it doesn't seem to properly cache if you enable treemips or filtering (see timing in my logs), but it seems like a useful thing for normal users to have on.
It can't cache things in the mipmap, things that are filtered, or things that end up compressed so if you enable those options it's not as useful.

You don't ever need those options unless you have a slower computer that can't handle loading all of the sprites into VRAM anyway.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Modding discussion”