Compile server code?

Hello,

I want to start a multiplayer project, but with the idea that users could host their own dedicated server, so basically they will need to mount their own nakama server with my server logic code, i was thinking to do the logic with Lua, but this means the user could change the logic since is not compiled, i was wondering if is there any way to compile the code and just distributed as binary , probably using Go instead?

any suggestions? or if is not possible at all

@hgouveia Welcome :wave:

Sure, the server already supports code written in Go as a server language. Have a look at this README on how to do it.

https://github.com/heroiclabs/nakama/tree/master/sample_go_module

Also have a look at this GitHub Gist which covers a Docker workflow that makes local development a little easier for game teams who are familiar with Docker:

https://gist.github.com/novabyte/cc6d57022e2d3baa40e98d8fc91dc4c8

The approach that is recommended for server development does not require the server itself to be rebuilt but instead you would write your custom game logic and compile it to a “plugin” (a shared object) which is loaded by the game server at startup.

Hope this helps.

1 Like

thanks, @novabyte this is really great and great samples!

1 Like

@hgouveia We also have a full project template for the layout of server logic with the game server which is still a work in progress so we’ve not open-sourced it but would be useful to your project I think. I’ve attached it to this thread as a download (renamed the file extension so the upload is allowed). Hope it helps.

nakama-project-template.zip.txt (30.6 KB)