Skip to content

Improve the ability for users to play fheroes2 on the web #9737

Open
@justinbburris

Description

@justinbburris

Genesis 👇

By the way, are you aware of modern web frontend technologies? The thing is, we have the Emscripten port of fheroes2. The README claims it's experimental, but it actually works pretty well in general... except that we don't have a convenient launcher for it (HTML/JS code for its launch page). All we have is a pretty basic launcher here. It works in general, but it is absolutely inconvenient for the end user. The general requirements for the launcher are described here. For the reference, the Emscripten port has the build job in our CI for pull requests:

make-emscripten:
strategy:
matrix:
include:
- name: Emscripten
on: [ 'pull_request' ]
env:
FHEROES2_STRICT_COMPILATION: ON
package_name: fheroes2_emscripten.zip
- name: Emscripten Multithreaded
on: [ 'pull_request' ]
env:
FHEROES2_STRICT_COMPILATION: ON
FHEROES2_WITH_THREADS: ON
package_name: fheroes2_emscripten_mt.zip
name: Make (${{ matrix.name }})
runs-on: ubuntu-latest
container: emscripten/emsdk:latest
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
if: ${{ contains( matrix.on, github.event_name ) }}
- name: Install dependencies
if: ${{ contains( matrix.on, github.event_name ) }}
run: |
sudo apt-get -y update
sudo apt-get -y install gettext p7zip-full
- name: Build
if: ${{ contains( matrix.on, github.event_name ) }}
run: |
emmake make -f Makefile.emscripten -j "$(nproc)"
env: ${{ matrix.env }}
- name: Create package
if: ${{ contains( matrix.on, github.event_name ) }}
run: |
# Translations and H2D files are already included in fheroes2.data
7z a -bb1 -tzip -- ${{ matrix.package_name }} LICENSE changelog.txt fheroes2.data fheroes2.js fheroes2.wasm ./docs/README.txt ./files/emscripten/*
- uses: actions/upload-artifact@v4
if: ${{ contains( matrix.on, github.event_name ) }}
with:
name: ${{ matrix.package_name }}
path: ${{ matrix.package_name }}
if-no-files-found: error

which produces PR artifacts. Ideally, it would be interesting to host the WebAssembly build as part of the fheroes2 website so that users can play directly in their browser using the user's local game assets.

Are you interested in looking into this (of course, not right now, but maybe in the future)?

Originally posted by @oleg-derevenetz in #9726

Metadata

Metadata

Assignees

Labels

WasmWebAssembly version of the engineimprovementNew feature, request or improvement

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions