7 ms·
Retro Boy: simple Game Boy emulator written in Rust, can be played on the web
- catapart 2y agoIt plays really slow in Firefox, and there are also audio issues (they may be related?) But in Chrome, this plays really well! Great work!
- tonyhart7 2y agoofc it is firefox
- ShinTakuya 2y agoCan I inquire as to why you feel so negatively about Firefox?
- tonyhart7 2y agoburn a lot of fcking goodwill for measly 4% web user, turn out eating google money literally make you the next "google" chromium edge literally surpass firefox and with new policy it would eat more to the marketshare
- ShinTakuya 2y agoIs it that surprising that Edge is surpassing Firefox given Firefox doesn't have the onboarding ramp of Microsoft and Google? Microsoft shoves Edge in your face every chance it gets, as does Google. What can Mozilla do to compete against that? Unfair to use market share as an argument.
- tonyhart7 2y ago"What can Mozilla do to compete against that?" well if only Modzilla foundation spend money given to them to actual firefox development instead of ehm ehm DEI policy (lol) and pay executive millions of dollars at this rate even brave,opera browser would surpass firefox
- ShinTakuya 2y agoWhile I agree they shouldn't be putting their money towards political causes, the scrutiny of the budget is also political in nature. Of the $400 million in expenses, only around $15 million went to executives, and around $1 million went to the DEI stuff. The rest was split evenly between developing and marketing Firefox, which is basically what you were criticising them on not doing. If they got rid of all the executives and DEI, they could increase the other budgets by 2%. There is 0 chance that the 2% extra budget could help the market share and development in any significant way. And if you don't pay executives enough, you get worse executives who make worse decisions because the good ones will go to other companies. So you'll be complaining even more if the $15 million executive pay got dropped. So in short: I agree Mozilla shouldn't get involved in politics. Despite this, no reasonable person could look at the numbers and conclude it's having a material effect on the destiny of Firefox.
- tonyhart7 2y agook my past response is mostly for laugh, this is my serious response Firefox is literally default install in most if not all linux distro os, while I agree that situation is far from ideal but nothing is can be blamed other than themselves for the longest of time firefox always playing catch up with chromium to achieve parity, maybe just maybe we don't need more browser Microsoft literally give up their browser (IE), given how much resource MS has do you think firefox is doomed?? especially with DOJ force google to breakup chrome and cut off their spending on modzilla I mostly critize about firefox place in the market, Opera found an niche with Opera GX for gaming, Brave with adblock and privacy focused etc while firefox is what??? inferior of chrome???
- ShinTakuya 2y agoI can't reply further to this thread without this devolving into a flame war so I'll just observe that you've moved the goal posts claiming you were just joking, and refuse to engage further until you acknowledge you're either getting defensive for no reason or arguing in bad faith.
- shakna 2y agoWebRender recently got much slower in Firefox [0]. I haven't looked at the source yet, but if the bitmaps aren't all preallocated, then it'll run into this repeatedly. [0] https://treeherder.mozilla.org/perfherder/graphs?highlightAlerts=1&highlightChangelogData=1&highlightCommonAlerts=0&replicates=0&selected=87312,1964495950&series=mozilla-central,93432,1,13&series=mozilla-central,87324,1,13&series=mozilla-central,87312,1,13&series=mozilla-central,87336,1,13&timerange=5184000 https://treeherder.mozilla.org/perfherder/graphs?highlightAl...
- adrian17 2y agoFor me it runs at full speed in both stable and developer versions of Firefox (but even then, audio is bad at times). But still, I looked at performance out of curiosity. After running it under FF's profiler for a moment, it looks like a sync executed after every opcode recalculates the framebuffer (`step_until_next_audio_buffer -> cpu::microops::read_byte_from_memory -> emulator::sync -> gpu::scanline::write_scanlines`) and uploads it to the canvas with `putImageData`, which takes ~35% of execution time. Sounds like that could be redundant work, since I'm pretty sure the canvas isn't actually redrawn until the wasm execution yields back to the browser. EDIT: also, the emulator can't really be ran in debug mode, since 1. it blows the wasm stack (presumably when creating the huge `Emulator` struct, a not uncommon issue in Rust; I had to hack in bigger stack size with linker args), and 2. is panics on int overflows `apu::step`.
- catapart 2y agoYeah, still being on Windows 10, I almost didn't put the complaint in the comment. Lots of reasons it might just be an environment issue for me. But, in my development experience with firefox, the issues it seems to have always seem performance related (or compliance with web standards related), and I figured that even if others weren't seeing the issue, there was still probably something underlying that could be figured out. So thanks for going through the debug! It's nice to know that there may be an optimization available for the project, and it feels like it might even be an additional performance gain for chromium, if I'm understanding you right? Might be some reason they need to do that sync after every opcode, but I agree with your suspicion that the canvas is probably being over-rendered to.
- adrian17 2y agoFWIW, the thing I've found as the slowest single factor on my machine, might not be the slowest on yours; I might have not noticed the real cause of slowdowns on your machine at all, and you may be the only one able to diagnose it. (and for the record, I'm on W10 too.) Also, my personal experience from optimizing https://ruffle.rs/ https://ruffle.rs/ is that in many cases Firefox's wasm runtime can behave slightly faster than on Chrome for some reason; and performance issues are often instead caused by other APIs like the canvas.
- turnsout 2y agoLooks like an awesome addition to the GB emulation world! I know GB Studio can export a web player—I wonder if this implementation has some advantages.
- chrismaltby 2y agoI’ll definitely have a look and see if there’s any advantages. Currently using binjgb in GB Studio and been pretty happy with it https://github.com/binji/binjgb https://github.com/binji/binjgb
- cglong 2y agoOne major disadvantage is that this one doesn't seem to have an OSS license :(
- mbrubeck 2y agoLooks like the author has fixed that; it’s now available under the Apache License 2.0.
- zeta0134 2y agoThis is awesome! Very nicely done. I hear a few problems with the audio emulation, (mostly clicks that shouldn't be there) but it's been a long while since I had my head wrapped around Gameboy emulation. I'm not sure I know what's going wrong exactly. I love how Rust+WASM is an enabler for showing off applications like this which would traditionally be restricted to a desktop environment. Here's my own, an NES emulator, using wasm-bindgen for the translation but otherwise a similar setup: https://rustico.reploid.cafe/?cartridge=patreon/tactus-v0.7-alakaz-BLAM-73KPGYceH1VS6hyrAaVy.nes https://rustico.reploid.cafe/?cartridge=patreon/tactus-v0.7-... It's so cool to work on a bit of homebrew, then be able to share a link with someone and have it "just work" in their browser. No weird tools, no shady sites, just my game and their feedback.
- 2c2c2c 2y agoi combed through quite a few hobbyist gb emulators while writing mine and found audio to be pretty rarely finished or finished without issues. not sure if it's the same for NES
- zeta0134 2y agoAudio is *surprisingly* tricky on both platforms. NES has DPCM, which cheerfully interrupts the CPU and causes untold issues with controller reading. Gameboy has envelopes that are semi-required with phase-resets, and a wave channel which you in theory cannot write new samples to, and developer hacks to work around both. Both systems have various hardware revisions that have subtly different behavior, and a handful of games that will break on that specific model. It's fun!
- gblargg 2y agoIt's also more involved to verify operation. Graphics are easier to "measure" and compare. Sound is also much more timing-dependent, e.g. when timers are running on their own all the time. It's disconcerting when sound is slightly off in games.
- diggan 2y ago
- codecarter 2y agoThis is sick. Nicely done
- GaggiX 2y agoGiven the topic, does anyone has some cool homebrew ROM for the gameboy?
- dylan604 2y agoI see these retro emulators pop up from time to time, but I just don't have the time to really check them out (or the discipline to realize always an addict looking to avoid relapse). I know that there are "complications" about the ROMs to use in the emulator. However, is there a scene of people making ROMs of new games specifically for playing in these emulators? Are the game devs that are making modern games for retro systems that would be free of the "complications"?
- small_scombrus 2y agoPeople are making new GameBoy games[0]! Even new carts[1]! Though I imagine the rise of systems like the Pico8 and tic80 are siphoning people away because they can be run anywhere. 0 - https://archive.org/details/grimaces-birthday https://archive.org/details/grimaces-birthday 1 - https://orangegb.com/orangefm/ https://orangegb.com/orangefm/
- lxgr 2y agoThen again, a Game Boy emulator is usually the second thing people port to any given platform (immediately after Doom) :)
- girvo 2y agoAnd all of the ones ModRetro is publishing! https://modretro.com/collections/games https://modretro.com/collections/games
- lochnessduck 2y agoThen there’s chip8 and a chip8 emulator on the gameboy :) https://github.com/lancekindle/damaged-chip8 https://github.com/lancekindle/damaged-chip8
- planetafro 2y ago
- GaggiX 2y agoFun fact the emulator works fine on Ladybird too, even thought it's very slow now.
- noeatnosleep 2y agoAvid millennial gamer here. Wasn't raised with games. Can someone recommend a good classic game to try?
- nosrepa 2y agoIt's always good to see usernames I recognize from the other site.
- johnisgood 2y agoI know right. :D
- aussieguy1234 2y agoThe game boy Tetris was the first version I played, it was pretty good. Nowdays for a mobile Tetris option i'm using a SNES emulator on my phone (Snes9x EX) and Super Tetris. Meanwhile, there are companies creating on the web and mobile app versions of Tetris, inserting ads and charging money for what should be free.
- gwbas1c 2y agoSuper Mario Land, 1 and 2. Dr. Mario. Game Boy games tended to be limited due to space constraints.
- xtracto 2y agoI has SML 1 and OperationC in the original game boy. Such great games. Also links awakening!!
- lxgr 2y agoThere are definitely limitations, but later games have a lot more depth than these. Link's Awakening feels like it shouldn't be possible in a single megabyte of mask ROM, for example. The fact that it was makes it almost more impressive by today's standards.
- 2y ago
- Thaxll 2y agoThere are millions of emulator for the GB it's like a week-end project, what's different here?
- throwee2000 2y agoAs someone who appreciates emulator development projects, I'd like to offer some perspective: Several aspects make every new GB emulator implementation valuable to the community. Some technical challenges in emulation are approached differently by each developer. Handling edge cases and accuracy testing requires significant effort beyond basic functionality. Often the learning process and personal growth are the primary goals, not just the end product. Languages like Rust bring modern benefits like memory safety and performance to classic emulation. Emulator development teaches low-level hardware concepts in an engaging, practical way.
- hananova 2y agoA GB emulator is definitely not a weekend project if your goal is any kind of accuracy. And even if it was, that doesn't devalue the project or effort that went into it.
- alexpadula 2y agoFlippin awesome. Can't wait to dive in :D
- rollcat 2y agoI feel like the GB/GBC/GBA are pretty much what the VT102 is to writing grid-cell software. The demo scene keeps cranking. Chiptune is still in love with the hardware - especially with the OG DMG, with a pro sound mod. Writing new software for the GBA feels a lot like targeting a tiny, modern ARM microcontroller. The hardware is well documented and understood by the enthusiasts, and it's a stable target. Plus there are plenty of emulators focusing on different aspects: one is focusing on perfect emulation; another will try to squeeze out performance; another might offer memory inspection and "cheat codes"; this one makes it available on the web. There's beauty in all of that.
- sydon 2y agoThis is very cool. Whenever I see a project like this I wonder "how did they even get started".
- SaintRomuald 2y agoA gameboy emulator is a very popular project. There are plenty of guides on how to get started. Checkout "build your own x" repo for some project ideas
- maybeOneDay 2y agoTangentially related - I recently picked up a retro gaming handheld from Aliexpress for the meagre sum of £50, which is capable of playing consoles from gameboy to snes to playstation 1, and apparently even a smattering of N64 and dreamcast (with poor performance). There are a dizzying array of options (game boy form factor, horizontal, clamshell design ala the advance SP), and although I'm sure the build quality leaves a lot to be desired, for my personal circumstances of "I'm travelling a lot but can't quite justify a steam deck right now" it has truly been an utter delight. There's a scene of various custom firmwares to install, and apps for these firmwares to add various functionality. I'd encourage anyone who feels a desire to play some emulated games check out /r/SBCGaming to see what's out there! Just don't ignore the warnings that these devices don't negotiate USB C charging correctly, and also buy yourself a very small weak charger...
- fernandotakai 2y agoif people want more info on these devices, russ from retro game corps does a ton of reviews on them, from the cheapest (that are less than 30 euro) to the really expensive ones (600+!). i myself own a retroid pocket 5, one trimui brick (which my wife adores) and a steam deck (yes, it's an amazing retro gaming machine). (retro catalog also has a ton of technical information, including ratings) https://www.youtube.com/@RetroGameCorps https://www.youtube.com/@RetroGameCorps https://retrogamecorps.com/ https://retrogamecorps.com/ https://retrocatalog.com/ https://retrocatalog.com/
- drakythe 2y ago+1 for Retro Game Corps, not only are his videos well made and informative he puts together guides for everything from basic retroarch configuration to how to install alternative OSes for specific devices (and why you might want to do that).
- tracker1 2y agoThanks for the share... been using a Beelink SER8 for about 6 months or so with Chimera, which has been mostly okay... I have to reset audio out to hdmi each boot and a couple other niggles with the Bluetooth controllers. May need to switch to ones that use custom/proprietary USB dongles with lower latency.
- ajsnigrutin 2y agoWhy does almost every project written in rust have "written in rust" advertised in the title/description?
- jamienicol 2y agoBecause people are interested in how technology is built, and if they’re interested in rust they might be interested in seeing how it’s used in other projects
- tonyhart7 2y agobecause rust is screaming bleeding edge
- mytailorisrich 2y agoNote his personal blog for some more info on the development: https://samthecoder.com/ https://samthecoder.com/
- joaomoreno 2y agoWhat a clean repo, great job!
- shaoner 2y agoIt's been a while since I touched it but I have a very similar GB emulator in rust: - The library: https://github.com/shaoner/padme-core https://github.com/shaoner/padme-core - The web/wasm backend: https://github.com/shaoner/padme-browser https://github.com/shaoner/padme-browser
- patrickcorrigan 2y agoReally love seeing more Game Boy emulators written in Rust, especially with browser support — awesome project! If you're into this space, I’ve been building https://afterplay.io https://afterplay.io — a browser-based retro gaming platform with support for a bunch of systems (GB,GBC, GBA, SNES, NDS, PS1, etc). It runs entirely in the browser with save states, cloud sync, and native mobile support via Capacitor. Also has some fun stuff like netplay (multiplayer over the web), Link Cable Support and RTC manipulation, and customisable touch controls. Always exciting to see more emulators pushing what’s possible on the web.
- smparsons 2y agoHi guys, original creator of the emulator here. I am shocked by how much attention my little hobby project is getting. Thanks for the support.
- yoyohello13 2y agoThanks for posting this! Your repo is very nicely organized. I've been wanting to get in to making an emulator (chip8). I decided early I wanted it to run on wasm, but have been stuck in the weeds of what framework/tools to use to actually get it done. I've looked into game engines and egui, but they just add so much extra complexity. I think seeing your repo I'm just going to try the straight wasm-bindgen + canvas route. So thanks again for making this.
- smparsons 2y agoActually I didn't post this on HackerNews. Somebody else did. But I'm glad to hear you got inspiration from my emulator. Yeah I found wasm-bindgen pretty easy to use.
- d3k 2y agoNice! it reminds me of a very similar project a friend of mine did like 10 years ago https://github.com/simias/gb-rs https://github.com/simias/gb-rs
- yakkomajuri 2y agoGot right to playing Donkey Kong Country! Thanks for this, really cool.
- ferristhecrab 2y agoThis is awesome
- wjholden 2y agoThis is the first time that I've noticed a website where I can add the page as an Android app. What is this called and how can I get started making my own web applications into installable apps?
- brandonhorst 2y agohttps://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/Making_PWAs_installable https://developer.mozilla.org/en-US/docs/Web/Progressive_web...
- myscreant 2y agoI do this all the time. It's a PWA (progressive web app). To make your own, you need to add a manifest.json at the root. Additionally, on Android, there are apps like Hermit / NativeAlpha that will create a wrapper around any site.
- ericzawo 2y agoI remember being 7 years old figuring out how to unzip the no$gbemulator to play Kirby and Final Fantasy Adventure on my dad's Windows 95 laptop. Good times.
- pests 2y agoSame, first emulator I ever used, maybe a little after you (Windows 98) The ability to speed up time made leveling up pokemon so much easier back in the day. Walking back and forth in the grass. Also my first introduction to save states outside the game itself / quick loading.
- araes 2y agoList of links and support documents for those interested in Gameboy Development (and example Homebrew ROMs) Gameboy Dev: https://gbdev.io/ https://gbdev.io/ PanDocs (tech reference): https://gbdev.io/pandocs/ https://gbdev.io/pandocs/ Gameboy Tech Ref Doc (gekkio): https://gekkio.fi/files/gb-docs/gbctr.pdf https://gekkio.fi/files/gb-docs/gbctr.pdf Game Boy Development Kit 2020 (GBDK-2020) Reboot: https://gbdk-2020.github.io/gbdk-2020/docs/api/ https://gbdk-2020.github.io/gbdk-2020/docs/api/ GBDK-2020 Github: https://github.com/gbdk-2020/gbdk-2020 https://github.com/gbdk-2020/gbdk-2020 GBDK-2020 Examples: https://github.com/gbdk-2020/gbdk-2020/tree/develop/gbdk-lib/examples/gb https://github.com/gbdk-2020/gbdk-2020/tree/develop/gbdk-lib... GBDK Showcase (Homebrew Software): https://gbdk-2020.github.io/gbdk-2020-gallery/ https://gbdk-2020.github.io/gbdk-2020-gallery/ Homebrew Hub: https://hh.gbdev.io/ https://hh.gbdev.io/ Neil Young Album (Silver & Gold) with Cover Image produced using the Gameboy Camera: https://en.wikipedia.org/wiki/Silver_%26_Gold_(Neil_Young_album) https://en.wikipedia.org/wiki/Silver_%26_Gold_(Neil_Young_al...