This demo shows how to use Nakama with the Nakama Godot client.
It showcases the following Nakama features:
- Authentication, sessions, and disconnection.
- Game storage.
- Sockets and managing connections.
- Real-time chat.
- In-app notifications with popups.
- Character color customization.
- Platforming mechanics and synchronizing players. Multiple players can interact together.
It also shows good practices to design user interface and structure your Godot projects.
There are two Godot projects in this repository:
- In the
godot/
directory, you have the complete demo. - In the
tutorial/
directory, there is a Godot project showing basic code examples to get you started. There, you will also find written notes for an upcoming series of video tutorials, with code snippets.
Here is a view of the game world, where players can chat, move around, interact with one-another, or change their color.
The character creation screen allows you to pick a color from a predefined color palette.
To test the project, you need first to install the server and get it running, then run two instances of Godot.
To install and start the server:
- Install Docker.
- On Windows 10 Pro.
- On Windows 10 Home (and below).
- On Mac.
- On Ubuntu:
sudo apt install docker.io docker-compose
.
- Open your terminal and navigate to the
nakama/
directory. - Run the command
docker-compose -f docker-compose.yml up
or runboot.bat
in Windows.
Docker should automatically download, then install Nakama and CockroachDB for you before starting the local server. The server should emit the message "Startup done".
Then, to test the project in Godot, you need to open or run the project in the godot/
directory in two separate instances.
-
Double-click on the Docker Quickstart Terminal shortcut created by the docker toolbox installer.
-
Run the Command
docker-machine ip
to get your IP and save it for future use. -
Extra settings if not running project from C drive
- Create shared folder
- Edit in the
docker-compose.yml
change the volumes path under nakama services to
"/Folder Name define in the VBox settings(step 4i)/path to docker-compose.yml file:/nakama/data"
- Run the Command "docker-machine restart"
To log into the game, you need first to register a dummy local account. To do so, on the initial game screen:
- Click on the "register" button.
- Enter any email and password.
- The email doesn't need to exist, but it needs to be of the form
email@domain.extension
. For example,test@test.com
would work. - The password needs to contain at least 8 characters.
- The email doesn't need to exist, but it needs to be of the form
Once you registered an account, you can log in, create a new character, and enter the game.
Nakama's server provides a web admin interface to see, modify, or purge users and other game data. To access it:
- Start the Nakama server.
- Navigate to http://127.0.0.1:7351/ in your web browser.
- Run
docker-machine ip
to get the IP if Windows 10 Home and below
- Run
- Log into the platform. The default admin user's login is
admin
and its password ispassword
.
This project is dual-licensed:
- The source code is available under the Apache 2.0 license.
- Art assets (images, audio files) are CC-By-SA 4.0. You should attribute them to Heroic Labs (https://heroiclabs.com/).