338 points by ingve 2 months ago | 107 comments
zeta0134 2 months ago
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-...
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.
diggan 2 months ago
Almost anything WASM+Audio seems to do that in browsers today, unless you're really really careful about what you're doing and leverage multiple threads. I think the issue is mostly around single-thread contexts, where it has to switch between playing audio and other things.
I hit the very same issue myself with Bevy not too long time ago, and tracking this issue which has some further links if you wanna go down a rabbit-hole: https://github.com/bevyengine/bevy/issues/4078
samiv 2 months ago
What I've found is that essentially WebAudio has such a terrible performance that the audio buffers need to be at minimum 100ms. And if you have a bad frame or any jank in your RAF is likely to glitch at least occasionally.
Compare this to when running natively 20ms audio buffers are fine.
I've settled on a design where I run all the audio graphs and audio decoding in a separate thread and then queue the audio buffers for the main JS thread to pick up and make the WebAudio calls. The same has to be done for the graphics (WebGL) as well. This can be major paradigm shift if the initial design has been done around doing stuff independently on the background. On the web.. no can do.
Bonus tip, if you're planning to use the OpenAL implementation that Emscripten provides my only advice is.. don't.
2c2c2c 2 months ago
zeta0134 2 months ago
gblargg 2 months ago
jvanderbot 2 months ago
zxvkhkxvdvbdxz 2 months ago
This means you can go both ways, either embed something like imgui in your wasm, or build a ui using html.
darknavi 2 months ago
maybeOneDay 2 months ago
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 2 months ago
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)
tracker1 2 months ago
jcjmcclean 2 months ago
I have a little bash script [1] which I run on startup to fix the HDMI audio issue. I haven't got crontab working yet so I ssh in and run it manually.
I've tried 3 different controllers and ended up buying the 8bitDo ultimate as it supports 2.4g as well as Bluetooth. Also purchased a separate Bluetooth dongle and a usb extension cable to keep it away from any interference from the Beelink. Still have major issues with connectivity over a reasonably short distance (3-4m) in either mode.
Love the SER8 though, it's a great little machine and is well priced when on offer.
[1] https://gist.github.com/jcjmcclean/a59362a01a7f421e4fa020823...
tracker1 2 months ago
drakythe 2 months ago
criddell 2 months ago
I never had one of these devices while they were current which makes me wonder if the key ingredient to enjoying one is nostalgia?
I also have a Sony PSP (bought around 2010) which is a great bit of hardware, but I have yet to find a game that appeals to me.
tracker1 2 months ago
Keyframe 2 months ago
maybeOneDay 2 months ago
smparsons 2 months ago
yoyohello13 2 months ago
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 2 months ago
rollcat 2 months ago
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.
araes 2 months ago
Gameboy Dev: https://gbdev.io/
PanDocs (tech reference): https://gbdev.io/pandocs/
Gameboy Tech Ref Doc (gekkio): 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/
GBDK-2020 Github: https://github.com/gbdk-2020/gbdk-2020
GBDK-2020 Examples: https://github.com/gbdk-2020/gbdk-2020/tree/develop/gbdk-lib...
GBDK Showcase (Homebrew Software): https://gbdk-2020.github.io/gbdk-2020-gallery/
Homebrew Hub: 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_al...
GaggiX 2 months ago
noeatnosleep 2 months ago
s369610 2 months ago
bityard 2 months ago
frosting1337 2 months ago
matcha-video 2 months ago
aussieguy1234 2 months ago
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.
coldpie 2 months ago
Link's Awakening is my favorite Zelda game.
The original Pokemon games (Red/Blue, Gold/Silver) that others are recommending are pretty rough these days, but it's fun to see where it all started if you have the patience for them.
If you want something a little less well-known, Bubble Ghost is a fun little puzzler.
Regardless of what you try, remember that this is the era when game manuals were required reading since they rarely were able to fit tutorials & instructions in-game. It's good to scan through the manual first before you play something or you might be missing some critical information.
gwbas1c 2 months ago
Game Boy games tended to be limited due to space constraints.
lxgr 2 months ago
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.
djtango 2 months ago
I feel like I don't really encounter stories of heroics in making games work on their hardware anymore. Even at the end of PS1 with Final Fantasy their hand drawn backgrounds were too big to fit into VRAM iirc
Or in the PS2 era Jak and Daxter using the principle of hot reloading from lisp to figure out open worlds without loading screens
Narishma 2 months ago
wing-_-nuts 2 months ago
lxgr 2 months ago
djtango 2 months ago
RetroSpark 2 months ago
Half a megabyte, even! (For the original monochrome game - the later color version is a full megabyte.)
lxgr 2 months ago
xtracto 2 months ago
999900000999 2 months ago
Pokemon is actually a really difficult game before modern QOL. No DLC!
Xenoamorphous 2 months ago
kibwen 2 months ago
nosrepa 2 months ago
johnisgood 2 months ago
MyOutfitIsVague 2 months ago
Wario Land 3 is a really really good Game Boy Color game.
kibwen 2 months ago
dpedu 2 months ago
andrepd 2 months ago
jaredhallen 2 months ago
philips 2 months ago
patrickcorrigan 2 months ago
If you're into this space, I’ve been building 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.
ericzawo 2 months ago
pests 2 months ago
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.
shaoner 2 months ago
- The library: https://github.com/shaoner/padme-core
- The web/wasm backend: https://github.com/shaoner/padme-browser
catapart 2 months ago
But in Chrome, this plays really well! Great work!
shakna 2 months ago
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?highlightAl...
adrian17 2 months ago
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 2 months ago
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 2 months ago
(and for the record, I'm on W10 too.)
Also, my personal experience from optimizing 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.
tonyhart7 2 months ago
ShinTakuya 2 months ago
tonyhart7 2 months ago
chromium edge literally surpass firefox and with new policy it would eat more to the marketshare
ShinTakuya 2 months ago
tonyhart7 2 months ago
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 2 months ago
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 2 months ago
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 2 months ago
tonyhart7 2 months ago
it would work with other people but not for me
edit: I'm not joking, I said laughing because firefox state is pathetic that deserved to be laughed at
d3k 2 months ago
wjholden 2 months ago
myscreant 2 months ago
Additionally, on Android, there are apps like Hermit / NativeAlpha that will create a wrapper around any site.
brandonhorst 2 months ago
mytailorisrich 2 months ago
turnsout 2 months ago
cglong 2 months ago
mbrubeck 2 months ago
chrismaltby 2 months ago
ajsnigrutin 2 months ago
jamienicol 2 months ago
dvhh 2 months ago
llarsson 2 months ago
tonyhart7 2 months ago
sydon 2 months ago
SaintRomuald 2 months ago
yakkomajuri 2 months ago
GaggiX 2 months ago
dpedu 2 months ago
hananova 2 months ago
lxgr 2 months ago
dylan604 2 months ago
small_scombrus 2 months ago
Though I imagine the rise of systems like the Pico8 and tic80 are siphoning people away because they can be run anywhere.
lochnessduck 2 months ago
lxgr 2 months ago
girvo 2 months ago
planetafro 2 months ago
dylan604 2 months ago
philips 2 months ago
alexpadula 2 months ago
joaomoreno 2 months ago
codecarter 2 months ago
ferristhecrab 2 months ago
Thaxll 2 months ago
hananova 2 months ago
throwee2000 2 months ago
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.