Porting to wasm/js/webgl using Gopherjs #901
Replies: 7 comments
|
I have some updates on this. The GopherJS port went pretty well, and I have now switched to WASM instead because GopherJS does not really support Changes to Ikemen GO
Changes to Elecbyte Screenpack
Changes to gl-gsPull requests sent here: https://github.com/fyne-io/gl-js/pulls?q=is%3Apr+author%3Asamhocevar Changes to glfw-jsAll pull requests have been accepted by the fyne-io authors: https://github.com/fyne-io/glfw-js/pulls?q=is%3Apr+author%3Asamhocevar Changes to BrowserFS
Changes to Go
|
|
It is really pretty excited to see this port !!!! |
|
Here’s how it looks like so far: http://sam.hocevar.net/projects/ikemen/ |
|
Yes I found it !!! Pretty awesome :) |
|
Great work :) was thinking about this myself - we really need a web version of this engine. |
|
Is there a repo you're working on this in? I'd like to see what I can do |
|
@samhocevar is it something you are still working on ? |
Uh oh!
There was an error while loading. Please reload this page.
I would like to build a web version of an Ikemen GO game, and from my understanding of the codebase this will not be trivial and I’d like to discuss a few changes I am willing to contribute. Here is my proposed roadmap:
1. Modules that are not Gopherjs-compatible
2. Isolate incompatible code
Here is an example of how code could be isolated: this commit moves all the code from
font.gothat uses glfont and go-findfont into a separatefont_ttf.gofile. When built withgo build -tags nottf, this file is ignored and another file,font_nottf.go, is built instead. Right now the implementation is empty and just panics, but there could be a smarter implementation or at least more forgiving error handling.3. Propose acceptable replacements
OpenGL code is far too entangled in the codebase for a refactor like above. However, the following two libraries appear to work with GopherJS and may work as replacements, with minimal changes:
OpenAL can probably be replaced with Oto, which is already pulled as a dependency by the Beep module :
Note that @hajimehoshi is a game developer and has provided the Go community with great tools for porting Go games to Wasm (as well as other platforms thanks to some impressive work, see https://ebiten.org/blog/native_compiling_for_nintendo_switch.html)
4. Make the rest optional
It’ll probably be tricky to replace glfont in the short term, but I think it’s an acceptable loss. Also the dialog module has no replacement, but a Wasm program can directly call a JavaScript function such as
alert()so I don’t see a real problem here either.All reactions