Comment by johncolanduoni

Comment by johncolanduoni 8 hours ago

9 replies

He may have been serving a game in a canvas hosted in a Next.js app, but have done all the actual game (rendering, simulation, etc.) in something else. That’s a decent approach - Next can handle the header of the webpage and the marketing blog or whatever just fine.

komali2 8 hours ago

But like... so can an index.html with a script tag? Am I missing something, where did you read that there was a lot of work involving the header or an attached marketing blog?

  • johncolanduoni 7 hours ago

    My point isn’t that you absolutely need that, just that the negative effect on your game development are pretty minimal if you’re not leaning on the SPA framework for anything related to the game. If your game is going to be embedded into an otherwise normal-ish website, this isn’t a terrible way to go (I’ve done it personally with a game mostly written in Rust and compiled to WASM). You can get gains by splitting your game and web site bundles and loading the former from the latter explicitly, but they’re not massive if your bundler was already reasonably incremental (or was already esbuild).

    Thanks for assuming I “read” about bundlers somewhere, though. I’ve been using (and configuring) them since they existed.

    • komali2 5 hours ago

      I meant specifically was there something I was missing about the Bun developer's game that required a complicated header and thus next.js.

  • shortrounddev2 8 hours ago

    index.html with script files would still benefit from a bundler. You can have a very minimal react footprint and still want to use react build tools just for bundling.

    • komali2 8 hours ago

      Sure, but I'm more confused about the next.js usage than I am about the bundler. The bundler makes sense.

      • johncolanduoni 7 hours ago

        What effect do you imagine Next.js has on a bunch of code manipulating an HTML canvas? For vanilla code directly using browser APIs it’s basically just a bundler configuration, and while it’s not optimally configured for that use case (and annoying for other reasons) it’s probably better than what someone who has never configured webpack before would get doing it themselves.