Git Product home page Git Product logo

nakama-godot-demo's Introduction

Nakama Godot Demo

Nakama Godot demo banner image

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.

Learning Nakama

There are two Godot projects in this repository:

  1. In the godot/ directory, you have the complete demo.
  2. 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.

Screenshots

Here is a view of the game world, where players can chat, move around, interact with one-another, or change their color.

in-game screenshot

The character creation screen allows you to pick a color from a predefined color palette.

Character creation screen

Testing the project

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:

  1. Install Docker.
  2. Open your terminal and navigate to the nakama/ directory.
  3. Run the command docker-compose -f docker-compose.yml up or run boot.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.

Setting up docker on Windows 10 Home and below)

  1. Install Docker Toolbox.

  2. Double-click on the Docker Quickstart Terminal shortcut created by the docker toolbox installer.

  3. Run the Command docker-machine ip to get your IP and save it for future use.

  4. Extra settings if not running project from C drive

    1. Create shared folder
    2. 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"

    1. Run the Command "docker-machine restart"

Registering and logging in

To log into the game, you need first to register a dummy local account. To do so, on the initial game screen:

  1. Click on the "register" button.
  2. Enter any email and password.
    • The email doesn't need to exist, but it needs to be of the form [email protected]. For example, [email protected] would work.
    • The password needs to contain at least 8 characters.

Once you registered an account, you can log in, create a new character, and enter the game.

Using the Nakama admin area

Nakama's server provides a web admin interface to see, modify, or purge users and other game data. To access it:

  1. Start the Nakama server.
  2. 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
  3. Log into the platform. The default admin user's login is admin and its password is password.

Licenses

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/).

nakama-godot-demo's People

Contributors

chippmann avatar dsnopek avatar greenfox1505 avatar nathanlovato avatar razoric480 avatar tanjunior avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nakama-godot-demo's Issues

BSOD after enabling Virtualization Mode for Dockers

Hi,

to enable Dockers to run, i needed to enable Virtualization mode from the BIOS.
After that my pc crashed 2 times in a row (Blue Screen, aka BSOD :( )

Any known fix for this ?
Sorry if this isnt directly related

The created character does not come to the character list.

After logging in with the user and selecting the character color, the character created in the character list does not appear and the game crashes when the login button is pressed. Because there are no characters trying to enter the game by pressing Login.

resim

Character is not creating/accessing

Hi,
I tried to use this demo to study about Nakama and Networking stuff.
I've setup a Nakama Server in a VPS (Ubuntu 19.10) and, so far, it works! I can access Nakama Dashboard and connect using this Demo Client.

The problem is: After a register/connection pops up a Character Creation (Select color and name). After this process our Character isn't created. My list is totally blank:
image

If I try to 'force' a connection without select a character this error appears:
image
I think this is happening because my selection is null.

So, I keep looking at codes and, after unsuccessful tries I decided to working on your tutorial.

It works and, at auth, I used my previous created user ([email protected]) and, for my surprise - at Nakama Dashboard - it creates two characters at user storage. So I thought: lets try to connect now at our Demo Version and:

image

I guess there is so connecting problem when we try to access our server.

TY!

Split game scenes, group server communication in top-level nodes

I'm in the process of rewriting the game's code to better separate concerns (794e3ca and 2976cf5). The goals are to reduce coupling and to have a single point of communication with the server in each scene:

  • Avoid server communication in UI code
  • Have visual code in the UI
  • Make the code easier to follow and teach, respecting the single responsibility principle

Testing nakama godot demo with nakama 3.1.2

Hello I am testing the demo with a nakama server 3.1.2

In the docker-compose I have:

nakama:
    container_name: nakama
    image: heroiclabs/nakama:latest

Everything seems to work fine and I can creare a user and login, but when I try to enter in the game (socket connection) the client disconnect

 {"level":"info","ts":"2021-04-12T12:55:26.339Z","msg":"New WebSocket session connected","uid":"068c04b7-6cbd-4d4a-9b60-9303b7088629","sid":"4c725181-1b61-4f6c-bf69-c484642ed0f3","format":0}
 {"level":"info","ts":"2021-04-12T12:55:26.385Z","msg":"Match started","mid":"f7c75cf2-41a7-4343-ade2-9d67e6c920d2"}
 {"level":"info","ts":"2021-04-12T12:56:16.405Z","msg":"Closed client connection","uid":"068c04b7-6cbd-4d4a-9b60-9303b7088629","sid":"4c725181-1b61-4f6c-bf69-c484642ed0f3"}

Best Regards

Please help ๐Ÿ˜ญ

Im getting this error after trying to run this function (trying to connect to the server)

These are all the variables associated with the function
var client := Nakama.create_client(Server_KEY, "127.0.0.1", 7350, "http")
var Session : NakamaSession
var Socket : NakamaSocket

func Connect_to_server_async():
Socket = Nakama.create_socket_from(client)
var result : NakamaAsyncResult = yield(Socket.connect_async(Session), "completed")
if not result.is_exception():
Socket.connect("closed", self, "Nakama_Socket_Closed")
return OK
return ERR_CANT_CONNECT

Invalid get index 'token' (on base: 'Nil').

Does not seem to work with nakama 3.0

I just added my server config and was able to to register and login a user, but then I cannot select a created game character and when I just hit login it crashes

E 0:00:39.168 get_child: Index p_index = -1 is out of bounds (data.children.size() = 0).
<C++-Quellcode>scene/main/node.cpp:1296 @ get_child()
CharacterList.gd:61 @ get_character_data()
CharacterList.gd:67 @ get_selected_character()
CharacterSelector.gd:38 @ _on_LoginButton_pressed()

ERROR: get_child: Index p_index = -1 is out of bounds (data.children.size() = 0).
At: scene/main/node.cpp:1296

Typo in ServerConnection.gd

I found a small typo at lines 138 and 425. "Namaka" should be "Nakama"
It's present both at the function definition and the connection to the function
image

image

Help me,i need you very much.

I have successfully deployed to the server, but the delay seems to be a bit high, how can I cancel the simulation delay?

assert fail

I get the following error when trying to log in
"Parser error : Expected ')' in expression" referring to this line of code:
"assert(state_positions.has(user_id), "Server did not return valid state") "

Steps to reproduce:

I Installed Docker On Windows.
I Opened the terminal and navigated to the nakama/ directory.
I ran the command run boot.bat in Windows.

I got the message "Startup done".

Then I created 2 separate accounts (I checked on the Nakama Server, they are existing accounts)
and tried to log in, got that error

Rewrite CharactersMenu

All the code is in one place, it needs to be split up. Also, after redesigning the menu, there are some parts that should be removed.

Error Code 8: HTTPRequest Failed! [Windows 10 Home]

image

Hello, once the Bash throws me the "" msg ":" Startup done "}" I proceed to run the project in godot, but in the registry part I get the following error "Error Code 8: HTTPRequest Failed!" I have been trying to find what it is, however I have not managed to solve it, I would appreciate the support since I am very interested in continuing to test the project, regards

image

Coversion to Godot 4

I was trying to use Godot 4 to run this project and used godot editor's auto-conversion function to tranfer the entire demo to Godot 4, but always something wrong with the coverted file and cannot execute.

Just wondering could you guys help update the demo so that it is compatible with godot 4 client
or at least upgrade those two autoload file, it would be helpful for me to learn the godot 4 version of nakama client

Add licenses

Apache 2.0 for code and CC-By-SA 4.0 for the art.

Docker image and nakama

Greetings,

I was trying to test and learn about Nakama
however, I failed from the first step which ( setting up Nakama )
once i run docker-compose -f docker-compose.yml up inside nakama folder i get this error :

Creating nakama ... error

ERROR: for nakama Cannot create container for service nakama: Conflict. The container name "/nakama" is already in use by container "c08f2e484a16335da155834585e94a1ef9cd09a7550649f74c4faecfab18a59d". You have to remove (or rename) that container to be able to reuse that name.

ERROR: for nakama Cannot create container for service nakama: Conflict. The container name "/nakama" is already in use by container "c08f2e484a16335da155834585e94a1ef9cd09a7550649f74c4faecfab18a59d". You have to remove (or rename) that container to be able to reuse that name.
ERROR: Encountered errors while bringing up the project.

I made sure before doing this command that i dont have any images or containers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.