Webzen is a Go Game Engine that targets WebAssembly, enabling you to build web applications with Go. It helps you build your games easy and fast. This project leverages syscall/js
to interact with the JavaScript runtime in the browser.
Please note that Webzen is currently under high maintenance and is not production-ready. The project is actively being developed and improved, which is why there is only a
dev
branch available. Its currently in Beta status
Webzen doesnt need anything except Go version that is higher that 1.18. There is no C compiler or anything needed, but we recommend wasmserve to quickly run your code.
Webzen is an ordinary go package, so you can get it using this command:
go get github.com/dimkauzh/webzen@latest
The package is also available on pkg.go.dev.
To run the example provided in this repository, follow these steps:
- Clone this repository to your local machine:
git clone github.com/dimkauzh/webzen.git
- Navigate to the project folder:
cd webzen
- Install needed dependencies:
First, make sure you have Go installed, secondly, run make install to install everything needed:
make setup
- Build and run the example using make and wasmserve. This will start a local development server at localhost:8080:
make example
Open your web browser and go to http://localhost:8080 to see the example in action.
To build a production-ready WebAssembly application with Webzen, follow these steps:
Compile your Go code to WebAssembly using the GOOS=js and GOARCH=wasm flags. Replace build_path/file_name.wasm and file_path/file_name.go with your desired output file path and source file, respectively:
GOOS=js GOARCH=wasm go build -o build_path/file_name.wasm file_path/file_name.go
You can then include the generated .wasm file in your web application and load it using JavaScript.
Feel free to explore the example provided in this repository to better understand how Webzen works and how you can create your own Go-powered web applications.
The documentation for Webzen is available at https://github.com/dimkauzh/webzen/wiki
This project is licensed under the GPLv3 License - see the LICENSE file for details.