Friday Facts #324 - Sound design, Animated trees, Optimizations

Regular reports on Factorio development.
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Impatient »

First, I praise the universe or kovarex or whoever is responsible, that wube has a dev like rseding who's passion it is to optimize code.

Second, a big thanks to rseding for delivering an awesome speed boost to factorio.

Third, a question to rseding, if you can describe in a nutshell what the difference is between the event-subscriber pattern and the targeter pattern. It sounds like the same, just inverted. Instead of the subscription, the pointer to the target is deleted. Or is this the main difference?

Forth, a request to the game designers (kovarex?) and ian the sound designer, to set some resources aside to rework the train sounds. I feel the train sounds are flat, boring and non immersive at the moment. And I think they are completely wrong in terms of physics. IRL engines make the most noise, when they generate the most torque. This is when they accelerate most. Which is, when they increase velocity or pull the weight against track and air friction. So imo train should be loudest, when they start moving, when they are very fast (matches what factorio delivers at the moment) or when they have to pull a lot of weight (also if they are very slow). Also there are no breaking sounds. Trains make a whole lot of breaking noise. Given that factorio has a steam-punkish, a bit ramshackled setting, I miss them even more. The ka-klang noise, I perceive as very coutnerintuitive as well. Those sounds, we know from RL very well, originate from the wheels hitting uneven spots on the tracks. Mostly little gaps between track sections, which are not welded together. Anyways, they are stationary with the track and occour for every single wheel passing that spot. So for a lcomotive they should be a ka-ka-klang for each of it's two triple axles and then a ka-klang for each of the two twin axles of each waggon. Well, maybe I am taking this too far now. I don't know. Let's say, realistic ka-klang sounds are a nice to have.
Train Sounds
factoriouzr
Filter Inserter
Filter Inserter
Posts: 690
Joined: Sat Jun 06, 2015 2:23 am
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by factoriouzr »

This is all great. Good work everyone.

With this new even framework, can you please implement the ability to set not yet researched recipes on factories especially from blueprints. It often happens that we have many blueprints built up in our library for many different things over the many many games we have played. When playing again, your research order will not be the same as last time and when you put down a blueprint, anything that is not yet researched will not be set on the factories in the blueprint. This is not intuitive and behaves differently then everything else set from blueprints (viewtopic.php?f=6&t=28954).

Also it's good to have tree animations and it looks better then not having them, but somehow they still look a bit like just using a noise function and not the actual leaves moving. It looks like a distortion filter was just applied to slightly pull and push parts of the tree sprite.

Thanks
Antyradek
Inserter
Inserter
Posts: 26
Joined: Mon Mar 18, 2019 10:35 pm
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Antyradek »

If you are struggling with memory, you could pack the most important data into structures, which would be easily cached by CPU into cache memory.
User avatar
Reika
Filter Inserter
Filter Inserter
Posts: 583
Joined: Tue May 19, 2015 1:56 am
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Reika »

I am very happy you have implemented moving trees, but I am not all that enamored with the effect you have chosen. In particular, there seems to be a very high-frequency (in screen space, not time) layer to the distortion that results in the movement and the edges of the sprites resembling a "frosted glass" effect as seen in image editors:
Image

In other words, the pixels near the edge of sprites seem randomly scattered, and within the sprite frame-to-frame movement also results in a lot of random scattering of individual pixels, as opposed to smooth movement of larger regions.

This phenomenon is both ugly and I suspect prone to causing eyestrain.
Image
Vxsote
Inserter
Inserter
Posts: 38
Joined: Sat Oct 01, 2016 12:51 am
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Vxsote »

Shingen wrote: Fri Dec 06, 2019 12:32 pm
This is another nice example of "Factorio is not CPU bound, it's memory latency bound". More cores wasn't going to make this faster - because it was never limited by how fast the CPU ran.
uhh what? no.
more cores weren't going to make this faster, because no N-threaded program will run faster if you just "throw more cores at it" (i.e. if you already have N cores and add more).
number of cores != speed of the CPU.
I think you should give the devs a little more credit than that. I clearly understood "more cores" to include modifying the algorithm to use more threads so that it could run on more cores. If you read between the lines (just a tiny little bit) it makes perfect sense.

On the other hand, these types of problems (speaking generally) can fall into the category of "embarrassingly parallel", where potentially running them on a GPU can give you access to both many more "cores" and much faster memory. The overall computation can be much faster while using almost no CPU. However, my experience with GPGPU is limited to OpenCL, and at least with that there is a pretty significant latency penalty associated with moving data to the GPU and back. Plus you are consuming GPU resources which you might not want to take away from drawing nice pictures.

Anyhow, three cheers for devs and their optimization efforts!
User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 471
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Therax »

Impatient wrote: Fri Dec 06, 2019 5:45 pm Third, a question to rseding, if you can describe in a nutshell what the difference is between the event-subscriber pattern and the targeter pattern. It sounds like the same, just inverted. Instead of the subscription, the pointer to the target is deleted. Or is this the main difference?
I believe the new behavior is basically the Observer pattern. Factorio has had a system forever called Targeters for storing relationships between different objects that takes care of the concerns in the FFF: handling when an object disappears, and keeping track of those relations over a save-load cycle. These have always been used to do things like track what machine an inserter is inserting into.

As I understand it, the big idea was extending Targeters to implement the Observer pattern so that the object being targeted can act as an observable and notify the objects targeting it (which are now observers). An inserter inserting into a cargo wagon has always had a Targeter pointing to that cargo wagon, and it had to check the cargo wagon every time to make sure it was still in range. Now, the cargo wagon can notify the inserter (its observer) when it moves, so the inserter can avoid all those repeated checks for relatively rare occurrences.
Vxsote wrote: Fri Dec 06, 2019 7:02 pm On the other hand, these types of problems (speaking generally) can fall into the category of "embarrassingly parallel", where potentially running them on a GPU can give you access to both many more "cores" and much faster memory. The overall computation can be much faster while using almost no CPU. However, my experience with GPGPU is limited to OpenCL, and at least with that there is a pretty significant latency penalty associated with moving data to the GPU and back.
Pretty much as you state, while the on-card memory of a GPU is very fast, transfers between the card and main memory are much slower, so you only see an overall advantage when the data you're processing is in big, homogenous, highly-structured blocks, such as HPC (large matrices), machine learning or of course graphics (3D geometry and textures). I believe the structure of factories is much too variable for it to be profitable to move to GPU.
Last edited by Therax on Fri Dec 06, 2019 7:30 pm, edited 2 times in total.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
TreefrogGreaken
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Thu May 04, 2017 12:07 pm
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by TreefrogGreaken »

Have to agree with others here, the noise on those leaves, is rather distracting and overall doesn't look that nice.

If you keeps your eyes centered, then you can see the wave effect going on and almost predict where its going to be next. I think it needs to be a bit more random. When ever Ive been around trees on breezy days, you'll see some trees moving with the wind, others not moving at all.

If the noise was sorted and the effect made a bit more sporadic then all over then it may look much nicer.
Hiladdar
Fast Inserter
Fast Inserter
Posts: 214
Joined: Mon May 14, 2018 6:47 pm
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Hiladdar »

Allaizn wrote: Fri Dec 06, 2019 4:53 pm
OvermindDL1 wrote: Fri Dec 06, 2019 4:11 pm I quite want it on, but perhaps instead of a toggle you could add a slider for 'intensity' of the effect (a simple 0-N bias scale, where 0 is off (can just not run that shader then, fallback to the normal texture shader) and non-0 is a scale, can even turn it above 1.0 for a 'larger' effect (likely just adding a uniform to the shader depending on how it's all written)?
The values are not hardcoded, but instead defined by utility-constants.lua. I guess this means that an adjustment mod could be made (or you can just change them yourself in that file). The effect as it is right now is quite subtle - I'd be surprised if people end up having problems with it during normal gameplay.
I would like to see sliders for intensity, built included in the base game. This way if someone gets motion sickness from the water or trees, they can scale it back to a level that is tolerable for them. Also when the setting is set to 0 it is turned off. The converse is someone, may want to amplify the graphic effect, beyond the subtle.

Regarding performance, playing on an older computer, laptop, or older screen may experience performance issues, especially on a larger base. It makes sense to turn graphics on for the first part of the game, then to manually turn the graphics off as the base grows.

Hiladdar
OvermindDL1
Fast Inserter
Fast Inserter
Posts: 195
Joined: Sun Oct 05, 2014 6:12 am
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by OvermindDL1 »

TreefrogGreaken wrote: Fri Dec 06, 2019 7:19 pm If you keeps your eyes centered, then you can see the wave effect going on and almost predict where its going to be next.
That's generally what I see in real life. Like a pecan tree field nearby, I live in an extremely flat area, so the wind quite literally makes rippling waves across the whole field like a sine wave. I'd prefer if Factorio did more of this style.
TreefrogGreaken wrote: Fri Dec 06, 2019 7:19 pm When ever Ive been around trees on breezy days, you'll see some trees moving with the wind, others not moving at all.
Never really seen that. Only time I see a tree not moving but others do (among the same 'wave' of wind) is if it's a different type of tree that takes a lot more power.
Omarflyjoemacky
Fast Inserter
Fast Inserter
Posts: 104
Joined: Tue Nov 15, 2016 10:56 pm
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Omarflyjoemacky »

Definitely looks better sped up.. will that be an option in the game or can it be modded for speed?

EDIT: Saw the post where it's a setting in the file. Nice!
"And then Bender ran."
JadeSpider
Burner Inserter
Burner Inserter
Posts: 17
Joined: Mon Sep 26, 2016 7:04 pm
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by JadeSpider »

The trees look like they are underwater. It is really disturbing to look at. That is not remotely how trees move in the wind. I love the idea of animated trees, but this needs some art direction.

Why not make sprite animations for trees?
Last edited by JadeSpider on Fri Dec 06, 2019 8:53 pm, edited 1 time in total.
Koub
Global Moderator
Global Moderator
Posts: 7902
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Koub »

factoriouzr wrote: Fri Dec 06, 2019 5:55 pm With this new even framework, can you please implement the ability to set not yet researched recipes on factories especially from blueprints.
viewtopic.php?p=220543#p220543
viewtopic.php?p=276416#p276416

Back to topic. I truly love the trees, the water presented last week, and obviously the optimizations :)
The crackling sounds the biters make when running too, but I'm less convinced by the "humming" breath sound they sometimes make.
Koub - Please consider English is not my native language.
quyxkh
Smart Inserter
Smart Inserter
Posts: 1031
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by quyxkh »

It's been clear for some time now that there's something wrong with these people: they are far too awesome, and yet they are not Gods. We must have actual apotheosis, perfection in both product and flesh, or else we will abandon the game and badmouth them forever. Them's The Rules.
bluerock
Inserter
Inserter
Posts: 28
Joined: Fri Sep 08, 2017 7:11 pm
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by bluerock »

Regarding sound... Is there a way to make it so that if a certain sound plays in rapid succession (which often happens to me if my internet connection is not so good), that the volume of each individual sound doesn't add together creating an unusually loud sound ? Worst is the sound of building placement sometimes sounding 10x louder. Hopefully I can get a better internet connection. But right now I find myself needing to turn down the nice sounds to save my ears for an occasional lagged sound burst. I know that internet connection issues are never your issue and are unavoidable. But perhaps there is a way to save our ears when it does happen?
User avatar
Philip017
Filter Inserter
Filter Inserter
Posts: 360
Joined: Thu Sep 01, 2016 11:21 pm
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Philip017 »

i look forward to seeing the optimizations that rseding is making, it's always nice to have a faster game once the base gets massive. :D

I hope that along with the water, the tree's new features are optional. potato's still wandering around. or maybe we would prefer to not be distracted by them. ;)
User avatar
Astrella
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Wed Sep 16, 2015 11:33 am
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Astrella »

MrBuisson wrote: Fri Dec 06, 2019 3:09 pm Soooo, when do we get that update :twisted:
I mean, 2.3 time faster (even if only part of the whole update) is not small !

On a side Note, there is one thing that I cannot fathom when factorio staff talk about multithreading: factorio already cut the whole map in chunks, why not making each chunk it’s own thread with its own data ? Even if that mean starting 40k+ threads, it’s not like there is a lot of interaction between chunks. And if a chunk is too small, make it a super 2x2 group of chunk : reduce border interactions.
I’m not saying put the “whatever module” into a thread, but make many mini but fully functional factorio blocks that interact one with another.
Just my external view on the thing, but i’d be interested to know if this has been ever considered by the guys doing the stuff (and what would be the reason why it’s not good).

And like always, keep on doing such a great job
Because that adds a huge amount of complexity for debatable gains. Like, the chunks will still have to wait for each other, there's tons of bleed between chunks e.g. entities moving between them, you need an entire communication framework then to transfer stuff between being handled by different threads... Multithreading is handy when the stuff you're putting on separate threads isn't time critical. E.g. filling in components in a UI with delay cause you're waiting for a database query. Games tend to desire a lot of exact timing though which makes them way less suitable for multithreading.
Wubinator
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Feb 19, 2016 4:52 pm
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Wubinator »

As a programmer myself (not a game developer at all though) I love these kind of more technical explanations.
Awesome to see how new insights can still lead to such big improvements even after all the optimizations and incredible performance gains you guys did for the 0.15.x release ( hope my memory serves me right by saying 0.15 ;) )
User avatar
Nexarius
Filter Inserter
Filter Inserter
Posts: 275
Joined: Sat May 09, 2015 7:34 pm
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Nexarius »

Antyradek wrote: Fri Dec 06, 2019 6:33 pm If you are struggling with memory, you could pack the most important data into structures, which would be easily cached by CPU into cache memory.
The L3 cache on my computer right now is just 16MB. Thats too tiny.
Factorio needs several GB when running even when considering that a lot of that is sounds, sprites and stuff.
Inari
Burner Inserter
Burner Inserter
Posts: 13
Joined: Fri Apr 14, 2017 9:16 pm
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Inari »

For the optimizations, are you using or have you considered using tools like coz (causal profiling) or Stabilizer (layout randomization)?

Stabilizer basically repeatedly randomizes the layout (function adresses, heap allocation, stack frame sizes), because layout tends to depend on a lot of things (including in some cases even your username when compiling). Different layouts can lead to slight performance changes, so if after a change one gets a small performance improvement, it might be due to the change, or just due to the change leading to better layouting (which can be undone by another change). Paper: https://people.cs.umass.edu/~emery/pubs ... plos13.pdf (An [imo] interesting talk about it: https://www.youtube.com/watch?v=r-TLSBdHe1A )

coz (or causal profiling in general) tries to speed up parts of the program to measure what effect it would have to optimize that part. Well, it can't just do magic, so what it actually does is slow down other concurrently running parts to simulate the speedup, but it leads to the same results. It can give more insights than (only) a traditional profiler might offer. Your FFF actually reminded me of it, because a (very simple) example given:
Create thread A, which just counts to 2000000000
Create thread B, which just counts to 1900000000
Join A (=wait for it to finish)
Join B (=wait for it to finish)

Now a conventional profiler would show you that the program spent e.g. 7.2 seconds in A and 5.89 seconds in B. But optimizing B would have no effect on performance because it already finished before A (as they run in parallel and B has less to count). While optimizing A has a max performance improvement of e.g. 4.5%, as making it faster than B won't have any changes either (unless you then go and optimize B too of course).

coz is also mentioned in the talk linked above, but it has its own paper too: http://sigops.org/s/conferences/sosp/20 ... singer.pdf
User avatar
Scherazade
Burner Inserter
Burner Inserter
Posts: 8
Joined: Fri Jun 08, 2018 10:06 am
Contact:

Re: Friday Facts #324 - Sound design, Animated trees, Optimizations

Post by Scherazade »

Nice; I am playing with minimum to no sound and I also turn trees off.
Still great to see the game is being developed.
Post Reply

Return to “News”