nakama-common
nakama-common copied to clipboard
Wasm
.lua, .so, and .js Are the current runtime authoring options.
Wazero runs wasm with no cgo and is V1 now. The no cgo is great be Ayse builds are easy.
it will allow devs to write their logic in any language that compiles to wasm . Rust, go. Typescript, python, c, c#, and many more.
@gedw99 I've been tracking what it could look like to support a WASM runtime and allow game teams to write their server code in whichever language supports WASM as a compiler target.
What's unclear at the moment is how to maintain the set of necessary interfaces/headers/typedefs for each of the languages that compile to WASM? How do others maintain these stubs?
This would be a game changer, hope to see this implemented in nakama soon.
What's unclear at the moment is how to maintain the set of necessary interfaces/headers/typedefs for each of the languages that compile to WASM? How do others maintain these stubs?
I would argue that maintaining the stubs can be easily given to the community. If somebody wants to use rust they search for rust bindings or make them themselves. The only thing thats needed is a clear documentation on the exported functions and types. Maybe this can even be automatized if the format is easily parseable, though not sure if its actually worth it or if handcrafting and maintaining the binding would be easier and quicker.
Of course an official rust binding would still be appreciated, as rust and wasm seem to be the most common combination.
Another random idea, could you just expose the functions of Nakama as an API? WASM would be amazing as it would enable any number of languages, but implementing an interface to allow Nakama to just call out to a container in the same cluster and/or on the same network. You could let them communicate and that way remove any limitations to people using your services.
You could recreate that quite easily by making some custom rpcs in lua or typescript and calling them, of course thats a lot of overhead you will likely want to avoid :)
WASM support is being tracked on the main Nakama repo, keep an eye there for updates. :+1: