Friday Facts #165 - Death by a thousand cuts

Regular reports on Factorio development.
bk5115545
Fast Inserter
Fast Inserter
Posts: 123
Joined: Sun Apr 03, 2016 7:00 pm
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by bk5115545 » Sat Nov 19, 2016 7:38 am

Super psyched about the performance improvements.

When you do profiling, do you run at unlimited UPS or does the game still max at 60? It might be useful to disable v-sync and run at unlimited UPS. CPU time percentages should be about the same but it would take much less real time to simulate the same scenario.

deasturies
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sat Nov 19, 2016 7:48 am
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by deasturies » Sat Nov 19, 2016 7:51 am

Right now when you want to customize a particular mod you have to:
1. Know what folder the mods are stored on your computer
Feature request:

add a button in mods window like "Open mods location"

Jürgen Erhard
Filter Inserter
Filter Inserter
Posts: 266
Joined: Sun Jun 12, 2016 11:29 pm
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by Jürgen Erhard » Sat Nov 19, 2016 9:18 am

Mod settings! Yay!

Now for... map-bound mods. Generally, better mod management, where you bind mod to a map so whichever mods you have installed or install new, the mods a map runs with remains a fixed set. Right now, if you install a new mod, or any enabled mod that is, gets run for any map you load. Which means you *manually* have to enable/disable the mods you want to play *this* map with... that's just not manageable.

Or, and of course those mod settings need to be per-map too, not global.

Grimakar
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sun Mar 06, 2016 12:19 pm
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by Grimakar » Sat Nov 19, 2016 9:42 am

For all those fellas who wanted a wallpaper, I did some photoshop and created you this. So hopefully this could help waiting for the official wallpaper ;)
Image

suprnova74
Inserter
Inserter
Posts: 48
Joined: Thu Sep 10, 2015 2:29 am
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by suprnova74 » Sat Nov 19, 2016 1:40 pm

For one of the configurable mod settings, may i suggest changing and/or ignoring supported factorio version? I typically play experimentals and manually edit the mods to be supportable for the next version. this allows those daring to keep using mods (and detect any flaws/changes the mod creator may need to make) to do so readily.

noliVe
Filter Inserter
Filter Inserter
Posts: 325
Joined: Tue May 24, 2016 7:46 am
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by noliVe » Sat Nov 19, 2016 3:52 pm

i have not read all but


why make this big blabla with all the modfiles? makeing a gui for changes? worktime could be much faster.

Just AUTO-DOWNLOAD the mods via eachPlayers if there are changes.
Skip working on what happen if server and client not have same mod installed. AUTO-INSTALL them!
The mod-database can be the HOST-Server for that.


AUTO_MOD_ACTIVE/deactiveate !!

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

Re: Friday Facts #165 - Death by a thousand cuts

Post by Rseding91 » Sat Nov 19, 2016 4:07 pm

noliVe wrote:i have not read all but


why make this big blabla with all the modfiles? makeing a gui for changes? worktime could be much faster.

Just AUTO-DOWNLOAD the mods via eachPlayers if there are changes.
Skip working on what happen if server and client not have same mod installed. AUTO-INSTALL them!
The mod-database can be the HOST-Server for that.


AUTO_MOD_ACTIVE/deactiveate !!
So you want to restart your game every time you want to change something with a mod? Restart your game every time it downloads the mods to join a particular server?
If you want to get ahold of me I'm almost always on Discord.

Ralfinator
Inserter
Inserter
Posts: 20
Joined: Sun Jun 26, 2016 9:37 pm
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by Ralfinator » Sat Nov 19, 2016 5:00 pm

We were having some performance trouble in our 3-player game, so all this optimization work is very appreciated :)

One thing we found to be particularly expensive is battles. Essentially everything would run smoothly, until one of us went head-on into a large-ish Biter base and throws grenades at everything, or, alternatively, burns everything to the ground using the flamethrower.

Also maybe it's worth to work on the failure mode for the game getting slow... we had the game almost unplayable because the host was fine, but one of the other players couldn't catch up. So on his machine, the player would just freeze. We'd rather have everyone slowed down a little than stop playing the game because one of us just can't move.

noliVe
Filter Inserter
Filter Inserter
Posts: 325
Joined: Tue May 24, 2016 7:46 am
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by noliVe » Sat Nov 19, 2016 5:43 pm

Rseding91 wrote: So you want to restart your game every time you want to change something with a mod? Restart your game every time it downloads the mods to join a particular server?
no logic, you always have to restart your game when join a server with different mods.
where is the difference ? i tell you

- you dont have to search the mods on your own.
- you dont have to install them manually
- you never forget any mods
- changes to any mod will AUTOcorrect them
- automatic DEactivate and Activate to all needet mods

Hertzila
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sat Mar 05, 2016 1:15 am
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by Hertzila » Sat Nov 19, 2016 7:41 pm

noliVe wrote:
Rseding91 wrote: So you want to restart your game every time you want to change something with a mod? Restart your game every time it downloads the mods to join a particular server?
no logic, you always have to restart your game when join a server with different mods.
Right now, yes. But here's the thing: What if you didn't need to?

noliVe
Filter Inserter
Filter Inserter
Posts: 325
Joined: Tue May 24, 2016 7:46 am
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by noliVe » Sun Nov 20, 2016 12:05 am

i forgot to say

Join a new server you ALWAYS restart the game.
Activate/deactivate even a SINGLE mod restart the game
and you forgot a single mod... restart again.. grrr.

That! is something really bugging me to hell :)
And AutoMod download helps smaller MOD-Devs finding their mods.
Have you seen some servers with soooo many mods in there? Yes there are some having 20+ mods...
all the time searching for that oO

Even we Crew I-Craft on our Server.list website you can download all mods in ONE Click
Http://i-craft.de/factorio-list/ (Details)

AUTO-MOD DOWNLOAD! that would be awesome

Zaflis
Filter Inserter
Filter Inserter
Posts: 273
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by Zaflis » Sun Nov 20, 2016 8:25 am

I too have been silently concerned about performance of my mod sometimes. It takes just 0.25ms or so but it was more than many actually big mods. So when i looked in the code:

Code: Select all

script.on_event(defines.events.on_tick, function(event)
  if game.tick % 2 == 0 then
    for i = 1, #game.players do
      local player = game.players[i]
      if player.vehicle and player.vehicle.valid then
        local v = player.vehicle.type
        if v == "car" or v == "tank" then
          ...
        end
      end
    end
  end
end
There wasn't any glaringly obvious... except for "local player = ...". I assume LUA doesn't work with pointer references, so what it actually does is copy the entire player structure (which is apparently big), and it does that every second tick for every player. So i'd assume solution is to get rid of it and use direct reference:

Code: Select all

if game.players[i].vehicle and game.players[i].vehicle.valid then
So yeah, i don't know if you are dealing with these sort of code pieces, but it's a thing :)

Other thing i often see is people use sqrt() when counting if something is within circular radius. a^2 + b^2 = c^2, so all you need to do is square the comparison value.

User avatar
ledow
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Sat Sep 24, 2016 3:00 pm
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by ledow » Sun Nov 20, 2016 8:41 am

Can I throw in my two-penneth on optimisation?

The loading screen.

I have a laptop with an SSD and it takes 10-15 seconds to get to the menu. Given that there are no credits, or unskippable logos or any other tripe, it's probably one of the longest loading screens I've ever seen.

Can we not load what's needed for the menu, and then background-load the rest while people are in the menu and configuring/loading their game.

Especially when you do mod-installs or removes and then it restarts, it can be a long time with no interaction possible before you get back in.

And are things being done right for it to take quite so long? I understand there are probably a LOT of sprites etc. to load into graphics RAM (and it seems like you do your best to optimise at runtime by cropping them down to take less graphics RAM or whatever) but it's the only part where I feel like I'm waiting for the game.

And if that's happening on an SSD with a decent nVidia graphics card, I wonder what people with lesser machines are experiencing?

brab
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Sun May 18, 2014 2:08 pm
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by brab » Sun Nov 20, 2016 8:45 am

Regarding playing with different mods, is there an easy way to play several local games with different mods and switch between them without having to manually toggle the mods needed? I know Factorio has to restart when changing mods, but it would be great to have a button that lets one switch to the mods of a saved game in the loading menu.

Zaflis
Filter Inserter
Filter Inserter
Posts: 273
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by Zaflis » Sun Nov 20, 2016 8:54 am

brab wrote:Regarding playing with different mods, is there an easy way to play several local games with different mods and switch between them without having to manually toggle the mods needed? I know Factorio has to restart when changing mods, but it would be great to have a button that lets one switch to the mods of a saved game in the loading menu.
Best solution i know to that is using any Factorio Mod Manager. Such thing loads instantly and can save several different mod configurations, or a profile to instantly disable all mods. It writes the mod configuration file on Factorios behalf so you'll see the effect immediately ingame once you launch game.

brab
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Sun May 18, 2014 2:08 pm
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by brab » Sun Nov 20, 2016 11:41 am

Zaflis wrote:
brab wrote:Regarding playing with different mods, is there an easy way to play several local games with different mods and switch between them without having to manually toggle the mods needed? I know Factorio has to restart when changing mods, but it would be great to have a button that lets one switch to the mods of a saved game in the loading menu.
Best solution i know to that is using any Factorio Mod Manager. Such thing loads instantly and can save several different mod configurations, or a profile to instantly disable all mods. It writes the mod configuration file on Factorios behalf so you'll see the effect immediately ingame once you launch game.
Nice! Thank you for the suggestion.

Joriom
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed May 07, 2014 9:39 pm
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by Joriom » Sun Nov 20, 2016 2:51 pm

brab wrote:Regarding playing with different mods, is there an easy way to play several local games with different mods and switch between them without having to manually toggle the mods needed? I know Factorio has to restart when changing mods, but it would be great to have a button that lets one switch to the mods of a saved game in the loading menu.
What I do most of the time if I need to use more than 1 mod "pack" for different local games/servers is... make few copies of "mods" folder where it's stored in %appdata%. Then I manually rename it to something like "mods_sp_bobs" and change the one i want to currently use back to plain "mods".

Mengmoshu
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Tue May 26, 2015 11:24 pm
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by Mengmoshu » Sun Nov 20, 2016 10:31 pm

Regarding maintaining different "modpacks" for different games:

There's a command line option to change which folder Factorio looks in for mods. I make a desktop shortcut for each set of mods I'm actively using.

For the Steam version:
"C:\Program Files (x86)\Steam\Steam.exe" -applaunch 427520 --mod-directory %APPDATA%\Factorio\packs\YourPackFolder

For the Website versions:
factorio.exe --mod-directory %APPDATA%\Factorio\packs\YourPackFolder

You'll need to adjust those to fit your configuration of course. I find it's at least as reliable as any mod manager, and the ingame mod downloader will use whatever you've pointed the game at.

User avatar
Andrzejef
Fast Inserter
Fast Inserter
Posts: 103
Joined: Sat Aug 27, 2016 1:16 pm
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by Andrzejef » Sun Nov 20, 2016 11:25 pm

Well, a bit late but still -
first off - the render, even though simple (or maybe because of that), is beautiful, made it to my wallpaper :)
Now, about optimalisations - the game runs smooth for me, I didn't notice any drops so far, co - needless to say - I am really pumped to see it getting even more smooth :)
About mod support - I play only vanilla version so far, but I might help myself to some, regarding trains handling :)

And hey, I still think of that Gustav, you know? He would render very well too I think :D
For those that do not know what Gustav
Image

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1164
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: Friday Facts #165 - Death by a thousand cuts

Post by Mooncat » Mon Nov 21, 2016 1:51 am

Zaflis wrote:I too have been silently concerned about performance of my mod sometimes. It takes just 0.25ms or so but it was more than many actually big mods. So when i looked in the code:

Code: Select all

script.on_event(defines.events.on_tick, function(event)
  if game.tick % 2 == 0 then
    for i = 1, #game.players do
      local player = game.players[i]
      if player.vehicle and player.vehicle.valid then
        local v = player.vehicle.type
        if v == "car" or v == "tank" then
          ...
        end
      end
    end
  end
end
There wasn't any glaringly obvious... except for "local player = ...". I assume LUA doesn't work with pointer references, so what it actually does is copy the entire player structure (which is apparently big), and it does that every second tick for every player. So i'd assume solution is to get rid of it and use direct reference:

Code: Select all

if game.players[i].vehicle and game.players[i].vehicle.valid then
So yeah, i don't know if you are dealing with these sort of code pieces, but it's a thing :)

Other thing i often see is people use sqrt() when counting if something is within circular radius. a^2 + b^2 = c^2, so all you need to do is square the comparison value.
No, LUA can pass objects by reference.
http://stackoverflow.com/questions/6128 ... -reference

Code: Select all

local player = game.players[i]
is better.

Here is a link shared by Choumiko: https://springrts.com/wiki/Lua_Performa ... _for-loops

And I wonder

Code: Select all

for i = 1, #game.players do
is doing wrong... not so sure though, because I use

Code: Select all

for index, player in pairs(game.players) do
instead. I'm not sure whether there can be nil entries inside game.players due to player removal in multiplayer games.

Post Reply

Return to “News”

Who is online

Users browsing this forum: No registered users