Inserter (Stack or Not) Should not be Limited to 254.0

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
Murez
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Oct 31, 2021 11:57 am
Contact:

Inserter (Stack or Not) Should not be Limited to 254.0

Post by Murez »

In this current version, inserter's capacity bonus is limited to 254.

So, please don't restrict its value.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2547
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by FuryoftheStars »

Hmm, that sounds like they restricted it to 1 byte of data. They may have done this for memory reasons, similar to tile IDs.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by mrvn »

I wonder what 0 and 255 is used for then.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2547
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by FuryoftheStars »

mrvn wrote:
Sun Oct 31, 2021 8:26 pm
I wonder what 0 and 255 is used for then.
Hmm, I wonder if they actually use 0 & 1 for disabled/enabled, then use the remaining 254 for stack size? Would save a small bit of memory.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by mrvn »

FuryoftheStars wrote:
Sun Oct 31, 2021 8:49 pm
mrvn wrote:
Sun Oct 31, 2021 8:26 pm
I wonder what 0 and 255 is used for then.
Hmm, I wonder if they actually use 0 & 1 for disabled/enabled, then use the remaining 254 for stack size? Would save a small bit of memory.
Then how would you disable a 200 stack size inserter? Disabling would overwrite the stack size.

If they used the first bit then max size would be 127 or 128.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2547
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by FuryoftheStars »

mrvn wrote:
Sun Oct 31, 2021 10:19 pm
FuryoftheStars wrote:
Sun Oct 31, 2021 8:49 pm
mrvn wrote:
Sun Oct 31, 2021 8:26 pm
I wonder what 0 and 255 is used for then.
Hmm, I wonder if they actually use 0 & 1 for disabled/enabled, then use the remaining 254 for stack size? Would save a small bit of memory.
Then how would you disable a 200 stack size inserter? Disabling would overwrite the stack size.

If they used the first bit then max size would be 127 or 128.
I wasn’t thinking of the bits, but yeah, what was going through my head I don’t think is possible.



Hmm, well, 0 at least can be explained not being used by stack size as that’s essentially the same as disabling it. Not sure about 255, though.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by mrvn »

FuryoftheStars wrote:
Sun Oct 31, 2021 11:21 pm
mrvn wrote:
Sun Oct 31, 2021 10:19 pm
FuryoftheStars wrote:
Sun Oct 31, 2021 8:49 pm
mrvn wrote:
Sun Oct 31, 2021 8:26 pm
I wonder what 0 and 255 is used for then.
Hmm, I wonder if they actually use 0 & 1 for disabled/enabled, then use the remaining 254 for stack size? Would save a small bit of memory.
Then how would you disable a 200 stack size inserter? Disabling would overwrite the stack size.

If they used the first bit then max size would be 127 or 128.
I wasn’t thinking of the bits, but yeah, what was going through my head I don’t think is possible.



Hmm, well, 0 at least can be explained not being used by stack size as that’s essentially the same as disabling it. Not sure about 255, though.
People that squish such numbers into bytes also tend to special case unused numbers to mean something else. Or offset all values. So 0 could mean 256 or stack size - 1 is stored.

Murez
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Oct 31, 2021 11:57 am
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by Murez »

https://ibb.co/sqZDHJt

I don't think so, the field in the LuaForce class has uint data type.
It holds 32-bit unsigned integer. Possible values are 0 to 4,294,967,295.

So, it should be restricted in the code by conditional flow.

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by mrvn »

That's the LUA interface and in no way means the C++ type is an uint32_t.

Murez
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Oct 31, 2021 11:57 am
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by Murez »

Can the property be changed? so it can store a larger value.

I'm struggling to flush the output out of the furnace/assembling machine using the inserter, due to its high productivity (mods' effect).
Imagine the property of worker robots storage bonus is not limited, but why not with the inserter capacity bonus?

It creates a perfect imbalance.

SoShootMe
Filter Inserter
Filter Inserter
Posts: 476
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by SoShootMe »

mrvn wrote:
Sun Oct 31, 2021 8:26 pm
I wonder what 0 and 255 is used for then.
It makes some sense to use 8 bits to store the set stack size of an inserter instance, since there are typically many of them. Same goes for items currently in the inserter's hand.

There surely needs to be a value to indicate "unset" or "max", ie use stack size according to prototype and inserter capacity bonus. I can't see why any other value is reserved though. Perhaps it's hysterical raisins.
Murez wrote:
Tue Nov 02, 2021 6:16 am
Imagine the property of worker robots storage bonus is not limited, but why not with the inserter capacity bonus?
Worker robots don't store a cargo size (only held item count), and perhaps the expectation is there will be fewer active bots, so the benefit of reducing stored size is less.

Murez
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Oct 31, 2021 11:57 am
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by Murez »

SoShootMe wrote:
Tue Nov 02, 2021 7:39 am
Worker robots don't store a cargo size (only held item count), and perhaps the expectation is there will be fewer active bots, so the benefit of reducing stored size is less.
Its the property name in LuaForce class by the way (Factorio API docs).
It's talking about handling massive items and bottleneck occurs because of the inserters.

SoShootMe
Filter Inserter
Filter Inserter
Posts: 476
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by SoShootMe »

Murez wrote:
Tue Nov 02, 2021 8:08 am
Its the property name in LuaForce class by the way (Factorio API docs).
It's talking about handling massive items and bottleneck occurs because of the inserters.
inserter_capacity_bonus and stack_inserter_capacity_bonus are LuaForce properties but maximum values are also limited by per-entity state (eg "items in hand" and "stack size override"), and it seems almost certain this is limited to eight bits.

To go back to your earlier post:
Murez wrote:
Tue Nov 02, 2021 6:16 am
Can the property be changed? so it can store a larger value.
It's likely it could be increased, but I expect it won't be for several reasons, such as the fact that (due to the above) allowing a greater maximum would increase the overall memory requirements by an amount proportional to the number of inserters.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2547
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by FuryoftheStars »

Yup, just like the tile ID limit situation. They're not going to blow up memory consumption of the game to accommodate mods (and I don't blame them).
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

Murez
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Oct 31, 2021 11:57 am
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by Murez »

I agree. But, why worker_robots_storage_bonus can be updated up to 65535.0?
I think, increasing the number of robots drastically decreases UPS/FPS performance compared to inserters.

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by mrvn »

Because bots do not store the storage size. There is no cost per bot for the worker_robots_storage_bonus.

As to why they can actually carry that many items that is probably because they have a standard inventory and not their own internal counter for items. Restricting all inventories to 255 items per slot would be bad.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Inserter (Stack or Not) Should not be Limited to 254.0

Post by ssilk »

One question: WHY is it needed?

I have different ideas about the why, I want to know it from the source. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Post Reply

Return to “Ideas and Suggestions”