Skip to content

WIP: build: optional Emscripten browser port (AI-generated) - #300

Closed
jr551 wants to merge 2 commits into
SNMetamorph:masterfrom
jr551:cursor/primext-wasm-pr-f2c6
Closed

jr551 wants to merge 2 commits into
SNMetamorph:masterfrom
jr551:cursor/primext-wasm-pr-f2c6

Conversation

@jr551

@jr551 jr551 commented Oct 27, 2026

Copy link
Copy Markdown

This pull request was generated with AI (Cursor). It is a draft so it is easy to close or trim.

An optional browser build of the PrimeXT client and server. The Windows, Linux, and Android presets are left as they are.

Two commits:

  1. engine: match current FWGS client ABI without changing desktop input — header sync and Emscripten-only branches.
  2. web: add an optional AI-generated browser shell — loader, scripts, and a workflow that runs only when started by hand.

The first commit is the game code. The second is the page. Either can be dropped.

What this leaves alone:

  • The README is still theirs, plus one short section that points at web/README.md.
  • Nightly, CodeQL, and documentation workflows are untouched. The new wasm workflow is manual only.
  • The new cldll_func_t slots match current Xash3D FWGS. Look and move handlers are installed only for Emscripten. Desktop still passes null and keeps the engine's mouse and keyboard path.
  • GetEntityAPI and GetEntityAPI2 keep their existing linkage except under Emscripten.
  • No retail Half-Life assets. The Uplink zip is downloaded at build time and gitignored.
  • webXash (MIT) is credited in THIRD_PARTY.md. The loader follows it. Its source is not copied.

The menu comes up on the free Uplink demo (-game valve) and receives mouse and Escape. Starting a map still hits Aborted(OOM): xash3d-fwgs@1.2.2 will not grow the wasm heap past 256 MB. PhysX is off. ImGui is stubbed. In-game movement was not tested.

If a browser port is out of scope, closing this is a fine outcome.

cursoragent and others added 2 commits October 27, 2026 17:27
Sync cldll_func_t with current Xash3D FWGS. The new look and move
slots are filled only for Emscripten, and stay null on Windows, Linux,
and Android so the engine keeps its own mouse and keyboard path.

The same commit lets an optional Emscripten side module compile:
POSIX macros, a Clang-safe bit-field swap, filesystem_stdio.wasm,
ImGui stubs, and a WebGL early-out in R_VidInit. Native presets do
not take those branches. GetEntityAPI keeps its existing linkage
except under Emscripten, where the side module needs an unmangled
export.

This change was generated with AI (Cursor).

Co-authored-by: johnrowe551 <johnrowe551@gmail.com>
Documents and builds the Emscripten modules from the previous commit.
The GitHub workflow runs only when started by hand, so it does not
gate other pull requests. Retail Half-Life assets are not included.
The Uplink demo zip is downloaded at build time.

This change was generated with AI (Cursor).

Co-authored-by: johnrowe551 <johnrowe551@gmail.com>
@jr551 jr551 changed the title build: optional Emscripten browser port (AI-generated) WIP: build: optional Emscripten browser port (AI-generated) Oct 27, 2026
@jr551
jr551 marked this pull request as ready for review October 27, 2026 18:26
@a1batross

Copy link
Copy Markdown
Contributor

The engine doesn't support Web though.

@jr551

jr551 commented Oct 28, 2026

Copy link
Copy Markdown
Author

Thanks, that's fair. I checked: ports.md lists Emscripten as old-engine only, and the recent web PRs (#2131, #2198, #2242) weren't merged. This PR doesn't change the engine. It runs against a third-party prebuilt web build (the xash3d-fwgs npm package from yohimik's port), which is also where the OOM comes from, so it isn't something PrimeXT can properly support. I'll close it and keep the browser build in my fork.

If it's useful, I can open a small separate PR that only syncs cldll_func_t in engine/cdll_exp.h with current FWGS (no behaviour change).

@jr551 jr551 closed this Oct 28, 2026
@a1batross

Copy link
Copy Markdown
Contributor

Syncing headers is always a good thing to work on. :)

Though engine ones are purposefully incompatible as a drop in into HLSDK based trees, as we're trying to go away from HLSDK licensed headers.

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.

3 participants