Transport belts/Physics: Difference between revisions
m (Multiplication signs) |
Irregulator (talk | contribs) m (Minor wording changes for clarity) |
||
Line 2: | Line 2: | ||
{{sublinks}} | {{sublinks}} | ||
In Factorio, every item on screen is a real object in memory | In Factorio, every item on screen is a real object in memory that follows the rules of the Game engine. For simulation games, this is not typical; it's much more common to generalize. For example, the older versions of SimCity do not simulate every inhabitant in the city. | ||
The reason for | The reason for this is CPU performance. Real-time game physics for up to tens of thousands of objects at the same time is not typical for a simulation game. The Factorio Game engine creates an exact and reproducible simulation of the Factorio world, so exact that it can be used to measure some astonishing behaviors of belts. | ||
== What to measure == | == What to measure == |
Revision as of 21:12, 25 May 2018
< Transport belts | Physics
In Factorio, every item on screen is a real object in memory that follows the rules of the Game engine. For simulation games, this is not typical; it's much more common to generalize. For example, the older versions of SimCity do not simulate every inhabitant in the city.
The reason for this is CPU performance. Real-time game physics for up to tens of thousands of objects at the same time is not typical for a simulation game. The Factorio Game engine creates an exact and reproducible simulation of the Factorio world, so exact that it can be used to measure some astonishing behaviors of belts.
What to measure
Some stats can be measured for belts:
- Length (or area). Items have a collision box of 0.28125 × 0.28125 tiles. So, 10 items laying in a single row on a belt non moving take the length of 2.8125 tiles.
- Speed. The speed of items on a belt is measured for practical reasons in tiles/sec or tiles/min. Note that internally it's measured in tiles per tick (1/60 sec). The speed of basic belt is 0.03125 tiles per tick (1/32) or 1.875 tiles per Game-second.
- Density. The density is items per tile. How many items can lay on a tile or in conjunction with belts: how many items can lay in a row/lane. There are in average 3.5555556 items per lane or 7.11 (32/9*2) on a tile of belt (2 lanes). Which means in practical terms that on a fully compressed belt there can be either 6, 7 or 8 items during one tick.
- Throughput. How many items per minute are moved from one tile to the next. Measured in items/sec or better items/min. That is for basic belt density (items per tile) multiplied with speed (tiles per second): (1/32 tiles/tick) / (9/32 items/tile) = 0.111111111 items per tick or 6.666666667 items per second for one lane. For two lanes it is then 13.33 items/second.
How to calculate these numbers yourself
Introduction
Belts have two lanes: The left and right lane.
Each lane of a belt consists out of 32 slots. A slot is just a virtual position on the belt with the width of 1/32 tiles (= 0.03125 tiles).
An item that is put on a belt (on a lane) takes 9 slots of space. This shows the size of items: 0.28125 × 0.28125 tiles (9/32 = 0.28125). 32/9 items (3.55 items) can fit on one lane of one belt. Essentially, up to 8 items can fit on one belt at any tick.
Step by step movement of an item on a belt-lane. <---*---> represents an item, and the slots it consumes. |==============================| <----- 32 slots 1 <---*---><---*---><---*---><---* 4 items 2 ><---*---><---*---><---*---><--- 3 items 3 -><---*---><---*---><---*---><-- 3 items 4 --><---*---><---*---><---*---><- 3 items 5 ---><---*---><---*---><---*--->< 3 items 6 *---><---*---><---*---><---*---> 4 items 7 -*---><---*---><---*---><---*--- 4 items 8 --*---><---*---><---*---><---*-- 4 items 9 ---*---><---*---><---*---><---*- 4 items
Speed: Each tick an item on a belt (the 9 slots it takes) is moved by one slot. The least common multiple of 9 and 32 is 288. After 9 tiles, the slots are repeating their positions.
Curves
The inner lane has 13.5 slots, compared to the outer 37 slots. In the end, 6 or 7 items can be in a curving belt at once.
Yes, the interior has a fractional slot: every odd interior curve is 14 slots and every even interior curve is 13 slots.
The faster belts
To obtain higher speeds on higher tier belts, the quantity of slots that each item moves per tick is multiplied. For Fast transport belts two slots, for Express transport belts 3 slots. That explains why fast belts are exactly 2 times faster, than basic and express belt is 3 times faster than basic.
Theory
The data here is taken from the transport-belt prototypes (Version 13.3 and above).
belt-type | factor basic belt speed | speed (tiles/tick) | speed (tiles/sec) | speed (tiles/min) | density (single lane) items/tile | density (two lanes) items/tile | throughput (2 lanes) items/sec | throughput items/min |
---|---|---|---|---|---|---|---|---|
Basic | 1 | 0.03125 | 1.875 | 112.5 | 3.556 | 7.111 | 13.33 | 800.00 |
Fast | 2 | 0.0625 | 3.75 | 225 | 3.556 | 7.111 | 26.66 | 1600.00 |
Express | 3 | 0.09375 | 5.625 | 337.5 | 3.556 | 7.111 | 40.00 | 2400.00 |
We assume here that the density of items is always equal and maximum compressed (see above), so the transported amount should reflect the speed.
For measured results see Transport belt experiments.
History
This is outdated and should be outsourced from this article but not deleted, because it is an interesting fact.
Kept for historical purposes, expand to view
- Theory
belt-type | factor basic belt speed | speed (tiles/tick) | speed (tiles/sec) | speed (tiles/min) | density (single lane) items/tile | throughput (2 lanes) items/sec | throughput items/min |
---|---|---|---|---|---|---|---|
Basic | 1 | 0.03125 | 1.875 | 112.5 | 3.571 | 13.39125 | 803.475 |
Fast | 2 | 0.0625 | 3.75 | 225 | 3.571 | 26.7825 | 1606.95 |
Express | 3 | 0.09375 | 5.625 | 337.5 | 3.571 | 40.17375 | 2410.425 |
- Measured Results for v0.11 or Older
With Factorio v0.12 new belt physics was introduced. Before that the items where moved as real objects (which means, they need to look forward, if there is space to move), with 0.12 the items are moved "per lane". Also the physics in curves changed so that curves are now not longer have lower throughput.
This results have been measured with a special designed factory (a complicated setup to guarantee, that only the running items on a belt are measured and a "timer" which stops the measuring exactly) and Factorio v0.6.x, so this has to be redone.
See forum article |
belt-type | throughput items/min | throughput items/sec | percent of awaited | comments |
---|---|---|---|---|
Basic | 719 | 11.98 | 90% | |
Fast | 1184 | 19.73 | 74% | This is NOT double as fast as basic! it's only 1.65 times faster |
Express | 1775 | 29.58 | 74% | About 2.5 times faster than basic |
belt-type | throughput items/min | comments |
---|---|---|
Basic | 477-486 | About 1.5 times slower. This is because the inner lane of a belt in a turn has only the half speed. |
Fast | 786-792 | |
Express | 1038-1042 |
belt-type | throughput items/min | comments |
---|---|---|
Basic with fast edge-belts | 674-683 | |
Fast with express edge-belts | 1058-1061 | The fast belt with express edge seems to be faster, than pure express belt! |
- Comments to the results
The first surprising result is, that the theoretic throughput differs from real measured. Too much to be just measurement errors.The second result is, that the more speed a belt has, the more ineffective it becomes. That is in the first moment not clearly explainable. The awaited result is, that a fast belt can transport exactly the double amount of items, than a basic, because it is double as fast (1.875 tiles/sec vs. 3.75 tiles/sec).
The reason for this difference is the distance of the items on the belt when running. Items on the belt cannot run completely compressed, they need a small distance. This is the same problem as in a traffic jam: You cannot drive, when the first car drives, you need to wait until the car before you drives and then you have a reaction-time of about 1/2 second before yourself begin to drive. The same is it with the items on the belt and the reaction-time here is 1/60 or one tick [currently not really validated, but not more than 2 ticks; this can be calculated by measuring how fast the standing wave goes through the items (needs to built a very complicated testing factory)]. You can see this reaction time running through your items as a standing wave, when you have a belt, which is completely filled and only sometimes an item is removed. When you compare the speed of this standing waves, you can see clearly, that they are the same speed for all types of belts.
The reaction-distance for items on a basic belt is
(1.875 tiles/sec) / 1 tick = 1.875 tiles/sec / 1/60 sec = 0.031125 tiles
or in other words: An item on a moving belt is not 0.28 tiles long, it is 0.31125 tiles, which makes it 11.2% longer
Overview for all belts:
Basic: 0.28 tiles + 0.03125 tiles = 0.31125 tiles => 11.2% Fast: 0.28 tiles + 0.0625 tiles = 0.3425 tiles => 22.3% Express: 0.28 tiles + 0.09375 tiles = 0.37375 tiles => 33.5%
This explains the reduction to 90% of speed for basic belt and the 74% for the fast belt (all inside measuring errors), but doesn't explain the results for express belt. This is part of further research.
This shows clearly, that the faster a belt is, the more distance the items have on a moving belt. More distance means, the density is lighter and this means, there are not so many items transported.
(This may explain the discrepancy in transported items, but don't use the numbers for real calculations, because they need to be redone!) (This is eventually one reason: http://www.factorioforums.com/forum/viewtopic.php?f=8&t=3630 )
A possible reason for this: http://www.factorioforums.com/forum/viewtopic.php?f=16&t=6817