Recursive noise functions crash without erroring
Posted: Thu Mar 12, 2026 8:42 am
So, I was testing something to see if I could use recursion or something like it to do summation notation in the noise system because I was curious and it would make the port of ClaustOrephobic easier.
I discovered that if you make a recursive NamedNoiseFunction:
1. The game accepts it as valid if it is never called. It just loads silently without objection to your Nonsense.
2. The game silently crashes if it is called at what appears to be the end of data stage. No error, no angry messages in factorio-current.log - it just crashes to desktop.
Reproducing this is trivial. Write a recursive noise function such as the following:
Then put it literally anywhere its value will be used. Congrats, the game should now crash on startup.
I assume this is probably best fixed by just making it error before it's fully parsed, which is what I assume causes the crash.
I discovered that if you make a recursive NamedNoiseFunction:
1. The game accepts it as valid if it is never called. It just loads silently without objection to your Nonsense.
2. The game silently crashes if it is called at what appears to be the end of data stage. No error, no angry messages in factorio-current.log - it just crashes to desktop.
Reproducing this is trivial. Write a recursive noise function such as the following:
Code: Select all
{
type = "noise-function",
name = "claustorephobic_recursive_function_test",
parameters = {"count"},
expression = "if(count <= 0, 0, claustorephobic_recursive_function_test(count - 1) + 1)"
}
I assume this is probably best fixed by just making it error before it's fully parsed, which is what I assume causes the crash.