Belt Sorter

by judos

Sorting mechanism managing items from belts to belts. 3 Tiers available (+2 with other mods)

Content
2 years ago
0.13 - 1.1
37.2K
Logistics

i Speed

2 years ago

Any possibility to add a speed setting? I use the one more tier mod and the belts have a speed of 500/s for example.

1 year, 4 months ago
(updated 1 year, 4 months ago)

So, it took me awhile to figure this out but this is what I found. You can manually update the speed; I use the better belts and it seems silly that the speed is not in line with what is expected (considering it supports the better belts mod); this guide below is not to add a tier or unlock a tier for you to allow you to unlock new sorters; this is to modify the existing sorters to suit your needs. I am using BetterBelts, which unlocks the 4th tier, which is presently set to allow for 60 items per second. There is 5th tier that is available with other mods (but not BetterBelts). So, the 4th tier belt sorter is presently set at 60 items per second; for my game, this should be in line with the green belt I have (from better belts) where it should go at 96 items per second.

For instance

The yellow belt runs @ 15 items per second.
The yellow belt sorter runs @ 15 items per second.

The red belt runs @ 30 items per second.
The red belt sorter runs @ 30 items per second.

The blue belt runs @ 45 items per second.
The blue belt sorter runs @ 45 items per second.

But then the green (belt sorter, which is the tier 5 color, but they swap out the colors to make it match better belts; so they take the color from sorter 5 and put it on sorter 4); so despite being a green belt, it's actually still tier 4.

Okay okay okay, so what do we do:

  1. In the mods folder, make sure that the belt sorter mod is extracted into its corresponding folder (I'm pretty sure you have to do this just to use the mod ... but maybe not; I tinker with my mods; so I have them all extracted. You'll need to repeat everything you do every time you update factorio ... or you can just change the version # in the info.json which is in the base folder; all you have to do to get a mod to work on the new version (most of the time) is update the factorio_version variable in info.json. But there are some times where a mod actually had to make fixes; so keep these steps in mind in the event that an update is actually required and you have to do this again.

  2. So, extracted folder, navigate to the controls folder and in there you'll find belt-sorter.lua

  3. The line we are focused on is line 22, which at the time of writing this present reads:

local maxUpdateTicks = {32, 16, 11, 8, 6}

The 32 = 15 items per second, the 16 = 30 items per second, the 11 = 45 items per second, the 8 = 60 items per second, and the 6 = 75 items per second).

I updated mine to be:

local maxUpdateTicks = {32, 16, 11, 5, 3}

So, everything is the same up to the last 2, 5 = 96 items per second, 3 = 150 items per second.

Where did I get these #s?

https://wiki.factorio.com/Belt_transport_system -> this page says that there can be a max of 8 items on a belt; okay.

According to the code (if I am reading it right), each tick, if it's time to distribute items to the belts; it will process 1 full tile full of things; so 8 items.

So, to figure out the #, we need to simply take the # of items we want it to run at, in my case, 96 and we divide that by 8, which gets us 12. Then we take 60 / 12 (60 is the # of ticks in a second, while 12 is the # of times we want this process to occur) and we get 5.

If we take 150 / 8 = 18.75 ... 60 / 18.75 = 3.2, I dunno if this supports decimal values, pretty sure it only takes whole numbers (but I didn't investigate to verify); so I took the best guess to round down with this value (in favor of making sure the speed is reached). In other examples they rounded up instead of down. This means that it might not be exactly what we expect; since if we reverse this process, 60 / 3 = 20 (vs 60 / 3.2 = 1.875) * 8 = 160 (so slightly higher).

This means:
32 = 1.875 tiles per second * 8 (because each tile supports 8) = 15 items per second
16 = 3.75 tiles per second = 30 items per second
11 = 5.454 tiles per second = 43 or 44 items per second, I dunno which way the game will lean, probably 44
8 = 7.5 tiles per second = 60 items per second
6 = 10 tiles per second = 75 items per second

My now
5 = 12 tiles per second = 96 items per second
3 = 18.75 tiles per second = 160 tiles per second.

So for your 500, you would 500 / 8 = 62.5 ...

So, the max you can achieve from this is going to be 480; your 500/s is also probably really 480 as there's only 60 ticks; so we cannot exceed 60 tiles per second; so 60 tiles per second * 8 = 480.

I put a lot of info in here, this was just to help you understand things. It took me a few hours to dig around to find out A. where this was stored. then B. how to calculate out the number.

7 months ago

So, it took me awhile to figure this out but this is what I found. You can manually update the speed; I use the better belts and it seems silly that the speed is not in line with what is expected (considering it supports the better belts mod); this guide below is not to add a tier or unlock a tier for you to allow you to unlock new sorters; this is to modify the existing sorters to suit your needs. I am using BetterBelts, which unlocks the 4th tier, which is presently set to allow for 60 items per second. There is 5th tier that is available with other mods (but not BetterBelts). So, the 4th tier belt sorter is presently set at 60 items per second; for my game, this should be in line with the green belt I have (from better belts) where it should go at 96 items per second.

For instance

The yellow belt runs @ 15 items per second.
The yellow belt sorter runs @ 15 items per second.

The red belt runs @ 30 items per second.
The red belt sorter runs @ 30 items per second.

The blue belt runs @ 45 items per second.
The blue belt sorter runs @ 45 items per second.

But then the green (belt sorter, which is the tier 5 color, but they swap out the colors to make it match better belts; so they take the color from sorter 5 and put it on sorter 4); so despite being a green belt, it's actually still tier 4.

Okay okay okay, so what do we do:

  1. In the mods folder, make sure that the belt sorter mod is extracted into its corresponding folder (I'm pretty sure you have to do this just to use the mod ... but maybe not; I tinker with my mods; so I have them all extracted. You'll need to repeat everything you do every time you update factorio ... or you can just change the version # in the info.json which is in the base folder; all you have to do to get a mod to work on the new version (most of the time) is update the factorio_version variable in info.json. But there are some times where a mod actually had to make fixes; so keep these steps in mind in the event that an update is actually required and you have to do this again.

  2. So, extracted folder, navigate to the controls folder and in there you'll find belt-sorter.lua

  3. The line we are focused on is line 22, which at the time of writing this present reads:

local maxUpdateTicks = {32, 16, 11, 8, 6}

The 32 = 15 items per second, the 16 = 30 items per second, the 11 = 45 items per second, the 8 = 60 items per second, and the 6 = 75 items per second).

I updated mine to be:

local maxUpdateTicks = {32, 16, 11, 5, 3}

So, everything is the same up to the last 2, 5 = 96 items per second, 3 = 150 items per second.

Where did I get these #s?

https://wiki.factorio.com/Belt_transport_system -> this page says that there can be a max of 8 items on a belt; okay.

According to the code (if I am reading it right), each tick, if it's time to distribute items to the belts; it will process 1 full tile full of things; so 8 items.

So, to figure out the #, we need to simply take the # of items we want it to run at, in my case, 96 and we divide that by 8, which gets us 12. Then we take 60 / 12 (60 is the # of ticks in a second, while 12 is the # of times we want this process to occur) and we get 5.

If we take 150 / 8 = 18.75 ... 60 / 18.75 = 3.2, I dunno if this supports decimal values, pretty sure it only takes whole numbers (but I didn't investigate to verify); so I took the best guess to round down with this value (in favor of making sure the speed is reached). In other examples they rounded up instead of down. This means that it might not be exactly what we expect; since if we reverse this process, 60 / 3 = 20 (vs 60 / 3.2 = 1.875) * 8 = 160 (so slightly higher).

This means:
32 = 1.875 tiles per second * 8 (because each tile supports 8) = 15 items per second
16 = 3.75 tiles per second = 30 items per second
11 = 5.454 tiles per second = 43 or 44 items per second, I dunno which way the game will lean, probably 44
8 = 7.5 tiles per second = 60 items per second
6 = 10 tiles per second = 75 items per second

My now
5 = 12 tiles per second = 96 items per second
3 = 18.75 tiles per second = 160 tiles per second.

So for your 500, you would 500 / 8 = 62.5 ...

So, the max you can achieve from this is going to be 480; your 500/s is also probably really 480 as there's only 60 ticks; so we cannot exceed 60 tiles per second; so 60 tiles per second * 8 = 480.

I put a lot of info in here, this was just to help you understand things. It took me a few hours to dig around to find out A. where this was stored. then B. how to calculate out the number.

You are a G my guy!

i dove into the code my self and found these values and knew they had to do something with the speed but couldnt understand it, but your math makes sense! thank you! now i can have a speed thats the same as extreme belts mods.

New response