Godot 4 · GDScript
Players
Each player gets an automatic identity the first time and keeps it across sessions. No login screens needed. The identity is stored locally and securely.
Retrieving Player Info
Gamdato.get_player_name() # Player nickname
Gamdato.get_player_id() # Unique player IDNever show the player ID in production.
Changing Player Name
Change the display name and listen to newname_completed. The name must be 2-30 characters and may contain only letters, numbers, spaces, hyphens and underscores; the server rejects anything else.
Gamdato.newname_completed.connect(_on_rename)
Gamdato.set_newname("NewPlayerName")
func _on_rename(status: int, attempted: String, applied: String) -> void:
match status:
1: print("Name changed to %s" % applied)
-1: print("That name is already taken")
0: print("Could not change name")# newname_completed(status: int, attempted_name: String, applied_name: String)
# status = 1 applied successfully (applied_name is the new name)
# status = -1 name already taken
# status = 0 invalid or rejectedAccepting Invitations
Let players opt in or out of receiving friend and group invitations. Read the current flag, or set it from a settings menu.
Gamdato.invitability_loaded.connect(_on_invitability)
Gamdato.get_invitability() # read current value
Gamdato.set_invitability(false) # stop receiving invitations
func _on_invitability(is_invitable: bool) -> void:
print("Accepts invitations: %s" % is_invitable)