Contains a Go implementation of Tic-Tac-Toe (aka "XOXO"), written for the Nakama game server. Includes pure Go implementations of a Tic-Tac-Toe Nakama module, end-to-end unit tests for the Nakama module, and a Ebitengine client that works with the Nakama module.
Showcases the end-to-end use of the
github.com/ascii8/nakama-go
and
github.com/ascii8/nktest
packages.
An overview of the primary directories in this repository:
- xoxo - Tic-Tac-Toe game logic and client in Go
- nkxoxo - a Tic-Tac-Toe Nakama module
- ebxoxo - a Ebitengine game client for Tic-Tac-Toe
- fynexoxo - a Fyne UI game client for Tic-Tac-Toe
- gioxoxo - a Gio UI game client for Tic-Tac-Toe
- cmd/nkxoxo - the Nakama server module entry point
- cmd/nkclient - the testing client
- cmd/ebclient - the Ebitengine client entry point
- cmd/fyneclient - the Fyne UI client entry point
- cmd/gioclient - the Gio UI client entry point
Checkout the code and run the tests using go test
from the repository root:
# get the code
$ git clone https://github.com/ascii8/xoxo-go.git && cd xoxo-go
# build/run the Nakama module with Nakama server, and run the unit tests
$ DEBUG=1 go test -v
Run the module using go test
from the repository root:
# change to the repository root
$ cd /path/to/xoxo-go
# build/run the Nakama module with Nakama server
$ DEBUG=1 KEEP=2h go test -v -timeout=2h -run TestKeep
Build and run the Ebitengine client, as a Desktop client:
# change to the repository root
$ cd /path/to/xoxo-go
# build/run the Ebitengine client
$ go build ./cmd/ebclient && ./ebclient
Build and run the Ebitengine client as a WASM module in a Web Browser:
# change to the repository root
$ cd /path/to/xoxo-go
# build wasm and run local webserver
$ go run github.com/hajimehoshi/wasmserve@latest ./cmd/ebclient
Then open http://127.0.0.1:8080 in a browser.
See: Ebitengine WASM documentation
Build and run the Fyne client, as a Desktop client:
# change to the repository root
$ cd /path/to/xoxo-go
# build/run the Fyne client
$ go build ./cmd/fyneclient && ./fyneclient
Build and run the Fyne client, as a WASM client:
# change to the repository root
$ cd /path/to/xoxo-go
# build wasm and run local webserver
$ go run github.com/hajimehoshi/wasmserve@latest ./cmd/fyneclient
Then open http://127.0.0.1:8080 in a browser.
Build and run the Gio client, as a Desktop client:
# change to the repository root
$ cd /path/to/xoxo-go
# build/run the Gio client
$ go build ./cmd/gioclient && ./gioclient
Build and run the Gio client, as a WASM client:
# change to the repository root
$ cd /path/to/xoxo-go
# build wasm and run local wgioserver
$ go run github.com/hajimehoshi/wasmserve@latest ./cmd/gioclient
Then open http://127.0.0.1:8080 in a browser.
- Grab Defold client code, and configure:
# get the Defold client
$ git clone https://github.com/defold/game-xoxo-nakama-client.git && cd game-xoxo-nakama-client
# change game.project settings
$ perl -pi -e 's/host =.*/host = 127.0.0.1/' game.project
$ perl -pi -e 's/port =.*/port = 7352/' game.project
$ perl -pi -e 's/server_key =.*/server_key = xoxo-go_server/' game.project
- Build and run the Defold client:
# change to path
$ cd /path/to/game-xoxo-nakama-client
# build and fix permissions
$ java -jar /opt/Defold/bob.jar --variant=debug && chmod +x ./build/x86_64-linux/dmengine
# run defold with debugging
$ DM_SERVICE_PORT=dynamic ./build/x86_64-linux/dmengine
- github.com/ascii8/nakama-go - a Nakama client for Go, with realtime WebSocket and WASM support
- github.com/ascii8/nktest - a Nakama module testing package for Go
- github.com/defold/game-xoxo-nakama-client - a Nakama Tic-Tac-Toe client made with Defold
- github.com/defold/game-xoxo-nakama-server - a Nakama Tic-Tac-Toe server (Lua)