-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfactorio.html
330 lines (282 loc) · 13.2 KB
/
factorio.html
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Is sending Factorio to your competitors' engineers a cost-effective means of sabotage?</title>
<!-- Primary Meta Tags -->
<meta name="title" content="Is sending Factorio to your competitors' engineers a cost-effective means of sabotage?">
<meta name="author" content="Max Bo">
<meta name="keywords" content="Factorio, engineering productivity, competitive analysis, probabilistic estimation, Silicon Valley, game theory, Observable, Squiggle">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="article">
<meta property="og:title" content="Is sending Factorio to your competitors' engineers a cost-effective means of sabotage?">
<meta property="og:site_name" content="maxbo.me">
<meta property="article:published_time" content="2025-01-10">
<meta property="article:author" content="Max Bo">
<!-- Open Graph Image -->
<meta property="og:image" content="https://maxbo.me/factorio/og.png">
<meta property="og:image:type" content="image/webp">
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://maxbo.me/factorio/og.png">
<meta name="twitter:title" content="Is sending Factorio to your competitors' engineers a cost-effective means of sabotage?">
<meta name="twitter:description" content="Yes">
<meta name="twitter:creator" content="@_max_bo_">
<script type="module">
import { CelineModule, registerScriptReevaluationOnBlur } from 'https://esm.sh/jsr/@celine/[email protected]';
import * as Inputs from 'https://esm.run/@observablehq/[email protected]';
import * as htl from 'https://esm.run/[email protected]';
window.celine = CelineModule.usingNewObservableRuntimeAndModule(document);
window.library = celine.library; /* @observablehq/stdlib */
window.Inputs = Inputs;
window.htl = htl;
registerScriptReevaluationOnBlur(document, /*class=*/'echo');
</script>
<link
rel="stylesheet"
href="https://esm.sh/jsr/@celine/[email protected]/cell.css" />
<link
rel="stylesheet"
href="https://esm.sh/jsr/@celine/[email protected]/libertine.css" />
<style>
.center {
display: flex;
justify-content: center;
align-items: center;
}
</style>
</head>
<body>
<main>
<h1>Is sending Factorio to your competitors' engineers a cost-effective means of sabotage?</h1>
<div class="authors">
<div class="author">
<span class="author-name"><a href="https://maxbo.me">Max Bo</a></span>
</div>
</div>
<div class="date"></div>
<time datetime="2025-01-10">January 10, 2025</time>
</div>
<div class="center">
<figure class="card">
<img style="width: 50ch" src="factorio/bryan.webp" />
<figcaption><a href="https://x.com/bryancsk/status/1825498316400164922"><img class="favicon" src="https://twitter.com/favicon.ico"> Twitter</a></figcaption>
</figure>
</div>
<p>In light of the above tweet, and Ned Beauman's <a href="https://www.ft.com/content/b9e419c6-acf1-420b-8ae6-908feb52c94e"><img class="favicon" src="https://favicon.garden/ft.com"> <cite>How ‘Factorio’ seduced Silicon Valley — and me</cite></a> (<a href="https://archive.is/2sRrE">permalink</a>),
I wanted to approximate the magnitude of damage you could inflict with a Mass Steam Gifting Event of <a href="https://www.factorio.com/"><img class="favicon" src="https://www.factorio.com/static/img/favicon.ico"> Factorio</a>.
<p>
My mate <a href="https://au.linkedin.com/in/huwsername">
<img src="https://linkedin.com/favicon.ico" class="favicon">
Huw</a> recently made this funky library called <a href="https://observablehq.com/@huw/dist">
<img src="https://observablehq.com/favicon.ico" class="favicon"> dist</a>, a
<i><q>lightweight alternative to <a href="https://www.squiggle-language.com/docs"><img class="favicon" src="https://www.squiggle-language.com/favicon.ico"> Squiggle</a> designed to be used with a batteries-included notebook environment such as Observable</q></i>,
where Squiggle is a <i><q>minimalist programming language for probabilistic estimation</q></i>.
</p>
<p>
Let's put dist, and my HTML-embeddable notebook environment <a href="https://maxbo.me/celine">
<a href="https://maxbo.me/celine"><img src="https://maxbo.me/celine/static/favicon-32x32.png" class="favicon">
@celine/celine</a> through their paces:
</p>
<br />
<center style="font-size: larger;">☙❧</center>
<br />
<p>
First, we'll import dist and make it available globally. It's got a bunch of useful
<a href="https://jsr.io/@huw/dist/doc">
<img src="https://jsr.io/favicon.ico" class="favicon"> distribution creation functions
</a> mirroring <a href="https://www.squiggle-language.com/docs/Guides/DistributionCreation">
<img
src="https://www.squiggle-language.com/favicon.ico" class="favicon"> those in Squiggle.
</a>
</p>
<script type="module" class="echo" id="dist">import * as dist from 'https://esm.sh/jsr/@huw/[email protected]';
window.dist = dist;
celine.cell('dist', dist)
</script>
<script type="module">
import * as Plot from 'https://esm.run/@observablehq/[email protected]';
import * as d3 from 'https://esm.sh/[email protected]';
window.d3 = d3;
import * as kde from 'https://esm.sh/[email protected]';
function plot(sample, options = {
tickFormat: "s"
}) {
const density = [...kde.density1d(sample).points("point", "density")];
const summary = [
{ type: "Mean", point: d3.mean(sample), strokeDasharray: null },
{ type: "Min", point: d3.min(sample), strokeDasharray: null },
{ type: "Max", point: d3.max(sample), strokeDasharray: null },
{ type: "p5", point: d3.quantile(sample, 0.05), strokeDasharray: "5, 3" },
{ type: "p95", point: d3.quantile(sample, 0.95), strokeDasharray: "5, 3" },
{ type: "Median", point: d3.median(sample), strokeDasharray: "2, 2" }
].map((entry) => ({
...entry,
density:
density[
d3.bisectCenter(
density.map(({ point }) => point),
entry.point
)
].density
}));
return Plot.plot({
margin: 12,
marginTop: 24,
marginBottom: 24,
y: { axis: null },
clip: true,
x: { label: null, tickFormat: options.tickFormat, domain: [0, d3.max(density, (d) => d.point)] },
height: 196,
marks: [
Plot.areaY(density, { x: "point", y: "density", fillOpacity: 0.1 }),
Plot.ruleY([0]),
Plot.lineY(density, { x: "point", y: "density" }),
...Object.entries(Object.groupBy(summary, (d) => d.strokeDasharray)).map(
([strokeDasharray, values]) =>
Plot.ruleX(values, {
x: "point",
y1: "density",
strokeDasharray,
strokeOpacity: 0.3
})
),
Plot.tip(
summary,
Plot.pointerX({
x: "point",
y: "density",
channels: {
type: "type",
value: "point"
},
format: { type: true, value: true, x: false, y: false }
})
),
Plot.axisX(
summary.map(({ point }) => point),
occludeAxisX({
tickFormat: options.tickFormat,
padding: 12
})
),
Plot.crosshairX(density, { x: "point" })
]
});
}
function occludeAxisX({ padding = 8, ...options } = {}) {
return occludeAxis({ ...options, axis: "x", dy: padding + 4, padding });
}
function occludeAxisY({ padding = 8, ...options } = {}) {
return occludeAxis({ ...options, axis: "y", dx: -padding - 4, padding });
}
function occludeAxis({ axis, ...options } = {}) {
const orthogonalAxis = axis === "y" ? "x" : "y";
return Plot.initializer(
(axis === "y" ? Plot.dodgeX : Plot.dodgeY)(options),
(data, facets, channels, scales, dimensions, context) => {
// To determine the preserved indices, we take the data points that have a resolved channel-value equal to the maximum/minimum channel-value.
const extent = (axis === "y" ? Math.min : Math.max)(
...channels[orthogonalAxis].value
);
const preservedIndices = channels[orthogonalAxis].value.reduce(
(acc, value, index) => (value === extent ? [...acc, index] : acc),
[]
);
// Then filter out the channels
// We don't need to filter data and facets because this is an initializer transform!
const newChannels = Object.fromEntries(
Object.entries(channels).map(([key, { value, ...channel }]) => [
key,
{ ...channel, value: preservedIndices.map((index) => value[index]) }
])
);
return { data, facets, channels: newChannels };
}
);
}
window.density = plot;
</script>
<p>
Let's take a look at the engineering compensation levels of some random company on Levels.fyi. I dunno, uhhh, <a href="https://www.levels.fyi/companies/anduril-industries/salaries/software-engineer?country=254">
<img src="https://www.levels.fyi/assets/favicon.png" class="favicon"> Anduril</a>. Compensation distributions are typically <a href="https://www.squiggle-language.com/docs/Guides/DistributionCreation#to">
<img src="https://www.squiggle-language.com/favicon.ico" class="favicon"> lognormal</a>, so plugging in $228kUSD as a 5th percentile and $406kUSD as a 95th percentile seems fine.
</p>
<script id="compdensity" type="module">celine.cell('compdensity', ['comp'], (c) =>
density(c, { tickFormat: "$s"}))</script>
<script id="comp" type="module" class="echo" contenteditable="true">celine.cell('comp', () => {
return dist.to(228000, 406000)
})</script>
<p>
Let's normalize to a per-minute rate to make it easier to compare with the next distribution.
</p>
<!-- <script id="compPerMinute density" type="module">celine.cell('compPerMinute density', ['compPerMinute'], (compPerMinute) =>
density(compPerMinute))</script> -->
<script id="compPerMinute" type="module" class="echo" contenteditable="true">celine.cell('compPerMinute', ['comp'], (comp) => {
const WORK_MINUTES_PER_YEAR = 48 /* weeks */ * 5 /* days */ * 8 /* hours */ * 60 /* minutes */;
return dist.dist`${comp} / ${WORK_MINUTES_PER_YEAR}`
})</script>
<p>
Let's say for a given gifting of Factorio to an engineer 20% already own it, 60% play nothing, but 20% lose 1hr to 5hr<sup><a id="fnref:1" href="#fn:1">†</a></sup> of productive work to playing Factorio instead.<sup><a id="fnref:2" href="#fn:2">‡</a></sup>
</p>
<aside>
<p id="fn:1">
<a href="#fnref:1">†</a> Maybe I should use a <a href="https://en.wikipedia.org/wiki/Gamma_distribution"><img src="https://en.wikipedia.org/static/favicon/wikipedia.ico" class="favicon"> Gamma distribution</a> to model this instead of lognormal.
</p>
</aside>
<aside>
<p id="fn:2">
<a href="#fnref:2">‡</a> Note that this isn't the <i>total</i> time played. There's playtime that consumes an engineer's spare time, and then there's playtime that consumes an engineer's <i>work</i> time. We're only interested in the latter.
</p>
</aside>
<aside>
<p>
You may disagree with this assumptions here, so feel free to edit the code below (and <abbr>blur</abbr> to propagate changes) to see how it affects the results.
</p>
</aside>
<script id="lostWorkMinsPerWeek density" type="module">celine.cell('lostWorkMinsPerWeek density', ['lostWorkMinsPerWeek'], (lostWorkMinsPerWeek) =>
density(lostWorkMinsPerWeek))</script>
<script id="lostWorkMinsPerWeek" type="module" class="echo" contenteditable="true">celine.cell('lostWorkMinsPerWeek', [], () => {
return dist.mixture([0, 0, dist.to(60, 60 * 5)], [0.20, 0.60, 0.20])
})</script>
<p>
So the lost value per week across the engineering workforce is:
</p>
<script id="lostValuePerWeek density" type="module">celine.cell('lostValuePerWeek density', ['lostValuePerWeek'], (c) =>
density(c, { tickFormat: "$s"}))</script>
<script id="lostValuePerWeek" type="module" class="echo" contenteditable="true">celine.cell('lostValuePerWeek', ['compPerMinute', 'lostWorkMinsPerWeek'], (compPerMinute, lostWorkMinsPerWeek) => {
return dist.dist`${compPerMinute} * ${lostWorkMinsPerWeek}`
})</script>
<p>
So an average of about
<script id="average" type="module">
celine.cell('average', ['lostValuePerWeek'], (lostValuePerWeek) =>
htl.html`<output>$${d3.mean(lostValuePerWeek).toFixed(0)}USD</output>`
)
</script> is lost per week.
</p>
<br />
<p>
Given that Factorio (bundled with its far more potent expansion, <a href="https://store.steampowered.com/app/645390/Factorio_Space_Age/">
<img class="favicon" src="https://store.steampowered.com/favicon.ico"> Space Age</a>)
costs $70USD all up:
</p>
<div class="center">
<figure class="card" >
<img src="factorio/steam.png" style="width: 60ch;" />
<figcaption><a href="https://store.steampowered.com/app/427520/Factorio/">
<img class="favicon" src="https://store.steampowered.com/favicon.ico"> Steam</a></figcaption>
</figure>
</div>
<p>
it would take about <script type="module" id="breakeven">celine.cell('breakeven', ['lostValuePerWeek'], (lostValuePerWeek) =>
htl.html`<output>${(70 / d3.mean(lostValuePerWeek)).toFixed(1)} weeks</output>`
)</script> to break even.
</p>
<center style="font-size: larger; padding-bottom: 1em;">
❦
</center>
</main>
</body>
</html>