16 ms·
The journey to Nintendo Switch
- mcphage 4y agoThis came as a total surprise... I'm impressed they managed to get the game running well on the Switch! Will I actually buy it again, just to have it on the Switch? ...yes. Yes, I will.
- kergonath 4y agoI would absolutely love an iPad version. Much more than the Switch version (which I am going to get anyway).
- Sakos 4y agoIt would certainly blow the Switch version out of the water performance-wise.
- MBCook 4y agoThat sounds great to me. And the iPad has a better screen and still supports PS/Xbox/Switch controllers. But there would have to be a touch only interface and that may be the killer.
- hatware 4y agoMight be the only thing that can utilize all the power of an M1 Pro!
- krallja 4y agoThe devs have talked about performance bottlenecks a lot - the real benefit of Factorio on the M1 would be the RAM interconnect, as most of the performance issues are related to RAM latency. Upgrading your PC from (e.g.) DDR3 to DDR4 gives you a whole lot more FPS per $ than upgrading your graphics card or CPU.
- kergonath 4y agoSounds like the M1 is Taylor-made for this, then! The memory bandwidth is insane and latency is great.
- wtallis 4y agoDoes Factorio benefit more from RAM latency or bandwidth? Apple's processors have unprecedented GPU-like memory bandwidth available to the CPU, but I don't recall hearing about the latency being anything special. (For latency, AMD's 3D-stacked cache might be the best solution out there.)
- selectodude 4y agoSeems like ram latency is huge for factorio. I know the UPS skyrocketed on the 5800X3D with its 96mb of L3. https://www.reddit.com/r/factorio/comments/f2nab9/ram_speed_and_factorio/ https://www.reddit.com/r/factorio/comments/f2nab9/ram_speed_...
- ls612 4y agoWell if they port it to Apple Silicon macs making an iOS build shouldn’t be crazy difficult right? (Famous last words)
- duskwuff 4y agoStill waiting on the Apple Silicon port. The Mac build of the game is still x86-only.
- dang 4y agoRelated: Factorio is coming to Nintendo Switch - https://news.ycombinator.com/item?id=32825543 https://news.ycombinator.com/item?id=32825543 - Sept 2022 (359 comments)
- dvfjsdhgfv 4y agoI was so excited when I saw the Allegro library in the 90s! I lost track of it later and believed it was dead (I believe the author went to Microsoft to work on DirectX). But lo and behold, I've just checked what libraries the Factorio guys used - and what a pleasant surprise!
- hoten 4y agoYup, allegro is alive and well as version 5. But it's pretty much entirely different.
- glandium 4y agoThe Nintendo Switch has an ARM64 CPU, which means the biggest part of porting to that CPU is now done. Does it mean we can expect an Apple Silicon mac build some time soon(ish)?
- desindol 4y agoNo. It’s a completely different graphic stack.
- fredoralive 4y agoThere’s already a Mac OS version, so it they’ve presumably already handled that side of things.
- Shared404 4y agoIIRC, Factorio uses SDL - which afaict already targets macOS.
- Cyberdog 4y agoLike most macOS games, it most likely is an x86-64 game that Apple's x86-64 emulator does an admirable job of emulating. As far as I can tell, very few Mac games, even new ones, are proper ARM builds currently.
- Kukumber 4y agoIf you target PC/Console and don't have an abstract GPU interface, then you should rethink your life choices And all the graphics stacks nowadays are similar, Vulkan, Metal, DX12, all share the same ideas Also there are countless opensource cross platform GPU libs, bgfx [1] or sokol [2] for example [1] - https://github.com/bkaradzic/bgfx https://github.com/bkaradzic/bgfx [2] - https://github.com/floooh/sokol https://github.com/floooh/sokol
- desindol 4y agoYeah theoretically it’s that easy but irl it’s not…
- j_m_b 4y agoWill the controller designs end up in the pc version? Would love to play this on my Steam Deck in console mode!
- Morgawr 4y agoThe article linked says this: > Even after the launch, there is much to do. Next to my screen there's a stack of post-it notes with future improvements, possible features and technical debt I need to solve. As mentioned in the announcement last week, after the launch I will also work on controller support for PC and Steam Deck.
- mdmglr 4y agoI’m not a game developer. What I would like to know is how does porting the code that draws the UIs and perhaps the game work? For example on PC one might use WinForms and DirectX so is this just a matter of writing wrappers to all your DirectX calls to the Switch equivalents?
- pjmlp 4y agoIt is a bit more involved than that, but yeah that is kind of basics. The Switch supports OpenGL 4.6, Vulkan, and their own API NVN, which actually many engines make use of. Most likely Factorio is using one of the former anyway, so that problem is kind of out of the way, other that having to deal with the extensions and hardware/driver specific behaviors. Then as they mention the blog, having to adjust the way the GUI works from a PC setup to an handheld.
- weberer 4y agoFactorio uses SDL. Factorio has been cross-platform (Linux, Windows, Mac) from the beginning, so it makes sense that they're not tied down to Microsoft's proprietary nonsense. I'd imagine this choice made it a lot easier to port to the Switch as well. https://www.factorio.com/blog/post/fff-230 https://www.factorio.com/blog/post/fff-230 https://www.libsdl.org/index.php https://www.libsdl.org/index.php
- exebook 4y agoAm I the only one who after seeing the title thought they are building Nintendo switch inside Factorio? Which makes me think can it at least run something like Atari 2600 at decent speed?
- jerf 4y agoA Minecraft-based Atari 2600 emulator was running about 1 frame per second last I knew: https://www.youtube.com/watch?v=mq7T5_xH24M https://www.youtube.com/watch?v=mq7T5_xH24M And that's heavily based on internal scripting with real code. The recent "Minecraft"-in-Minecraft emulation was done with pure Redstone internal to the game, but has to be run on a specialized server that accelerates Redstone operations by several thousands to be even fast enough to record time lapses at a reasonable sped. In-game simulations of logic gates that are generally running at fractions of a Hz are a pretty steep obstacle to overcome for any "real" computing like that. Just to calibrate your expectations.
- bombcar 4y agoLots of things already are in progress on similar things: https://old.reddit.com/r/factorio/comments/93cd1t/building_a_computer_in_factorio/ https://old.reddit.com/r/factorio/comments/93cd1t/building_a...
- candiddevmike 4y ago> Now, the final startup time when the game is installed on internal storage is 70 seconds, but let's not get ahead of ourselves. Maybe I don't notice this with other games but that seems like a really long time.
- hbn 4y agoThat jumped out to me too. I was hoping "let's not get ahead of ourselves" meant he'd explain why the startup time is so long but it's never mentioned again. I just timed Breath of the Wild (cartridge version), and from the time I launched the game from the Switch menu to seeing the game menu was about 16 seconds, and the time from selecting a save file to loading the game world was about 18 seconds. What exactly about this game makes it take so long to load?
- rjh29 4y agoBotW got some after-launch patches that significantly reduced the launch time. They did this by overclocking the Switch during load. I didn't see any mention of boost/overclock in the Factorio writeup, though.
- hbn 4y agoInteresting, I wasn't aware (or forgot)! I looked into it though, and it seems like it wasn't anywhere near the minute+ mentioned in the article. I found a GameFaqs forum thread[1] from shortly after the game launched that claims it was about 20 seconds. And a US Gamer article[2] that says the update that came a couple years later only shaved off about 5 seconds (seems within the ballpark of what I measured) [1] https://gamefaqs.gamespot.com/boards/189707-the-legend-of-zelda-breath-of-the-wild/75137599 https://gamefaqs.gamespot.com/boards/189707-the-legend-of-ze... [2] https://www.usgamer.net/articles/breath-of-the-wild-load-times-much-faster-after-labo-vr-update https://www.usgamer.net/articles/breath-of-the-wild-load-tim...
- simias 4y agoDo you know if this technique is available for all games or just Nintendo's own? It seems like it would be easy to cause issues if games were allowed to mess with the clocking willy-nilly, so I assumed that it was only done on Zelda because it's a first-party title (and one of the biggest on the console).
- deleted 4y ago[deleted]
- bombcar 4y agoIt's still a year away according to the end of the blog, but it's nice to get an insight into the amount of work necessary for a port. (oops, that was the expansion, misread)
- neogodless 4y ago> But we are releasing on 28th October 2022 Unless I'm misunderstanding this section, that's about 5 weeks away. > it still won't be ready sooner than in a year from now This is a reference to the expansion.
- guidopallemans 4y agoThis comment was about the upcoming Factorio expansion.
- deleted 4y ago[deleted]
- TillE 4y ago> It allowed me to make many Nintendo Switch specific optimizations, and even some optimizations for the PC version Are there significant CPU-specific optimizations that can be made for the Switch / ARMv8 that wouldn't apply to x86-64? I've never really dug into things at that level, I wouldn't know where to begin except for like vector instructions.
- colpabar 4y agoI have no idea. But if there are, the factorio devs will find them and write an extremely detailed blog post about the entire process.
- packetlost 4y agoMy understanding is ARM has less strict memory (ordering) guarantees, as well as the inability to explicitly trigger cache line flushes from user-space. That being said, I imagine most of the optimizations would come from the particular aspects of the GPU/graphics pipeline, which I imagine is substantially different from the standard PC structure.
- TillE 4y agoYeah you can always cut corners with the GPU if you have to, but Factorio has the large problem of making a CPU-intensive deterministic simulation run at 60 Hz. Thinking about it some more, there are also probably some tweaks you could use for situations with limited resources which wouldn't apply to most PCs, but would affect the Switch.
- Rebelgecko 4y ago(Disclaimer: I haven't written assembly for a while so this may not be true any more) One cool thing about ARM is that vector instructions run in parallel with the regular CPU pipeline. You can do some neat optimizations where you interleave sequential part of an algorithm runs while the SIMD instructions are executing. However if you do this yourself the code is going to be super non-portable. In general, knowing that something is always going to be running on a Switch lets you dig deeper into architecture specific optimizations, since x86 has so much variance it would take a ton of effort to really dial in performance on the whole menagerie of Intel and AMD CPUs
- Arrath 4y ago> "This is the first time we had to make sure the game is deterministic between ARM and x86. We should be fine, C++ is portable, right? Just don't use undefined behavior. Turns out we use quite a lot of undefined behavior..." Hah
- RicoElectrico 4y agoWould it occur had they used UBsan on debug builds?
- von_lohengramm 4y agoFor things that UBsan checks for, yes, but there's a ridiculous amount of things that are surprisingly UB in C(++).
- yeputons 4y agoNo doubt. For starters, UBsan does not check for any invalid memory access. In my C++ course, I require that the code runs correctly under 5 different compilers (GCC, LLVM Clang, Apple Clang, MSVC, Intel C++ Compiler Classic) on 3 OS (Ubuntu, Windows, macOS) in Release, Debug+Valgrind, Debug+Sanitizers modes, and students still get UB quite often. Extra reading: http://evan.nemerson.com/2021/05/04/portability-is-reliability/ http://evan.nemerson.com/2021/05/04/portability-is-reliabili... and discussion at https://news.ycombinator.com/item?id=27044419 https://news.ycombinator.com/item?id=27044419
- absolutelynobo 4y agoWhy even write C++ at that point? Wouldn’t changing over to Rust save you at least a couple of those steps?
- pjmlp 4y agoTooling, libraries, OS vendor support, IDEs, work force availability,... Many of us write C and C++, because we have to, not because we want to. Rust will eventually reach there, however many of us want to deliver a product, not build an ecosystem from scratch.
- jjmorrison 4y agoFactorio is the best game I've ever played. It's so good.
- naranha 4y agoIf the switch proves anything it's that you don't have to pay $1600 for a GPU to enjoy amazing games. Or the other way round, if you pay $1600 for a gpu it does not mean that you'll be able to play any good games.
- afterburner 4y agoI mean that's always been Nintendo's thing, hasn't it? Cheaper, less powerful consoles, but focus on iconic gameplay
- ProfessorLayton 4y agoNot always, the N64 was more powerful and more expensive (Game carts) than the competition. So was the GameCube (It was more powerful than the PS2).
- mejutoco 4y agoMaybe the cpu was more powerful (honestly idk) but the low memory of the N64 limited the textures and video features (never saw any video in an N64 game) in the games (see how flat texture-wise the textures of Mario64 are).
- hbn 4y agoI'd say that only really started in the 7th console generation (Wii, PS3, Xbox 360) Gamecube and prior was roughly comparable to the competition, but after that the other companies were trying to outperform each other in graphical fidelity while Nintendo released basically another Gamecube but with motion controls. And it was a hit!
- stryan 4y ago> I'd say that only really started in the 7th console generation (Wii, PS3, Xbox 360) I think that's when they really started leaning into it again, but Gunpei Yokoi (Gameboy inventor) was a big proponent of the idea, which he called "Lateral Thinking with Withered Technology". So it's been a part of Nintendos design process for a while before that.
- jvanderbot 4y ago> Removing all uses of undefined behaviour is probably a fool's errand, as it would require significant changes throughout the code that would take time and come with a performance impact, all for no immediate practical benefit. So I just hunted down the undefined behaviour cases that actually broke determinism. This was easy enough, as we have plenty of tools we use to test determinism. By comparing the game state CRC for every tick of every test (we have 2,417 tests) between x86 and ARM, I believe I got a pretty good coverage of potential issues. Holy hell.
- TillE 4y agoAutomated testing is great! More game developers should get serious about using it, even if you're not doing full coverage unit testing like business software.
- mbrodersen 4y agoYes! Automated testing is a super power. I haven’t had a single bug in production for 5+ years because of automated tests.
- bri3d 4y agoThis kind of determinism testing is a fairly common approach in games that implement shared-state multiplayer, and I think that's why it was implemented for Factorio as well. Otherwise you get drift between clients that breaks the game.
- TrainedMonkey 4y agoOne alternative is to run everything on the server, but that introduces another set of problems.
- m4rtink 4y agoIIRC that's what Satisfactory does and it causes all sorts of synchronization issues and glitches - non-hosting players not seeing buildings or stuff on belts or even glitching into/colliding with things that were not there a split second ago, as they loaded from the server too slowly. That won't really happen in Factorio due to the shared state & makes possible insanely complex layouts that all players can see an interact with exactly the same. The downside usually is that eventually - just after you got that 20 GW nuclear power plant with trucked water & and steam going - the slowest player starts to have issues as his hardware no longer can keep with the complexity of the simulation. Then you either start shedding players or call it a day and start again with a different objective or mod.
- SpacePortKnight 4y agoFactorio's official requirement for x86 is a dual core 3.0Ghz processor & yet it's able to run on Switch which has a very weak 1Ghz quad core cortex-A57 ARM CPU. How is this possible? I would imagine CPU requirements to be more or less same across any resolution / operating system. This is what makes Nintendo Switch interesting to me. It's CPU is even less powerful than an Raspberry Pi 4. Even midrange android smartphones today are much more efficient and powerful than Switch and yet Switch can run Doom / Skyrim just fine.
- Cyberdog 4y agoBecause the Switch is running Factorio on top of a bit of code optimized for running games. A PC is running Factorio on top of a full-featured general-purpose OS, and most PC users are going to be running other things concurrently; web browsers, Electron messaging apps, malware, etc. Of course, being able to target a single hardware platform with very minor differences like the Switch also means the ability to make optimizations to that specific platform without having to care about possibly breaking compatibility with others. It'd be like being able to optimize your game for people with Nvidia cards and completely ignore those with ATI, Intel, or any other brands on the PC.
- packetlost 4y agoThe platform variance for x86/x64 CPUs is... way bigger. The actual instructions per-clock could be wildly different and has massive impact on performance than just the clockspeed.
- djmips 4y agoThe Switch CPU isn't actually that terrible. You can run into issues with the number of cores. The main thing you will find is that generally most codebases are full of potential optimizions but they aren't acted on until you find yourself constrained.
- Johanx64 4y agoSwitch can't run Doom "just fine", it downscales down to 360p frequently and chogs between 20-30fps. It's barely playable. Mind you, Doom is one of the better optimized games of this gen. And running it sub~60fps on with all settings turned down to ultra low is a sin. Factorio is pretty well optimized too, however the factory size Switch can handle are on the - can launch the rocket - scale. This is but a small fraction of the factory size people end up building
- foolfoolz 4y agowhen i’ve played games like RCT1 that can handle thousands of guests in the park, 1000s of placed items, each square customized, hundreds of rides simultaneously with real physics, it makes me wonder why factorio needs such intense system requirements for a mostly 2d production game
- gh02t 4y agoFor one thing RCT1 was famously written in hand tuned assembly language, but the main reason AFAIU is coupling of components. Early Factorio isn't that bad, but later factories it has to constantly simulate every machine on the map all of the time because everything is running regardless of your presence and everything is interconnected. That complexity scales up rapidly as your factory expands. Games like RCT aren't as dynamic and tightly coupled, so the simulation can use a lot of simplifications to cut down on on CPU use.