Skip to content

Conversation

@alpha0010
Copy link
Contributor

Opening this for discussion. It is functional, but makes some fundamental changes that need to be considered before merging.

Demo: https://alpha0010.github.io/terramap/

I attempted to port the file reader and map renderer to C++ Wasm (used some code from my Terra AWG project).

To compile, execute emmake make -j8 (requires emscripten installed) in the wasm/src folder. (There is also a cli test utility you can build via make -j8 cli.)

Pros:

  • About 4x faster than the batch render optimization that is already live
  • Able to read some older files the JS implementation fails on
  • Displays wires and paint on the map
  • Block highlight worst case (e.g. select all stone blocks) is massively faster (and does not freeze the UI while running)
  • More details in world info and tile properties menus
  • Fixes colors for some blocks that were just displaying as black

Cons:

  • Requires a compile step (GitHub pages deployment is still possible, but needs a custom workflow set up, not just regular branch deployment)
  • Requires understanding of C++
  • Much more complicated logic for passing messages between execution layers
  • Uncertain how this functions on other browsers/operating systems, since while Wasm is not a new technology, it is much newer than plain JS
  • Display render is no longer incremental (but this runs fast enough that maybe that is okay?)

I know the hardest part of an open source project is the long term maintenance, so feel no obligation to take this pull request. I mainly did it as a study case to experiment with Wasm technologies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant