▶
Friday Facts #271 - Fluid optimisations GUI Style inspector
GDS 2018 will be taking place next week, running from Friday 7th to Saturday 8th. This year, like last year, we are silver sponsors of the event, which means you will see some Factorio branding around the event and in their official booklet. Part of the preparation on our side was to produce a nice graphical asset for their use, which you can see below:
The image is an aesthetic composition to showcase the design and theme of the game and its elements (while not necessarily making logical sense), and also contains the first public display of our new official Wube Software logo. About half the office team here will be attending the event, so if you are also going you might bump into us.
We are tackling the fluid changes in 3 stages:
The other problem is, that the pipe memory is scattered around randomly. So we cut all the fluidboxes from the entities using them, and put them in a separate system (we call it the Fluid Manager). It is storing the fluidboxes like this:
The advantage of having data in continuous memory is mainly the fact that when CPU is copying the data from memory to cache, it is doing it in chunks, so when updating one thing, the next one is already in the cache. Modern CPUs are also smart, and they can detect continuous memory access, so they start prefetching the subsequent fluidboxes automatically in advance. But it is not that simple, as the fluidbox always has neighbours (as the flow is from one fluidbox to others), and one of the neighbours can be on the other part of the continuous memory, out of cache, so it is still not perfect. The next step was to divide the fluid boxes in something we call a Fluid system. A fluid system is basically all the Fluidboxes that are connected together. So, for example, in this refinery setup there are 5 fluid systems.
Each of the fluid system is now its own separate continuous memory of fluid boxes in it. The first advantage of this is that it increases the chance that the neighbours of a water pipe are close (memory wise) to the original pipe, the cached data from touching it for update could still be there when it is being touched as a neighbour. But the second advantage is even greater, as the fluid systems are now independent and fluid flow doesn't interfere with anything else in the map, their update can be completely parallelized without any worries. So we just did that. The final benchmark on a real fully producing map that uses pipes for production of materials and power (nuclear reactors), I was able to see a 6.5 times speedup of only the pipes update. The speedup wasn't so big on less beefy computers as it depends on the CPU, cache sizes, CPU core count etc. but was still around 3 times faster. I also expect the speedup to get bigger with bigger factories with more separate fluid systems and also with future CPU with more cores. Dominik did benchmarked every step with a real save game on his reasonable i7-4790k, and recorded with the following overall performance gains.
(The graph shows some unexplained intermediary steps.) Just a reminder that this is just a stage 1, before actually merging straight pipe sections into one fluid box which should improve things again. Even in systems with a lot of branching, as even 2 fluidboxes merged into 1 should help. In the example of refinery setup above, it seems that the fluidbox count could be reduced by factor of 4 or so. That should make the savings big enough to justify the planned 2 times slowdown of the future fluid flowing algorithm, as we will probably need 2 passes to make it work good enough. Dominik will have an update on the algorithm and conclusions from the previous discussions in a future FFF.
The implementation of several GUI redesigns is in progress, and it is being done by several team members. Suddenly we realized that coordinating more people brings new problems (what a surprise^^). We started to have mess in the styles, as everyone was inventing their own styles for the GUI to be same as the graphical mock-ups given by the graphics department. After some discussions of how to solve this, we realized, that we mainly need some common language with the graphical department when it comes to the style hierarchy names. For that we need everyone to be able to quickly inspect which styles are used where and what is the hierarchy. For that reason, we made the GUI style inspector. By pressing a key (Control + F6 by default), every UI element will show a tooltip with information about the widget and its style, and will highlight of the widget as well. We wanted to use it only internally first, but we decided, that if it shows some info for the GUI created by scripts/mods, like name and type, it might be also useful for mod writers to be able to quickly inspect what is going on.
We even use colors to help us navigate:
[ 2018-11-30 15:34:46 CET ] [ Original post ]
Game Developers Session 2018
GDS 2018 will be taking place next week, running from Friday 7th to Saturday 8th. This year, like last year, we are silver sponsors of the event, which means you will see some Factorio branding around the event and in their official booklet. Part of the preparation on our side was to produce a nice graphical asset for their use, which you can see below:
The image is an aesthetic composition to showcase the design and theme of the game and its elements (while not necessarily making logical sense), and also contains the first public display of our new official Wube Software logo. About half the office team here will be attending the event, so if you are also going you might bump into us.
Fluid optimisations
We are tackling the fluid changes in 3 stages:
- Move all the fluid logic into a separate system.
- Merge straight sections of pipes into segments.
- Tweak the fluid flow logic, which will not be an optimisation, but a gameplay mechanics improvement (FFF-260).
The other problem is, that the pipe memory is scattered around randomly. So we cut all the fluidboxes from the entities using them, and put them in a separate system (we call it the Fluid Manager). It is storing the fluidboxes like this:
The advantage of having data in continuous memory is mainly the fact that when CPU is copying the data from memory to cache, it is doing it in chunks, so when updating one thing, the next one is already in the cache. Modern CPUs are also smart, and they can detect continuous memory access, so they start prefetching the subsequent fluidboxes automatically in advance. But it is not that simple, as the fluidbox always has neighbours (as the flow is from one fluidbox to others), and one of the neighbours can be on the other part of the continuous memory, out of cache, so it is still not perfect. The next step was to divide the fluid boxes in something we call a Fluid system. A fluid system is basically all the Fluidboxes that are connected together. So, for example, in this refinery setup there are 5 fluid systems.
Each of the fluid system is now its own separate continuous memory of fluid boxes in it. The first advantage of this is that it increases the chance that the neighbours of a water pipe are close (memory wise) to the original pipe, the cached data from touching it for update could still be there when it is being touched as a neighbour. But the second advantage is even greater, as the fluid systems are now independent and fluid flow doesn't interfere with anything else in the map, their update can be completely parallelized without any worries. So we just did that. The final benchmark on a real fully producing map that uses pipes for production of materials and power (nuclear reactors), I was able to see a 6.5 times speedup of only the pipes update. The speedup wasn't so big on less beefy computers as it depends on the CPU, cache sizes, CPU core count etc. but was still around 3 times faster. I also expect the speedup to get bigger with bigger factories with more separate fluid systems and also with future CPU with more cores. Dominik did benchmarked every step with a real save game on his reasonable i7-4790k, and recorded with the following overall performance gains.
(The graph shows some unexplained intermediary steps.) Just a reminder that this is just a stage 1, before actually merging straight pipe sections into one fluid box which should improve things again. Even in systems with a lot of branching, as even 2 fluidboxes merged into 1 should help. In the example of refinery setup above, it seems that the fluidbox count could be reduced by factor of 4 or so. That should make the savings big enough to justify the planned 2 times slowdown of the future fluid flowing algorithm, as we will probably need 2 passes to make it work good enough. Dominik will have an update on the algorithm and conclusions from the previous discussions in a future FFF.
GUI style inspector
The implementation of several GUI redesigns is in progress, and it is being done by several team members. Suddenly we realized that coordinating more people brings new problems (what a surprise^^). We started to have mess in the styles, as everyone was inventing their own styles for the GUI to be same as the graphical mock-ups given by the graphics department. After some discussions of how to solve this, we realized, that we mainly need some common language with the graphical department when it comes to the style hierarchy names. For that we need everyone to be able to quickly inspect which styles are used where and what is the hierarchy. For that reason, we made the GUI style inspector. By pressing a key (Control + F6 by default), every UI element will show a tooltip with information about the widget and its style, and will highlight of the widget as well. We wanted to use it only internally first, but we decided, that if it shows some info for the GUI created by scripts/mods, like name and type, it might be also useful for mod writers to be able to quickly inspect what is going on.
We even use colors to help us navigate:
- Red: The value was needlessly redefined (which was happening a lot).
- Green: The style value that is being used
- White: A style value that is not used as it is overwritten by a descendant style.
[ 2018-11-30 15:34:46 CET ] [ Original post ]
Factorio
Wube Software LTD.
Developer
Wube Software LTD.
Publisher
2020-08-14
Release
Game News Posts:
506
🎹🖱️Keyboard + Mouse
Overwhelmingly Positive
(164072 reviews)
The Game includes VR Support
Public Linux Depots:
- Factorio Linux64 [306.86 M]
- Factorio Linux32 [300.1 M]
Available DLCs:
- Factorio: Space Age
Factorio is a game in which you build and maintain factories. You will be mining resources, researching technologies, building infrastructure, automating production and fighting enemies. In the beginning you will find yourself chopping trees, mining ores and crafting mechanical arms and transport belts by hand, but in short time you can become an industrial powerhouse, with huge solar fields, oil refining and cracking, manufacture and deployment of construction and logistic robots, all for your resource needs. However this heavy exploitation of the planet's resources does not sit nicely with the locals, so you will have to be prepared to defend yourself and your machine empire.
Join forces with other players in cooperative Multiplayer, create huge factories, collaborate and delegate tasks between you and your friends. Add mods to increase your enjoyment, from small tweak and helper mods to complete game overhauls, Factorio's ground-up Modding support has allowed content creators from around the world to design interesting and innovative features. While the core gameplay is in the form of the freeplay scenario, there are a range of interesting challenges in the form of the Scenario pack, available as free DLC. If you don't find any maps or scenarios you enjoy, you can create your own with the in-game Map Editor, place down entities, enemies, and terrain in any way you like, and even add your own custom script to make for interesting gameplay.
Discount Disclaimer: We don't have any plans to take part in a sale or to reduce the price for the foreseeable future.
Join forces with other players in cooperative Multiplayer, create huge factories, collaborate and delegate tasks between you and your friends. Add mods to increase your enjoyment, from small tweak and helper mods to complete game overhauls, Factorio's ground-up Modding support has allowed content creators from around the world to design interesting and innovative features. While the core gameplay is in the form of the freeplay scenario, there are a range of interesting challenges in the form of the Scenario pack, available as free DLC. If you don't find any maps or scenarios you enjoy, you can create your own with the in-game Map Editor, place down entities, enemies, and terrain in any way you like, and even add your own custom script to make for interesting gameplay.
Discount Disclaimer: We don't have any plans to take part in a sale or to reduce the price for the foreseeable future.
What people say about Factorio
- No other game in the history of gaming handles the logistics side of management simulator so perfectly. - Reddit
- I see conveyor belts when I close my eyes. I may have been binging Factorio lately. - Notch, Mojang
- Factorio is a super duper awesome game where we use conveyor belts to shoot aliens. - Zisteau, Youtube
MINIMAL SETUP
- OS: Linux (tarball installation)
- Processor: Dual core 3Ghz+Memory: 4 GB RAM
- Memory: 4 GB RAM
- Graphics: OpenGL 3.3 core. DirectX 10.1 capable GPU with 512 MB VRAM - GeForce GTX 260. Radeon HD 4850 or Intel HD Graphics 5500
- Storage: 3 GB available space
- OS: Linux (tarball installation)
- Processor: Quad core 3GHz+Memory: 8 GB RAM
- Memory: 8 GB RAM
- Graphics: OpenGL 4.3 core. DirectX 11 capable GPU with 2 GB VRAM - GeForce GTX 750 Ti. Radeon R7 360
- Storage: 3 GB available space
GAMEBILLET
[ 6102 ]
GAMERSGATE
[ 764 ]
FANATICAL BUNDLES
HUMBLE BUNDLES
by buying games/dlcs from affiliate links you are supporting tuxDB