←back to thread

You can make PS2 games in JavaScript

(jslegenddev.substack.com)
230 points tosh | 2 comments | | HN request time: 0.466s | source
Show context
Flux159 ◴[] No.46008839[source]
The interesting part here is about AthenaEnv. It looks like it uses QuickJS for the Javascript interpreter and wraps around the native system libraries that the PS2 provides.

I'm wondering if there's a modern similar project that would allow writing Javascript Canvas games (WebGPU / WebGL) and publishing on Switch/2, PS5, and Xbox.

From my understanding, they explicitly disallow JITs so you can't just wrap your JS game with Electron / Node Webkit and use V8. I'm not sure if anyone has tried publishing a game using a V8-jitless electron fork - the sdks for consoles are under NDA so there's not really much written about it publicly & most games using Unreal or Unity don't deal with these things themselves.

PC, Mac, and even mobile are surprisingly easier here because you can just run the JS via electron or in a webview on mobile.

replies(2): >>46009490 #>>46009775 #
1. JSLegendDev ◴[] No.46009775[source]
I think the game Cross Code (a game written in JS) was ported to consoles using a pretty complex process.

Here is a detailed blog post about the topic : https://www.radicalfishgames.com/?p=6892

replies(1): >>46009863 #
2. Flux159 ◴[] No.46009863[source]
Yeah, I saw the video about that earlier which is what led me to wonder if there was a native JS way now.

They used Kha in order to port only the console versions, the desktop versions remained JS from my understanding: https://github.com/Kode/Kha which is built on top of Haxe. This works, but it also means not having a single codebase anymore which would be one of the benefits of a JS based system.

There are other options here - something like using an AOT JS compiler like Porffor, but from my understanding it's never been tested (and would probably be missing a lot of support to get it working - like shimming canvas & providing a WebGPU context that the compiled JS could execute against).