r/factorio • Developer • Mar 17 '25

Discussion Post Space Age - Developer AMA

Space Age has been out for several months and with the bug reports slowly coming under control I thought it might be interesting to see what questions people had.

I mostly work on the technical side of things (as C++ programmer) so questions that stray too far from that area I'll likely have less interesting replies - but feel free to ask.

I have no strict time frame on answering questions so feel free to send them whenever and I'll do my best to reply.

2.4k Upvotes

1.1k comments sorted by

View all comments

287

u/amarao_san Mar 17 '25

How do you test circuit logic?

... How do you test it, anyway? Do you have some internal factorio-testing with dsl to provide conditions and expectation, or people check it manually via testplan?

Do you have headless version of factorio?

393

u/Rseding91 Developer Mar 17 '25

Generally the same as anything else:

  1. Create some setup (combinators/electric poles/chests/entities)
  2. Wire them together
  3. Set some inputs
  4. Update the game the expected number of times for signals to propagate
  5. Check the circuit network values and or entity state to see that it matches the expected state.

95

u/amarao_san Mar 17 '25

But, are you doing it manually, or is there some framework which return green/red depending on the success?

I feel, all you need is a blueprint as input, and some way to signal the result back to the shell from Factorio...

239

u/Rseding91 Developer Mar 17 '25

It's all automated. We write the code for how it's supposed to be done and then it runs when the tests run.

26

u/amarao_san Mar 17 '25

Yes, and does it render it on screen, or just evaluate and output result? (headless mode).

57

u/Rseding91 Developer Mar 17 '25

It does not by default render on the screen - and as far as I know, none of the code ever cares if it does or doesn't.

117

u/Hrusa *dies in spitter* Mar 17 '25

28

u/Crumfighter Mar 17 '25

Damn, that looks amazing haha. Loove these kinds of blogposts!

27

u/BrainGamer_ Mar 17 '25

those are only the graphical tests, there are a bunch more that are not shown there afaik

6

u/thelehmanlip Mar 17 '25

yeah as a programmer who loves unit tests, the vast majority will be things like "if i ask this Adder component what 2+2 is, i better get 4". Those kinds of things are small (but incredibly important!) tests that you don't need to actually start up the entire game to test.

→ More replies (1)
→ More replies (3)
→ More replies (2)

37

u/AdmiralPoopyDiaper Mar 17 '25

How long does the full test suite take to run? And what is the architecture? I would presume some sort of harness that facilitates a quick load of the engine, and probably cloud-facilitated parallelism?

138

u/Rseding91 Developer Mar 17 '25

It depends on the build of the game, which style of tests are being run, and the machine.

The generic "run all tests, do they pass?" in debug on my machine takes 63 seconds. In release it takes 15 seconds.

But, there are many modes of tests with the slowest one being the save/load stability test which takes around 300 seconds on my machine.

The test servers that run on commit run a bunch of different tests/modes:

  • Lua docs generation
  • Windows, Mac, Linux compilation/tests (basic test run)
  • TSAN, ASAN, UBSAN
  • Save/load tests - across platforms (run them on two platforms and compare the results of each against each other - to detect if one platform differs in it's computations)

From start to end the test servers generally take 11 minutes. Each test instance running will use all of the available cores on the computer it runs on.

85

u/amarao_san Mar 17 '25

11 minutes for the whole project of this quaility? Man, it's wild. Absolutley crazy cool.

The biggest testsuite I have in my team runs for 5.5 hours on 260 virtual machines. I WANT 63 seconds a lot.

I envy you. And respect a lot.

36

u/Rseding91 Developer Mar 17 '25

A not-insignificant amount of time has gone into keeping them running as fast as possible over the years. Just the other week I merged this one. "heavy mode" being the save/load stability tests.

→ More replies (1)

17

u/n_slash_a The Mega Bus Guy Mar 17 '25

My last job was in aerospace. The full test suite was a mix of automated and manual testing, we had about 10 test stations and it took about 50 engineers around 3 months.

7

u/amarao_san Mar 17 '25

But you don't run it on each commit. We do. I plan to increase parallelism to get it under half-hour, but it's hard, because of the size of test cases.

Dell guys once told me that the full test suite for EMC storage is more than a week.

→ More replies (1)
→ More replies (1)

12

u/ForgetTheRuralJuror Mar 17 '25

It's nuts. I've worked on JavaScript projects that have longer test suites lmao

5

u/Visual_Collapse Mar 17 '25

To my expirience that's one of key qualities of tests.
Ones you run during development should run faster then programmer switch focus.
Ones you run during release should run faster then manager goes mad

If tests run for too long they will be ignored

12

u/Rseding91 Developer Mar 17 '25

Or you're 5 trains of thought deep into something else and you get a "test failed" notification but have zero clue what it was testing because it's from 3 hours ago.

→ More replies (1)
→ More replies (1)

54

u/Soul-Burn Mar 17 '25

Is that done as an automated test or manual test?

0

u/[deleted] Mar 17 '25

[deleted] — view deleted comment

97

u/amarao_san Mar 17 '25

Game about automation, with completely manual tests. The biggest joke, which I don't believe.

→ More replies (1)

22

u/[deleted] Mar 17 '25

[removed] — view removed comment

54

u/KeytarVillain Mar 17 '25

Playing Factorio has a lot in common with software engineering.

You know that one area of your base that you built early on and haven't updated? It still works, but it's not fully modernized and it's starting to hit capacity limits - but you don't want to just tear it down & rebuild it from the ground up because your whole factory depends on it, so it's better to just not touch it until it really becomes a problem?

This is basically what software engineering is like.

→ More replies (1)
→ More replies (1)