mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.29k stars 1.76k forks source link

WebAssembly Port #3554

Open lalalune opened 1 year ago

lalalune commented 1 year ago

Heya, this is a pretty out-there question, but as a wasm port been considered? I'm sure file I/O may need to be considered, but other than, it seems like Qt can build to wasm. Web-based editor would be very handy, and could also see integration or embedding into games and such :)

bjorn commented 1 year ago

Yes, it's been considered and I've also compiled Tiled against Qt for WebAssembly and ran it in my browser. However, it will be very hard to turn it into a usable editor when running in that environment.

The main problem is the lack of direct file access. Qt provides functions to read/write single user-selected files, but Tiled generally wants to open a lot of other files, like the referenced tileset or image files. Or JS extensions, when opening a project. I'm not sure if in the meantime it would be possible to grant access to an entire folder, which would mostly resolve this issue.

Alternatively to Tiled in the browser accessing a local folder would of course be to enable accessing files on Dropbox or other services, though that will require a lot of custom integration code.

A more minor issue, but one that would take a lot of effort to improve, is that the UI isn't generally very suitable for running in a browser. On many occasions it wants to open popup windows and I'm not sure how well the dock widgets in its main window would be supported. Switching to a QtQuick based interface would be a possible solution to this problem, and would also make map rendering a lot faster by using the hardware, but it will be a major project.