Devlog 1: I actually ported Balatro to the web…
Total time logged: ~3h 15m (hackatime wasn’t working because I was on windows today instead of linux, but I put in around 2 hours that werent logged)
Not gonna lie, this was way harder than I thought it would be. But the base web port of Balatro is officially working!
It took over 3 hours of dealing with random compilation errors, broken shaders, and browser crashes, but it runs insanely smooth now. Here is everything that went down to get it working.
i hope i dont get sued or anything cuz i posted the straight files, i will probably add some thing where you can import your game files and then it makes a webport
also, there is no website to play yet, thats coming next.
The stuff that broke (and how I fixed it)
1. WebGL and Shaders acting up
Balatro uses a ton of shaders for card effects, dissolves, and holographic stuff. Browsers are super picky about WebGL compared to desktop:
- Fixed loop issues in
hologram.fsso the browser wouldn’t just crash when rendering cards. - Fixed texture scaling issues so cards wouldn’t render as solid black rectangles.
2. Making saves actually save
In the browser, local file saves wipe as soon as you close the tab. That obviously sucked for a rogue-like game, so I fixed it:
- Forced love.js to use a fixed save folder name (
Balatro). - Made it automatically sync saves to the browser’s IndexedDB every 15 seconds and whenever you switch tabs. So now your run saves even if you refresh or close the tab.
3. Mobile touch controls
Playing on a phone was annoying at first because touching the screen made the browser zoom in or scroll the page.
- Blocked double-tap zooming, page scrolling, and pull-to-refresh gestures.
- Touches now map accurately directly to the cards and buttons.
4. The booster pack freeze bug
This was easily the worst bug. Opening a booster pack would completely freeze the entire tab with zero error messages in the console.
Turns out the game was getting stuck in an infinite loop while trying to generate cards for the pack view. Refactored the pack generation logic to yield frames properly, and now packs open instantly.
5. Build script and github setup
- Wrote a custom Python script (
tools/build.py) so I can audit, patch, and build the whole web version with one terminal command. - Set up Git LFS so heavy game files don’t bloat the git history.
- Added a GitHub Actions workflow to auto-deploy to GitHub Pages whenever I push code.
Current Status
- Base Web Port: Fully working
- Shader Fixes: Done
- Save Files: Working and persistent
- Mobile Support: Good to go
- Auto Deployment: Set up
What’s Next
Now that the actual game runs, the next goal is making mods work.
- Injecting Steamodded into the web build so it can load custom Lua mods.
- Adding an “Import Mod” button on the webpage so you can drag and drop mod files right into the game.
- posting on website, will get a domain.
- OPTIMIZATIONS! very important
(my devlogs look better too)