Godot Version
4.5.1 stable
Steam Networking Issue
I am making a multiplayer scary game and im having issues with the client being able to change some of the in-game items properties.
For instance, the host and client have to collect lost boxes and take them back to their correct destination. When the host goes to pick up a box. The items visibilty turns off.
However, when the client does the action. The item’s visibility remains on and doesn’t change the host’s lobby nodes’ properties.
(All the box nodes are in the host’s lobby.)
I have figured out that i should incorporate @rpc, because that might be the solution. I just dont know how and where i would incorporate it. Something with this maybe @rpc(“any_peer”,“call_local”, “reliable”).
i also made sure all the items were correctly put in the multiplayer synchronizer as well.
If anyone can help me it would be greatly appreciated.
func host_lobby():
Steam.createLobby(Steam.LobbyType.LOBBY_TYPE_PUBLIC, 16)
is_host = true
func _on_lobby_created(result: int, lobby_id: int):
if result == Steam.Result.RESULT_OK:
self.lobby_id = lobby_id
peer = SteamMultiplayerPeer.new()
peer.server_relay = true
peer.create_host()
multiplayer.multiplayer_peer = peer
multiplayer.peer_connected.connect(_add_player)
multiplayer.peer_disconnected.connect(_remove_player)
_add_player()
print("lobby created, lobby id: " + str(lobby_id))
func join_lobby(lobby_id: int):
is_joining = true
Steam.joinLobby(lobby_id)
func _on_lobby_joined(lobby_id: int, permissions: int, locked: bool, response: int):
if !is_joining:
return
self.lobby_id = lobby_id
peer = SteamMultiplayerPeer.new()
peer.server_relay = true
peer.create_client(Steam.getLobbyOwner(lobby_id))
multiplayer.multiplayer_peer = peer
is_joining = false
func _add_player(id: int = 1):
var player = player_scene.instantiate()
player.name = str(id)
call_deferred("add_child", player)
func _remove_player(id: int):
if !self.has_node(str(id)):
return
self.get_node(str(id)).queue_free()
func _on_joinsteam_pressed() -> void:
join_lobby(line_edit.text.to_int())
mainmenu.visible = false
func _on_hostbtn_2_pressed() -> void:
host_lobby()
mainmenu.visible = false
# STEAM MULTIPLAYER