News for hackers. Stuff that matters.
Re:Factorio: Space Age by throwaway894345 on Friday August 25, 2023 @11:05AM (#37262522)
Is the Factorio source code available anywhere? I would be really curious to see how a game like Factorio was developed (e.g., what parts are 'the engine' and what parts are scripted? how does such a complex game have so few bugs?)
Re:Factorio: Space Age by Therenas on Friday August 25, 2023 @11:15AM (#37262660)
The source is not publicly available, no. It‘s still being actively developed and sold after all. There isn‘t really much of a barrier between engine and 'scripting', it‘s all custom and integrated. The reason there are so few bugs is that there is a ton of effort spent on squashing them! The approach is basically to fix any reported issue if in any way reasonable.
Re:Factorio: Space Age by Zambyte on Friday August 25, 2023 @03:02PM (#37265812)
> The source is not publicly available, no. It‘s still being actively developed and sold after all.

Those two are definitely not incompatible. Take Karia[0] for example, which is fully Free Software[1].

[0] https://store.steampowered.com/app/1261430/Kandria/

[1] https://github.com/Shirakumo/kandria/blob/master/LICENSE

Re:Factorio: Space Age by BlueTemplar on Friday August 25, 2023 @06:01PM (#37267543)
Yeah, I wish more games would use this approach, they could for instance have the art assets separate, or do what Factorio does and have matchmaking and the official mod portal to be DRMed. (And/Or give out the source, but not the compiled binaries.)
Re:Factorio: Space Age by Zecc on Friday August 25, 2023 @08:24PM (#37268694)
Or (while on the subject of Factorio) Mindustry:

[0] https://mindustrygame.github.io/

Re:Factorio: Space Age by lannisterstark on Sunday August 27, 2023 @05:33AM (#37280957)
Factorio is arguably way, way more popular than Kandria, however.
Re:Factorio: Space Age by BlueTemplar on Sunday August 27, 2023 @10:57AM (#37283316)
It is now, are you suggesting it wouldn't have been as popular if it had been open sourced (more) ?
Re:Factorio: Space Age by lannisterstark on Wednesday August 30, 2023 @12:55AM (#37317839)
I'm suggesting that Open Sourcing an incredibly Popular game that has been selling well NOW would be a bad idea for sales.
Re:Factorio: Space Age by Zambyte on Sunday August 27, 2023 @04:09PM (#37286175)
I've never played Factorio so I didn't know that :)
Re:Factorio: Space Age by pmoriarty on Friday August 25, 2023 @11:15AM (#37262656)
Factorio is closed-source, unfortunately. Still, you can read a lot about how the devs developed it on their "Friday Facts" posts: https://factorio.com/blog/
Re:Factorio: Space Age by bombcar on Friday August 25, 2023 @12:43PM (#37263851)
This is actually better than the raw source for understanding the development; you have to start at the beginning and read forward.

Basically - tests, reproducibility, and dedication to tracking down "weird minor bugs" before they become "major show stoppers".

Re:Factorio: Space Age by k12sosse on Friday August 25, 2023 @11:10AM (#37262590)
You can turn bugs on or off when starting your world ;) depends on if you want to - oh, BUGS bugs, not bugs bugs.
Re:Factorio: Space Age by duskwuff on Friday August 25, 2023 @12:58PM (#37264098)
The C++ source code to the engine isn't publicly available, but Wube have given access to some outside developers.

The Lua source code to the "base mod" is (necessarily) included in the game, and you can read it if you have a copy of the game, and the modding API is fully documented: https://lua-api.factorio.com/

Re:Factorio: Space Age by TillE on Friday August 25, 2023 @02:45PM (#37265631)
In addition to their very informative blogs, you can infer a lot based on their extensive Lua modding API:

https://lua-api.factorio.com/latest/

They also ship a full .pdb file with the Windows binaries (presumably for stack traces), so you can get a lot of information with dia2dump, or dig in with WinDbg.

Re:Factorio: Space Age by rcxdude on Friday August 25, 2023 @07:42PM (#37268424)
They do seem to have shared the source code with some of the more prominent modders in the past, but it is not generally available.
Re:Factorio: Space Age by dekhn on Friday August 25, 2023 @08:13PM (#37268612)
I spent some time thinking about how to implement Factorio and it occurred to me that things like conveyors are probably represented as linked lists (all the conveyer elements in order) while also having X,Y grid coordinates. Every time you modify a conveyor belt chain, the game engine is probably adding/removing nodes from the list, or splitting lists in two, or joining two lists. I can't see how they get some of the effects in the game but there is probably a TON of clever optimization so they can maintain the target frame rate.
Re:Factorio: Space Age by francoisdevlin on Friday August 25, 2023 @08:17PM (#37268634)
Re:Factorio: Space Age by Buttons840 on Saturday August 26, 2023 @09:06PM (#37278441)
As said, Factorio's core is compiled binary, with a lot of customizable Lua on top.

Fun story:

Somebody independently recreated the core engine themselves to prove a point about multi-threading. Imagine recreating an entire game engine in 50,000 lines of C++ to prove a point, yeah, it happened: https://www.reddit.com/r/factorio/comments/jizq1b/comment/ga... What a legend!