▶
Friday Facts #198 - Rail segment visualisation
We had trouble with the blueprint library, mainly the blueprint duplication problems. Let me explain how it works internally. For performance reasons, the blueprint library generates and stores CRC of each blueprint. This can be used to quickly detect a duplicate blueprint when merging player blueprint libraries and blueprints stored in a save. For some reason, this wasn't working perfectly, as a lot of players were reporting that blueprints are somewhat being duplicated in the library. We assumed, that the error is in the CRC generation from the blueprint entities. That some property of an entity in the blueprint isn't initialized properly, so the CRC would be different for 2 blueprints that are the same. After some digging, we discovered what is wrong:
One of our plans for 0.16 is the optimisation of the internal ItemStack representation. The current data representation of an item stack is like this.
This representation is nice and simple, but performance wise, it is bad, as whenever the ItemStack is accessed, it needs to access different part of memory to know the ID or any other information about the item as it is in the dynamically allocated part. When the item is transferred from one place to another, the dynamically allocated pointer can be transferred as well, but in cases when the stack needs to be split (which is happening almost always with stack inserter for example), a new copy of the dynamically allocated class Item needs to be created, which is generally slow as well. To solve this, we can take into account the fact that vast majority of items in the factory are simple items (ore, plates etc.). We will simply just store the basic item data directly in the ItemStack, so it looks like this:
While testing our tutorial sample, which focuses mainly on rails and signals, people discovered that we have a debug visualisation called "show-rail-blocks", which looks like this when active:
The people were commenting, that once they used that, they were able to understand the way signals work almost instantly. The problem is, that debug options are generally not intended to be used in normal game, as the way these are generated is slowing the render a lot and the looks of it is far from production quality. But it gave us an idea, that we should probably provide this visualisation in game properly. We are experimenting with the way it should look, but it might be something conceptually similar to this:
The first problem is, that using colors is very practical way to indicate which rails are connected into one segment, but it also makes the game look too much like a circus. We shall see what can we do if we use different than the RGB colors for it. Another problem is the question, when exactly should it be shown, our first guess is to show it whenever building rails or rail signals, but the problem is, that the amount of indications you see when building rail signals is starting to be quite too high:
So the final result is subject to our experiments, I just wanted to show you the process. As always, let us know if you have any thoughts or feedback on our Forum.
[ 2017-07-07 17:12:33 CET ] [ Original post ]
Hello, after weeks and weeks of going through bug reports and fixing stuff (after all 0.15 was one of our biggest releases), it seems that we are approaching the end of 0.15 stabilisation. The (wishful) plan is to have a stable candidate for 0.15 next week. Sadly, this will change our attention to just different category of bugs: Those that we plan to fix for the 0.16 as they are not so critical and the changes required to fix them are too big to be done in 0.15 at this point.
Blueprint library trouble
We had trouble with the blueprint library, mainly the blueprint duplication problems. Let me explain how it works internally. For performance reasons, the blueprint library generates and stores CRC of each blueprint. This can be used to quickly detect a duplicate blueprint when merging player blueprint libraries and blueprints stored in a save. For some reason, this wasn't working perfectly, as a lot of players were reporting that blueprints are somewhat being duplicated in the library. We assumed, that the error is in the CRC generation from the blueprint entities. That some property of an entity in the blueprint isn't initialized properly, so the CRC would be different for 2 blueprints that are the same. After some digging, we discovered what is wrong:
CrcWriteStream* crcWriter = new CrcWriteStream();
MapSerialiser mapSerialiser(crcWriter);
this->save(mapSerialiser);
this->crc = crcWriter->checksum();
The way it works is, that the blueprint is saved as it would be normally saved, but instead the data goes into a CRC engine. The problem is, that our MapSerialiser writes current output map version automatically in a constructor. This means, that whenever we changed version of factorio, which is every release at least, the CRC values of the blueprints changed, and they were suddenly considered to be different. It was quite hard to reproduce because of this. Anyway, forcing the serialiser to not write the map version to the output in this case fixed this issue.
We were also wondering how big is the chance, that 2 blueprints in one blueprint library will have the same CRC. The CRC is 32 bit, so there are 2^32 combinations. If we take into account 1 million players, and assume that each of them is having 20 blueprints in their library and all of the blueprints are random, the chance that it happens at least once is 9%. (You can try to calculate it yourself if you like math). Lets wait if it happens or not :)
Item stack optimisation
One of our plans for 0.16 is the optimisation of the internal ItemStack representation. The current data representation of an item stack is like this.
struct ItemStack
{
ItemCountType count;
Item* item; // dynamically allocated classed based on the item type
};
The Item needs to be a pointer as different kind of items have different properties and can hold different kind of data:
This representation is nice and simple, but performance wise, it is bad, as whenever the ItemStack is accessed, it needs to access different part of memory to know the ID or any other information about the item as it is in the dynamically allocated part. When the item is transferred from one place to another, the dynamically allocated pointer can be transferred as well, but in cases when the stack needs to be split (which is happening almost always with stack inserter for example), a new copy of the dynamically allocated class Item needs to be created, which is generally slow as well. To solve this, we can take into account the fact that vast majority of items in the factory are simple items (ore, plates etc.). We will simply just store the basic item data directly in the ItemStack, so it looks like this:
struct ItemStack
{
ItemCountType count;
ItemID id;
Item* item; // null unless the item needs special data (blueprint, armor etc...)
};
Now, in the vast majority of cases, the ItemStack is simple and flat, so any operation with it will be much faster. It is possible that this change might improve the performance, but until we actually implement it and test it, we will never know.
Rail block visualisation
While testing our tutorial sample, which focuses mainly on rails and signals, people discovered that we have a debug visualisation called "show-rail-blocks", which looks like this when active:
The people were commenting, that once they used that, they were able to understand the way signals work almost instantly. The problem is, that debug options are generally not intended to be used in normal game, as the way these are generated is slowing the render a lot and the looks of it is far from production quality. But it gave us an idea, that we should probably provide this visualisation in game properly. We are experimenting with the way it should look, but it might be something conceptually similar to this:
The first problem is, that using colors is very practical way to indicate which rails are connected into one segment, but it also makes the game look too much like a circus. We shall see what can we do if we use different than the RGB colors for it. Another problem is the question, when exactly should it be shown, our first guess is to show it whenever building rails or rail signals, but the problem is, that the amount of indications you see when building rail signals is starting to be quite too high:
- The new rail segment
- Possible signal positions
- Positions of train vehicles
- Direction of the train that will approach the signal
- Count of signals in the cursor
- The cursor to be built
So the final result is subject to our experiments, I just wanted to show you the process. As always, let us know if you have any thoughts or feedback on our Forum.
[ 2017-07-07 17:12:33 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