-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
73 lines (66 loc) · 3.26 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Given an output product and amount, generates a blueprint for a factory that
will produce that product from the specified inputs.
This sounds complex but can be broken into relatively simple stages:
calculator:
Works out what processing is required and in what amounts,
outputting a DAG of processes.
This stage is pretty much already done.
splitter:
Splits full processes of each item into "steps",
where each step requires no more than 1 full belt of each input or output.
Outputs a DAG of steps.
belt manager:
Transforms the DAG of full processes into a sequence of steps,
each of which takes inputs from specific belts and sends outputs to specific belts.
The belt manager tracks the rate of items on each belt, optimizing to keep
the bus thin (low maximum number of belts used at once) without needing to
compress too often.
It outputs a sequence of either a step
(eg. 23 assemblers producing green circuit from inputs 3 and 5, outputting to 6)
or a bus-wide compaction that obeys some strict rules.
Speculation: Compaction rules depend on what belt compactor primitives look
like and where they can fit. eg. "a 2-wide compactor that can compact
belts N and N+1 with priority to belt N" or "a M-wide compactor that can
compact belts N and N+M-1 with priority to belt N, but cannot be combined
with usage of the belts between".
So a full compaction step may look like "compact 1&2, 4&6, 7&8, 9&10"
This is expected to be the most complex stage.
layouter:
Transforms a belt manager sequence into a collection of primitives.
Examples of primitives would be compactors, bus segments, or process steps
with a certain number of inputs and a configurable size, in a certain location.
Examples of primtives with arguments:
A 2-wide compactor compacting belts 2 and 3
A bus I/O section delivering belts 5 and 10 as inputs, and outputting to belt 6.
A process section creating an item with 3 inputs, with 10 assemblers.
This stage is expected to need to handle some corner cases around spacing.
blitter:
Blits all the components of each primitive into a collection of raw components,
eg. an assembler, a belt, a splitter, all laid out on a grid where they should go.
This stage should be fairly simple.
encoder:
Takes the final laid out grid of components and encodes it into blueprint form.
Other options may include a "preview" mode rendered in ascii.
This stage may be tricky and require reverse engineering work, but there's
prior art to draw from.
Invariants to simplify primitives:
Inputs always arrive on right-facing belts at the top-left corner,
Order of inputs is indeterminate.
Notes on balance:
to prevent one side getting taken from and one side not which can result in a merge
between two lopsided belts only having an effective throughput of 20/sec instead of 40/sec,
we need to balance sides after every offramp.
each row of the bus, if unused that step, looks like this: (left is top, right is bottom):
> <
if we offramped, it can look like this:
s>| <s\
S=/ s=
and we specify that consumers must preference the left side.
alternately, we can balance during compaction.
that's simpler for now.
Though we still need to specify consumption from the left.
eg.
| |
>| s/ <
\sS\
==S=====