[HN Gopher] Show HN: Porting Terraria and Celeste to WebAssembly
___________________________________________________________________
Show HN: Porting Terraria and Celeste to WebAssembly
Author : coolelectronics
Score : 318 points
Date : 2025-05-26 20:06 UTC (3 days ago)
(HTM) web link (velzie.rip)
(TXT) w3m dump (velzie.rip)
| rlmineing_dead wrote:
| Cool to see FNA/XNA projects projects working in the browser
| dwattttt wrote:
| It's really impressive how much worked out of the box,
| decompiling a C# binary, then recompiling it for a target as
| different as WASM.
| underdeserver wrote:
| And then it's also really impressive how much they did to get
| to the end.
| jasonjmcghee wrote:
| Getting firebase "bandwidth quota exceeded" error when trying the
| demo.
|
| You shouldn't have to worry about this kind of stuff if it's just
| a static site.
|
| I'd host this on a cdn like cloudflare or github pages (free!).
| coolelectronics wrote:
| My bad! Switched over to the github pages fallback. Cloudflare
| pages isn't suitable because the wasm files (100mb+) exceed the
| 25mb limit. (i could bypass this with service worker jank but
| that tends to be fragile). Github Pages also isn't suitable
| because it doesn't have a native way of sending the coi/coep
| headers that are required for SharedArrayBuffer to be
| available. Can also bypass that with service worker jank but I
| would prefer not to
| hoten wrote:
| btw: this results in a white page on the first load until you
| manually reload, since the SW has not been loaded yet. May
| want to force a page reload on the SW install event to fix.
|
| also: this is incredibly cool. thanks for writing this up and
| sharing!
| truemotive wrote:
| Cloudflare R3 might suit the scenario better for you in terms
| of the heavy assets, it's like AWS S3 except for the cool
| part where you aren't charged for data egress (last I
| checked! haha)
|
| I'm about to buy Terraria after all these years, just so I
| can get the assets and check this out. You're cool :)
| vlovich123 wrote:
| R2
| NortySpock wrote:
| Oh Terraria is totally worth it, especially when spelunking
| with friends.
|
| Its better than Minecraft, in my opinion.
| tech234a wrote:
| Depending on how well the files compress, you could try:
| https://developer.mozilla.org/en-
| US/docs/Web/API/Compression...
| bakkoting wrote:
| The service worker jank, while conceptually hacky, is
| actually remarkably un-janky and not really noticeable to
| users! It's very much fire-and-forget unless you also wanted
| to have another service worker (in which case it's time for
| suffering; service workers aren't even a little bit
| composable).
|
| For anyone wondering: https://github.com/gzuidhof/coi-
| serviceworker or https://github.com/WebReflection/mini-coi
| 01HNNWZ0MV43FF wrote:
| This is very cool. However, the blog itself is not hitting 60 FPS
| on my Firefox. Probably that background effect?
| dgb23 wrote:
| I found that effect disturbing and distracting. It's rendered
| in a canvas element that you can delete via the inspector.
| caminanteblanco wrote:
| This is absolutely amazing! I intend to use this on my Chromebook
| ASAP
| 71bw wrote:
| Your (?) website is so resource-demanding it's insane. I'm
| struggling to run it at any decent framerate on an i5-7500T.
| Makes the entire browser just crumble
| poink wrote:
| I scrolled through the whole thing on my phone and it was fine
| 01HNNWZ0MV43FF wrote:
| Weird huh
| doix wrote:
| You can disable javascript on the site and it works perfectly.
| I'm guessing it's this thing that destroys performance
| https://velzie.rip/static/background.js
| kunwon1 wrote:
| The moving background is absolutely intolerable, I didn't last
| ten seconds
| midzer wrote:
| Celeste Classic in WASM https://midzer.de/wasm/celeste/
| badmintonbaseba wrote:
| For some reason that runs at like double speed for me, very
| challenging.
| flohofwoe wrote:
| Sounds like the game uses a fixed 60hz frame step but maybe
| you're on a 120hz display? Chrome and FF run
| requestAnimationFrame at 120hz in this case (while Safari
| sticks to 60hz)
| badmintonbaseba wrote:
| Possibly, I'm indeed on a 120Hz display. I still got up to
| 1600m, it's a good challenge.
|
| edit: 2000m now that I revisited. Crazy hard.
| badmintonbaseba wrote:
| Made it to the summit at double speed.
| :strawberry:x14 3:17:46 deaths:1981
| nottorp wrote:
| Don't link your world status updates to the frame rate
| please.
|
| Even "AI"s know to show you how to do it in spite of
| requestAnimationFrame. I know, I asked.
|
| But you have to ask them specifically to decouple game
| world updates from drawing, or they'll give you the dumb
| solution.
| delusional wrote:
| > One of my favorite genres of weird project is "thing running in
| the browser that should absolutely not be running in the
| browser". Some of my favorites are the [...] the direct
| recompilation of Minecraft 1.12
|
| Heh, you'd think Minecraft would be exactly the sort of thing
| that absolutely should be running in the browser, considering it
| was originally a Java applet.
|
| I understand the point, I just find it amusing.
| pjmlp wrote:
| Even more interesting is this idea of running WebAssembly on
| the server, in containers, with orchestration services among
| them, and communicating across sandboxed environments.
|
| Somehow it reminds me of something, but memory is getting
| fuzzier nowadays. /s
| baq wrote:
| You're obviously talking about the 1972 VM/370 right?
| pjmlp wrote:
| Naturally.
| pjc50 wrote:
| WebSphere!
| voidUpdate wrote:
| Early minecraft versions did run in the browser before it was
| made a standalone app, and they recreated it recently
| https://classic.minecraft.net
| HelloUsername wrote:
| > recently
|
| 6 years ago? https://news.ycombinator.com/item?id=19861584
| James_K wrote:
| I've recently started trying to do a bit of basic game
| development targeting the web through WASM+OpenGL+SDL, and I must
| say, I'm shocked with how easy it is. I spent more time fiddling
| with CMake files than I did trying to the code to run on the web.
| There are still some limitations and rough spots on the web
| platform, but I've honestly had a much harder time compiling
| things for Windows or MacOS than for WASM.
| Fraterkes wrote:
| Dumb question: do you have access to any of the nice text
| rendering features of the browser when you use Wasm, or is it
| basically just drawing to a canvas
| James_K wrote:
| There is an Emscripten library which cross-compiles things to
| WASM. The means you can generally just pull in a dependency
| for font rendering, such as SDL_ttf.
| parallax_error wrote:
| Safari on ios really hates this, all 3 demos crash upon loading
| lol
| kkukshtel wrote:
| This post presupposes a bit of knowledge about C#/WASM and Native
| code linking in the C# ecosystem. I wrote a post a while back
| that could be a complement to this that does some more level
| setting about what's possible these days with compiling C#-based
| engines to the web for those that don't already have the context:
|
| So You Want To Compile Your C# Game Engine To The Web With WASM
|
| https://kylekukshtel.com/csharp-wasm-game-engine-compile-web...
| modeless wrote:
| Porting games to the web is a fun hobby! I've done Quake III [1]
| and Cave Story [2]. Just like in this story it's all about the
| details. Getting the game loading is just the start. Things like
| adding touch controls for mobile, handling multiplayer, managing
| save files, supporting modern screen resolutions and frame rates,
| they take more time than the initial port.
|
| [1] Single player: https://thelongestyard.link/q3a-demo/
| Multiplayer: https://thelongestyard.link/q3a-demo/?server=HN
|
| [2] https://thelongestyard.link/cave-story/
| Spunkie wrote:
| It seems cool but haven't been able to get it working. I'm
| downloading terraria assets with the from steam option but its at
| only 5% after an hour.
___________________________________________________________________
(page generated 2025-05-29 23:01 UTC)