5 ms·
This has been Factorio's MO from the beginning. It was in Early Access forver, and all that time it was way more polished and stable than many fully released g
by pmoriarty 3y ago
This has been Factorio's MO from the beginning. It was in Early Access forver, and all that time it was way more polished and stable than many fully released games with much higher budgets.
In the decade or so that I've played Factorio, I can't even remember a single crash of the base game. It was always mods that crashed.
Factorio performance is also fantastic, running smoothly on potato PC's until you get in to the megabase range. It's mostly mods that cause performance problems, but even those have gotten a lot better over the years.
The Factorio devs could really give a master class on how to make games moddable. Factorio's ecosystem of over 5000 mods is a testament to that.
- nextaccountic 3y ago> It was always mods that crashed. I wish modding APIs in general did more sanity checking before loading a mod. A low hanging fruit is APIs to be statically typed, and also to not use nulls on such APIs and things like that. A more comprehensive check is to verify whether two mods are guaranteed to be compatible (but this sounds a bit hard). But more importantly (not sure if that's the case with Factorio) not break the damn APIs all the time. Lots of games that are actively developed don't bother keeping stable APIs (a bit like like Gnome and its disregard for extension APIs), breaking mods at every new release. An egregious example is Europa Universalis IV and other Paradox games. This ensures that there is a tail end of mods (which is by far the majority) that just will never work anymore, and the mods being kept up to date become rarer and rarer.
- Jenk 3y agoI would truly love to see a game use haskell for mod APIs. Or perhaps erlang a better choice. As an example of just how far accessible APIs can benefit games/their players: The god awful language and API that has enabled Armed Assault franchise modders to create entirely new games - literally, PUBG started life as a mod for Armed Assault 2. Armed Assault 3 launched ten years ago, and there are still many new mods being produced today, and Bohemia have further embraced this community by supporting "community developed" DLCs such that modders get rewarded for their effort. I often wonder how much better/diverse/stable these innovative and entrepeneurial ventures could be with a "proper" API.
- pmoriarty 3y agoThe main problem with that is that there aren't nearly as many people who know Haskell or Erlang compared to those who know Lua. Lua has been a modding staple across countless games, so millions of gamers/modders are already familiar with it. I'm convinced that chosing Lua for modding is one of the main reasons Factorio has over 5000 mods now. If they'd chosen a more obscure language I'd doubt we'd have nearly as many.
- Jenk 3y agoMy point for choosing AA as an example was that it uses an entirely bespoke language, modelling system, and the APIs are just horrendous. Obscurity has not prevented (some) great things happen with/for Bohemia but I do wonder what greatness has been missed out because of it. As for Lua I think it is rather chicken:egg. Lua is popular because it is used by mod APIs, or is Lua use by mod APIs because it is popular? My own experience is the former. I think it is a horrible language (in that I argue many others are better) and especially difficult for new-to-programming gamers with great ideas to pick up. Haskell or Erlang (or Java or C#) with type-safe APIs would be much more educational for them, and provide better support IMO.
- 0cf8612b2e1e 3y agoLua is used because it is dead simple to drop into a project as an extension language. It was designed to be easy to interoperate with C. Lua/LuaJIT is one of the fastest scripting languages available.
- vluft 3y agolua is used by mod APIs because it's very performant and extremely easy to embed in C/C++. > especially difficult for new-to-programming gamers with great ideas to pick up and you're proposing haskell or erlang as an alternative first programming language for somebody?
- _proofs 3y agothis is a strange take for me to read -- i've written quite a decent amount of lua, and it is the first language i used to learn (zero programming experience prior) when i eventually got exposed to python (but more heavily C/C++, and even some lisp/pascal) and came back to lua, i was grateful lua did not inundate me with parens/primitives/modules/data-structures/grammars, and found the flexibility of the interpreter and also what lua tables present as a unified primitive for multiple container types to be so nice and accessible for getting right to flow-state. i did not have to look up another API and read about a set of semantics provided with a desired module, i just needed to know 1. what i want to achieve and 2. a single API: the lua table its small std library is performant and easy on the cognitive load, and then it plays so nicely with other languages and environments. have you written much lua?
- Akronymus 3y agoOh, the factorio api has excellent stability along with informing you on startup about most errors/incompatibilities.
- NelsonMinar 3y agoI don't expect videogames to be the first to successfully solve the problem of statically checking code for correctness ;-) I'm astonished how stable so many mods are, given the environment they run in and the lack of almost any payment for the work. The Minecraft Java world at least starts with static types and memory safety. It'd be interesting to see if that results in a mod ecosystem that's more stable.
- danielheath 3y agoThe Minecraft Java world starts with decompiling bytecode, replacing methods, and recompiling it. I struggle to think what could be further from either static types or memory safety - although at least that happens in the mod loader, and the mod code needn't be aware of how the sausage is made.
- NelsonMinar 3y agoI don't think any of those steps significantly disrupt type checking or memory safety. It's hacky as all hell but it's still constrained by the JVM and bytecode validity.
- BlueTemplar 3y agoFor several years now, Wube has been careful to very clearly announce upcoming changes that might break mods : https://forums.factorio.com/viewtopic.php?f=34&t=70603 https://forums.factorio.com/viewtopic.php?f=34&t=70603
- tailspin2019 3y agoCan confirm performance is pretty good on Macs too, even older Intel models.
- ezfe 3y agoThat being said, it does natively support Apple Silicon as a side effect of being on the Switch
- EMM_386 3y ago> Factorio performance is also fantastic I still don't know how they pulled this off, and as a software engineer I've read all of the development blogs. It is still impressive that you can scale this thing to huge mega-bases, with things smoothly gliding down coveyer belts, inserters swinging, bots flying around, trains everywhere, biters doing biter things all over the exposed (essentially endless) map ... and no problem in most cases. 60 FPS/UPS. It almost seems as if the entire thing is written in handcrafted assembly compared to how other games perform. I'm sure parts of it are.
- duskwuff 3y ago> It almost seems as if the entire thing is written in handcrafted assembly compared to how other games perform. As far as I'm aware, it's all C++.
- db48x 3y agoThey’ve never said that they hand–wrote any assembly, though I suppose it’s not impossible. Mostly they were simply diligent and focused on never regressing performance, and on continuously improving it. They even changed game mechanics over the early access period to improve performance. For example, originally a conveyor belt applied a speed to any object in the same tile. Each frame the position of the object would be updated based on the speed, just the same as any other moving object. You could place down up to three objects side–by–side on the belt, and they would all travel together. But eventually they realized that this is a waste of time, because inserters only ever place items in specific positions on the belt, and the items are all the same size. This means that they could instead just keep a bitmask of which spots are filled, and a queue of items that will pop out of the edge of the tile. Even that is wasteful though, because you might have 1000 tiles of belts all in a row, so you can group them all into a single queue. Now you only have to put new items into the beginning of a single queue and take them out of the end, instead of doing that for 1000 queues. On the other hand, this means that you can no longer put down items at arbitrary positions on a belt; they will now snap into one of the 12 slots in one of the two lanes. A similar thing happened to inserters. It used to be that they had a certain amount of rotational speed, and would calculate a new position and rotation for each of their three two joints every frame. Eventually they realized that 99% of the time they would be in the same few positions over and over again; it is only when they are chasing an object on a belt that is too fast that they need to calculate a position. The rest of the time they just loop through a fixed animation. This gave Wube the opportunity to tweak the animation cycles so that they are exactly the same length in all orientations of the inserter, which is definitely a good thing. And of course they consistently paid close attention to data locality, so that every time they have to work on a collection of objects they maximize the amount of useful data that fits into the CPU cache. I haven’t seen the code, of course, but I assume that this means that they are using an ECS–style system where you have a dense array of just the position and speed of each biter, or just the animation frame for each inserter. The code can then loop over those dense arrays knowing that it doesn’t have to test the type of each item in the array (few or no branches needed), and that every byte loaded into cache will be used during the loop (maximizing use of the memory bandwidth).