How to synchronize rpc call with client-authority

Godot Version

v4.4.1

Question

I am working on a multiplayer game that uses client-authority. For each client I have a StateMachine which manages different States based on Player input. Each State is entered on signal callback and set in this fashion (note: the code is simplified to give an idea of how I handle the logic):

func set_current_state(new_state: State) -> void:
	if current_state and new_state != current_state:
		current_state.exit()
	current_state = new_state
	current_state.enter()

This code is run through the signal callback which checks for authority like so (to my understanding that’s how you make it client-authoritative):

func on_state_transition(_state: State, _wanted_state: String) -> void:
	if not is_multiplayer_authority():
		return
	# rest of the logic

In each State’s enter() an rpc method is called in an AnimationComponent class, responsible for traveling to the correct Playback node, like so:

func enter() -> void:
	# some logic
	play_idle()
@rpc("any_peer", "call_local")
func play_idle() -> void:
	playback.travel("idle")

Again, to my understanding, calling the rpc as any_peer and call_local should run it on EVERY peer in the game, however I can’t get my play_idle logic to run on any peer other than the sender. I tried to log the call and I get something along the lines of:

Peer [0] sent anim data to [1244740599] # when called on the client
Peer [0] sent anim data to [1] # when called on the host

I am completely lost at this point :rofl: and going through the RPC documentation does not help at all. Any help anyone?

Seems like you are only calling play_idle locally, for networking the function do you mean to use play_idle.rpc()?

I can’t believe it was this ahah I completely skipped it in the doc too. Thanks a lot, you saved my sanity