Friday Facts #281 - For a Few Frames More

Regular reports on Factorio development.
MassiveDynamic
Filter Inserter
Filter Inserter
Posts: 261
Joined: Sun Sep 16, 2018 10:44 pm
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by MassiveDynamic »

Wow!

Hey is that a squirrel over there?
Mike Pote
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Nov 17, 2018 9:22 am
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by Mike Pote »

posila wrote: Fri Feb 08, 2019 8:51 pm
Mike Pote wrote: Fri Feb 08, 2019 8:35 pm @posila Forgive me for wondering the obvious, but before you guys went down the turret radius pixel shader rabbit hole, I'm wondering why you don't just render a semi-transparent triangle fan over the map to form a circle for the turret radius? I'm pretty sure you're already doing this for the electricity network visualisation and the car and tank icons. You could use the stencil buffer to prevent overdraw from overlapping radii here too, and it would cut out your pixel shader having to test each and every single pixel on the screen for a radius.

Something like this, but obviously with enough vertexes to look smooth:
Image


I'm guessing you already tried that and it wasn't performant enough?
The middle mesh (I should have written mesh instead of geometry in the blog post, I suppose) is how we always draw it in 0.16 and still in 0.17 until you zoom in close enough onto cluster of turrets and the optimized version kicks in (we use trinagle strip instead of tringle fan because we can batch several circles into single draw call using degenerated triangles) and is what we needed to optimize. Stencil buffer was one of the two ideas we had (and first one we tried out) but it still was not fast enough, so we went to try out the second idea which was drawing geometry procedurally in shader, and were disappointed by its extraordinaly poor performance in some cases ... so we went on to come up with more ideas and essentially ended up combinig the two initial solutions.
Awesome! I knew it would have been carefully considered first and all angles thoroughly tested. Keep up the amazing work!
User avatar
Philip017
Filter Inserter
Filter Inserter
Posts: 360
Joined: Thu Sep 01, 2016 11:21 pm
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by Philip017 »

Bilka wrote: Fri Feb 08, 2019 3:30 pm
Leopard1800 wrote: Fri Feb 08, 2019 3:25 pm Would it be possible to cache the sprite atlases to disk (in some GPU friendly format) after they have been made so that they can be loaded directly the next startup?
Go into the config and change

Code: Select all

; Options: true, false
; cache-sprite-atlas=false
to

Code: Select all

; Options: true, false
cache-sprite-atlas=true
im wondering why this is not true by default, imo it should be... and if there is a problem then it would delete the cache and recreate it. faster loading next time if there are no changes.

also i always play with smoke off as it is too dense, that steam over the reactor setup is too obscuring to be able to work under it, it needs to be half that imo. although the decoratives are ok, i prefer the way it was in 0.13, alot fewer of them, sometimes i just turn them off, especially when they grow through my belts, factories, rails, bricks, concrete, ect.

otherwise great news for 0.17 and i look forward to it! keep up the good work.
User avatar
Dixi
Fast Inserter
Fast Inserter
Posts: 200
Joined: Sat Nov 04, 2017 1:47 pm
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by Dixi »

Philip017 wrote: Fri Feb 08, 2019 10:05 pm that steam over the reactor setup is too obscuring to be able to work under it
Adds more realism? :-) In RL they usually turn off turbine, before doing some works.

But I agree, less dense smoke will be better.
User avatar
Light
Filter Inserter
Filter Inserter
Posts: 678
Joined: Mon Oct 10, 2016 6:19 pm
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by Light »

Philip017 wrote: Fri Feb 08, 2019 10:05 pm
Bilka wrote: Fri Feb 08, 2019 3:30 pm
Leopard1800 wrote: Fri Feb 08, 2019 3:25 pm Would it be possible to cache the sprite atlases to disk (in some GPU friendly format) after they have been made so that they can be loaded directly the next startup?
Go into the config and change

Code: Select all

; Options: true, false
; cache-sprite-atlas=false
to

Code: Select all

; Options: true, false
cache-sprite-atlas=true
im wondering why this is not true by default, imo it should be... and if there is a problem then it would delete the cache and recreate it. faster loading next time if there are no changes.
Vanilla without mods loaded in 15 seconds by default and became 7 seconds with the cache enabled. The atlas cache was then created as a 2.38GB file in the Factorio folder.

Enabling my mods it went from 1:37 load time to 1:13. The atlas cache file was 5.94GB.

Those who use mods would need the most improvement compared to the slimmer vanilla. However, given the large file it creates just for a rather lackluster improvement, I'd be hard pressed to recommend that being active by default unless you're getting 5 minute load times (mostly due to sprites) and have an SSD to make the process remotely worthwhile.
Henry Loenwind
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Fri Mar 09, 2018 7:33 pm
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by Henry Loenwind »

What I miss in most games is a "test" button in the graphics settings that renders a couple of scenes and reports the fps. Especially in games where the screen starts out empty and fast to render...
psihius
Fast Inserter
Fast Inserter
Posts: 192
Joined: Mon Dec 15, 2014 12:47 am
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by psihius »

I was wondering - we have good decoratives for the grasslands that as it turns out, by accident, make rails look good (or at least interesting), but other surface decorations do not really have anything that can do something similar to the rails. Maybe, if time allows, something similar can be added to other surface types? Like sandbars for dessert, mud for the muddy type surface and so on?
I just looked up the modding API and poked Mylon a bit and want to implement grass growing over the rails with time, but that will work only for those types of surfaces that have appropriate types of foliage. Not gonna be good looking with desert and alike :)
Gobbel2000
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed May 09, 2018 6:56 pm
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by Gobbel2000 »

Henry Loenwind wrote: Fri Feb 08, 2019 10:55 pm What I miss in most games is a "test" button in the graphics settings that renders a couple of scenes and reports the fps. Especially in games where the screen starts out empty and fast to render...
With the cutscene controller announced in FFF #273, it should be easy to create a demanding benchmarking world that can be included by the game as a scenario or downloadable save file. One official map would make performance testing and comparing much easier for players as well as the developers.
User avatar
Philip017
Filter Inserter
Filter Inserter
Posts: 360
Joined: Thu Sep 01, 2016 11:21 pm
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by Philip017 »

Light wrote: Fri Feb 08, 2019 10:49 pm Vanilla without mods loaded in 15 seconds by default and became 7 seconds with the cache enabled. The atlas cache was then created as a 2.38GB file in the Factorio folder.

Enabling my mods it went from 1:37 load time to 1:13. The atlas cache file was 5.94GB.

Those who use mods would need the most improvement compared to the slimmer vanilla. However, given the large file it creates just for a rather lackluster improvement, I'd be hard pressed to recommend that being active by default unless you're getting 5 minute load times (mostly due to sprites) and have an SSD to make the process remotely worthwhile.
vanilla with out mods for me 18 seconds to launch with out cache, with cache 5 seconds.
the file 'atlas-cache.dat' consumes 2.38gb on my drive, located at '%appdata%/factorio' i feel it is easily sacrificed for 13 seconds of launch time.
an option to enable this, in the options menu under graphics, would be nice instead of digging into the config file i never knew about till today.
if this option was enabled by default then more disk space would be used true, however imo most people i doubt they would even notice it missing. but anyone that launches the game repeatably will notice the launch speed difference, if they only knew about it.
Last edited by Philip017 on Sat Feb 09, 2019 12:43 am, edited 1 time in total.
luc
Fast Inserter
Fast Inserter
Posts: 225
Joined: Sun Jul 17, 2016 9:53 pm
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by luc »

Henry Loenwind wrote: Fri Feb 08, 2019 10:55 pm What I miss in most games is a "test" button in the graphics settings that renders a couple of scenes and reports the fps. Especially in games where the screen starts out empty and fast to render...
Woa, killer idea here!

Why fiddle with the controls and have to figure out specific settings for your GPU, if the game can just try out a few things and give you the option of "optimize for mega base", "balanced", and "optimize for beauty"?

I really like that idea.
christian
Long Handed Inserter
Long Handed Inserter
Posts: 64
Joined: Fri Jun 08, 2018 12:44 am
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by christian »

luc wrote: Sat Feb 09, 2019 12:51 am
Henry Loenwind wrote: Fri Feb 08, 2019 10:55 pm What I miss in most games is a "test" button in the graphics settings that renders a couple of scenes and reports the fps. Especially in games where the screen starts out empty and fast to render...
Woa, killer idea here!

Why fiddle with the controls and have to figure out specific settings for your GPU, if the game can just try out a few things and give you the option of "optimize for mega base", "balanced", and "optimize for beauty"?

I really like that idea.
Agreed I like that idea
quyxkh
Smart Inserter
Smart Inserter
Posts: 1031
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by quyxkh »

Light wrote: Fri Feb 08, 2019 10:49 pm Vanilla without mods loaded in 15 seconds by default and became 7 seconds with the cache enabled. The atlas cache was then created as a 2.38GB file in the Factorio folder.

Enabling my mods it went from 1:37 load time to 1:13. The atlas cache file was 5.94GB.
On my HDD box:

cold OS cache, no sprite atlas, seablock, Sprites Loaded at 32.164 sec. Hot cache, 19.923 sec.
cold OS cache, sprite atlas, seablock, Sprites Loaded at 39.854 sec. Hot cache, 13.933 sec.

cold OS cache, no sprite atlas, vanilla, Sprites Loaded at 23.098 sec. Hot cache, 12.269 sec.
cold OS cache, sprite atlas, vanilla, Sprites Loaded at 25.036 sec. Hot cache, 7.110 sec.

Time to read the seablock atlas from disk is 22.5s. The time to decompress a `zstd -1`'d seablock atlas from disk to tmpfs (basically, ram disk) is 6 seconds flat. I'll keep saying it: `zstd -1`ing the atlas caches would get a really dramatic startup-speed boost, even on SSDs.
code_deamon
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Feb 09, 2019 1:26 am
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by code_deamon »

Instead of an off-screen render or passing the list with all turret to the pixel shaders another idea may be to pass the list of turrets in a (macro)tile and pass a tile map to the shader. You can easily create a linked-list of tile on CPU every time someone add/remove a turret.

Because the map is infinite you should limit the tile map to 1024x1024 and use multiple tile maps for huge factories.
roothorick
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Mon Aug 11, 2014 5:22 am
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by roothorick »

Proxy wrote: Fri Feb 08, 2019 5:01 pm ok so if this gets optimized even more i could probably play it on a Raspberry Pi and take it with me for on the go
We'd need ARM binaries first. I strongly suspect Wube has resorted to inline assembly numerous times, so this would be a substantial undertaking for hardware that would have a very hard time with the game in the first place. (ARM is sloooooooooow! Just for one example, the Switch's SoC is roughly equivalent to a 500Mhz Ivy Bridge era Core i5. Ouchie.)

Now, don't let me dash your dreams. You just need an SBC with an x86 processor, and there's quite a few. The LattePanda is probably the most promising for this application.
JD-Plays
Inserter
Inserter
Posts: 21
Joined: Thu Mar 16, 2017 10:13 pm
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by JD-Plays »

Bilka wrote: Fri Feb 08, 2019 3:30 pm
Leopard1800 wrote: Fri Feb 08, 2019 3:25 pm Would it be possible to cache the sprite atlases to disk (in some GPU friendly format) after they have been made so that they can be loaded directly the next startup?
Go into the config and change

Code: Select all

; Options: true, false
; cache-sprite-atlas=false
to

Code: Select all

; Options: true, false
cache-sprite-atlas=true
Can we please have that as a toggle option inside the new and improved GUI?
roothorick
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Mon Aug 11, 2014 5:22 am
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by roothorick »

Tomik wrote: Fri Feb 08, 2019 8:06 pm So what about Linux/UNIX OS optimization? It is similar to Windows and iOS?
Factorio doesn't have an iOS version... I assume you mean OSX? Which is under the Unix umbrella, specifically in the BSD family as a proprietary variant of Darwin, but I digress.

In today's FFF, they wrote off BC7 as unacceptable in part because it isn't supported by OSX. BC3 and BC4 have been implemented on most hardware on Mesa as well as by Nvidia's proprietary driver, so the optimization discussed here can safely be applied unilaterally on Linux systems.

It's my understanding that Linux and OSX are getting a new rendering backend as well based on OpenGL 3.x, I assume core profile, so potentially a huge win. We're not being left out :)
User avatar
func_door
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sat Jun 11, 2016 5:37 am
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by func_door »

CakeDog wrote: Fri Feb 08, 2019 3:24 pm Am I weird for liking the 'noisy' look of low quality compression?
Gave me Starcraft vibes, must be the nostalgia of compression :p
Xuerian
Inserter
Inserter
Posts: 36
Joined: Mon Nov 07, 2016 7:10 am
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by Xuerian »

Really enjoyed reading the post, and looking forward to all the performance improvements.

Nothing great to add.
User avatar
Acid_Burn9
Inserter
Inserter
Posts: 33
Joined: Sat Feb 09, 2019 8:17 am
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by Acid_Burn9 »

Turret range visualization optimized? Great, but look at this!
FPS without logistic network visualization (downscaled to 1440p to reduce size. server doesn't want to accept 16.8MB file)
FPS without logistic network visualization (downscaled to 1440p to reduce size. server doesn't want to accept 16.8MB file)
Снимок экрана (417).png (8.02 MiB) Viewed 8040 times
FPS with logistic network visualization
FPS with logistic network visualization
Снимок экрана (416).png (15 MiB) Viewed 8040 times
Unbelievable FPS drops. Never had them in Factorio before. Happens only in map view, when this button
Снимок экрана (418).png
Снимок экрана (418).png (10.66 KiB) Viewed 8040 times
is turned on (while just hovering above dronestation everything is fine).
That's what really should be optimized lol.

i7-6700K, GTX 1080, 16GB DDR4, win10 64bit

P.S. Thank you for awesome game ^-^
MicFac
Fast Inserter
Fast Inserter
Posts: 114
Joined: Sun Nov 20, 2016 7:33 pm
Contact:

Re: Friday Facts #281 - For a Few Frames More

Post by MicFac »

These results look extremely promising. The highest render time I could find on the "New" benchmark was 22.62ms which would be about 44 FPS whereas with the old build the lowest FPS would be about half that. Although the integrated graphics had the low quality compression enabled, this was with high resolution sprites in a scenario that has extraordinarily much to render.
Post Reply

Return to “News”