The resonance cascade seen from the eyes of a young intern working near Sector C. A vanilla-ish Half-Life single-player campaign. It is short, half-assed, and has no ending, it served as a personal testbed for learning the TrenchBroom editor and experimenting with WASM. Don't expect much.

Report RSS Scripting in Half-Life with any language with WASM

An open-source WASM runtime running inside Half-Life.

Posted by on

header

Because GoldSrc scripting is generally janky and any combinatorial logic gets tedious rapidly, needing you to work around the idiosyncrasies of multisource and togglable entities, I decided to implement a scripting language in the GoldSrc engine.

I wanted a map-controllable sandboxed environment that did not require learning a new language, sullying yourself with 1-indexed arrays, or using a syntax too dissimilar to C.
I went with WASM so any language that compiles down to it will work (e.g. C, Rust, Go, COBOL even), and chose to embed wasm-micro-runtime in Half-Life.

While the Critical Dynamics mod is still in development, the sources for the WASM integration are already available. Do mind that it is a work in progress, the native interface can and will change depending on what the mod needs.
In its current state it can supplant many if not all multisource/multi_manager/trigger_relay spaghetti with code as clean as you can write.

Sources and demos are available in the Half-Life WASM repository.

Conway's Game of Life running inside a Half-Life level


Conway's Game of Life running inside the sandbox.
This is not implemented in the game's code but in a .wasm controlled by the BSP.


Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: