A Metamod plugin for integrating Node.js directly into Half-Life 1 engine. This plugin is intended as a more functional and convenient replacement for AMX Mod X or LuaMod. It is also compatible with Xash3D FWGS.
Note: The original Nodemod concept was created by TheEVolk. This version represents a complete modernization and enhancement of the project:
- Updated from legacy Node.js to Node.js v24.6.0
- Added all remaining engine and DLL functions
- Created GitHub organization and website
- Published npm packages and examples
- Provided compiled library distribution
More comprehensive documentation is available at https://nodemod.org/
|-- /
|-- deps # 3rdparty dependencies (Node.js v24.6.0)
|-- scripts # auxiliary scripts (generating the autocode)
|-- src # nodemod source files
| |-- auto # auto-generated code
| | |-- dll_events.cpp # events from gamedll
| | |-- dll_functions.cpp # bindings to gamedll methods
| | |-- engine_events.cpp # events from engine
| | |-- engine_functions.cpp # bindings to engine methods
| |-- lib # nodemod library external api to metamod
| |-- node # v8 and nodejs internal code and api
| |-- structures # structures between engine and jscode
| |-- bindings # util methods and core functional, passed to JS
Note: Nodemod is currently locked to x86 architecture for compatibility with Half-Life servers.
./build-docker.sh # Build Docker image
./build-node.sh # Build Node.js from source
./build-nodemod.sh # Final the nodemod pluginPre-installing dependencies:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install gcc-multilib g++-multilib cmake ninja-build python3 python3-distutilsBuilding instructions:
git clone --recursive https://github.com/stevenlafl/xash3d-nodemod.git
cd xash3d-nodemod
# build node
./scripts/build-node-from-source.sh
# convert thin to fat archives
./scripts/fat_archive.sh deps/node/out/Release/obj.target
# build nodemod
cmake -E make_directory build
cd build
cmake .. --preset linux-x86-debug
cmake --build . --config DebugThe /auto folder is auto-generated by
node scripts/buildEvents.js- You should make sure that Metamod is already installed on your server
- Create a
nodemoddirectory inaddons - Download examples from https://github.com/nodemod/examples-goldsrc or create your own plugin using @nodemod/core
- Extract the example to
addons/nodemod/plugins - Create the
addons/nodemod/dllsdirectory - Move the compiled libnodemod.so to the
addons/nodemod/dllsdirectory - In plugins.ini from metamod, add the line
linux addons/nodemod/dlls/libnodemod.so - In the plugins directory, install npm dependencies:
npm i - Build TypeScript code:
npm run build
Note: Currently, nodemod runs only one plugin - the script defined in the "main" field of addons/nodemod/plugins/package.json. Multi-plugin functionality is not yet implemented.
Complete typedefs and a helper library are available at @nodemod/core. The example repository contains an example on using typescript with a build process. Sourcecode for @nodemod/core is available at https://github.com/nodemod/core-goldsrc
You can run your TypeScript code without precompilation using the ts-node library.
- Install ts-node:
npm i ts-node - Pass there env variable to your start script:
export NODE_OPTIONS="--loader ts-node/esm" - Make sure that the main field is in your package.json leads to a TS file
- Rigor testing
- Multi-plugin system
- TheEVolk (Maksim Nikiforov) - Original Nodemod creator
- iAmir (Amyr Aahmady) - For his samp-node project inspiration
- SNMetamorph - Code modernization to C++17 and build system refactoring
- stevenlafl (Steven Linn) - Complete modernization: Node.js v24.6.0 upgrade, added all engine/DLL functions, GitHub organization, npm packages, compiled distributions