heroiclabs/nakama-godot-demo

assert fail

MarwanTredano opened this issue · 6 comments

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

Thanks for the report. So you can log in, create a character, and enter the game when registering an account, but not when using the login menu?

Also, could you confirm this happens not when clicking on "login", but when double clicking on a character (i.e. when joining the game level) ?

I can't reproduce the issue here unfortunately. Could you also confirm you're using Godot 3.2 stable?

@Razoric480 any idea of where this could come from? The error happens in GameWorld.join_world():

func join_world(
	state_positions: Dictionary,
	state_inputs: Dictionary,
	state_colors: Dictionary,
	state_names: Dictionary
) -> void:
	var user_id := ServerConnection.get_user_id()
	assert(state_positions.has(user_id), "Server did not return valid state")

It really shouldn't. The first thing the server does when a user joins is add them as an entry in the various state tables, so at the very least, they should at least be in the resulting Dictionary as empty but present data (I.E. x and y at 0,0). See world_control.match_join().

@MarwanTredano could you put a breakpoint at the start of join_world and inspect the contents of the state_positions Dictionary? If it's empty or if something looks weird about the entries?

it was a Godot version issue, i was still on 3.1 ... Sorry for the inconvenience, its now working :)

Good to know, thanks!