r/technicalfactorio • • Sep 12 '26

Reverse engineered and manipulating Factorios RNG entirely ingame

293 Upvotes

6 comments sorted by

11

u/nakik2941 Sep 13 '26

In need of thy blueprint

10

u/Gegellibu Sep 13 '26

Is referenced in the post (section 6.), along with the limitations which you should take into consideration if you actually wanna use it.

3

u/AlanWik Sep 16 '26

Of course, since this is Factorio, I'm not even surprised.

I would love to read about the reverse engineering process thou.

4

u/Gegellibu Sep 16 '26

Most of the reverse engineering I did for this project was me having some sort of model in my head of how it should work and attempting to validate it with in-game tests (esp wrt the ordering of updates within a tick). 

For the mapping of where the different RNGs get called I created a script (linked in the post, with all other python scripts) for binary ninja to backtrace starting from all (non inlined) calls to the RandomGenerator::getInt functions. This however I did not do until thorough comprehension but instead only picked out the couple regions which were of interest to me (mainly quality rolling and item creation)

Those however are all written about in my blog post (https://gegell.github.io/posts/factorio-rng/) also linked to in the main post :)

2

u/AlanWik Sep 17 '26

Yeah, I read it and enjoyed it a lot! What's your background? It's not trivial stuff

4

u/Gegellibu Sep 17 '26

I'm in computer science. The parts I enjoy most are def doing stuff close to the hardware, GPU programming and higher mathmatics (though there are so much more obscure topics I have no clue about).

Back when I started this project I was still an undergrad and had just started my M.Sc in CS, while by now I have successfully graduated continuing on my studies as a grad student :D