heroiclabs / nakama-godot-demo

A demo project with Godot engine and Nakama server.
Other
301 stars 48 forks source link

Testing nakama godot demo with nakama 3.1.2 #34

Open tucano opened 3 years ago

tucano commented 3 years ago

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

novabyte commented 3 years ago

@tucano Are you running Nakama with the code modules needed for the multiplayer demo? Please check the server logs to see if the runtime modules are loaded.

tucano commented 3 years ago

Hello @novabyte I see this in the server logs

nakama         | {"level":"info","ts":"2021-04-12T13:18:14.945Z","caller":"server/runtime.go:503","msg":"Found runtime modules","count":2,"modules":["world_control.lua","world_rpc.lua"]}
nakama         | {"level":"info","ts":"2021-04-12T13:18:14.945Z","caller":"server/runtime.go:518","msg":"Registered Lua runtime RPC function invocation","id":"register_character_name"}
nakama         | {"level":"info","ts":"2021-04-12T13:18:14.945Z","caller":"server/runtime.go:518","msg":"Registered Lua runtime RPC function invocation","id":"remove_character_name"}
nakama         | {"level":"info","ts":"2021-04-12T13:18:14.945Z","caller":"server/runtime.go:518","msg":"Registered Lua runtime RPC function invocation","id":"get_world_id"}
novabyte commented 3 years ago

@tucano Ok great that all looks right. Do you see any errors in the logs which would indicate a problem with the client when it sends messages to the server? What version of Godot engine do you use?

tucano commented 3 years ago

In the client, I can login and create a character. But, when I click on the character to enter in game the client do not do nothing.

Client logs:

=== Nakama : DEBUG === Sending async request: MatchJoin<match_id=4a09acac-9109-434b-af38-02baba689d55.nakama1, token=Null, metadata=Null>
=== Nakama : DEBUG === Resuming response: 1: {cid:1, match:{authoritative:True, label:Social world, match_id:4a09acac-9109-434b-af38-02baba689d55.nakama1, self:{session_id:857a4691-9b92-11eb-86d5-7106fdcb5b46, user_id:fd45e508-e336-4a1b-bfd9-a14020e49572, username:dsa@dsa.dsa}}}
=== Nakama : DEBUG === Sending async request: ChannelJoin<persistence=False, hidden=False, target=world, type=1>
=== Nakama : DEBUG === Resuming response: 2: {channel:{id:2...world, room_name:world, self:{session_id:857a4691-9b92-11eb-86d5-7106fdcb5b46, user_id:fd45e508-e336-4a1b-bfd9-a14020e49572, username:dsa@dsa.dsa}}, cid:2}

No more logs after that. Godot engine 3.2.3 and I am running the client directly from the godot interface (with play)

FoxelFoxy commented 3 years ago

is there any solution to that? I'm kinda stuck on the same thing, I can create accounts/chars but as soon as I try to login into the game world nothing happens.

raptor0999 commented 2 years ago

I've been working on learning Nakama with Godot and happened upon this error as well.

Just wanted to let you know that the fix for it is to open up NakamaRTAPI.gd under addons/com.heroiclabs.nakama/api and edit line 10 "presences" to be required: false instead of required: true. Found the solution through: https://github.com/heroiclabs/nakama-godot/issues/58

Also, you may want to make sure that metadata is relayed when joining match as well as referenced in: https://github.com/heroiclabs/nakama-godot/issues/59

And also, you now have to add a match_signal function in your world_control.lua server module, as referenced here: https://github.com/heroiclabs/nakama/blob/master/data/modules/match.lua

Hopefully Heroic Labs can update this demo/tutorial; I understand that not many people have used it, but it would be nice not to have to stumble through and trace code to get a demo working.