How to add the AnimationNodeStateMachinePlayback to the MultiplayerSynchronizer
Asked Answered
A

1

0

Hello guys,

I've been struggling with this issue for a few days now, I am trying to create a small multiplayer arena game to learn networking and I am kinda done with almost everything I set out to do with this demo, now I have only one problem and that is how to sync animations, I found movement animations to be quite easy but I struggle to add the attack animations to the MultiplayerSynchronizer.

The way I do movement is :

var is_idle =  input_dir == Vector2.ZERO && is_on_floor()
var is_running = input_dir != Vector2.ZERO && is_on_floor()
$AnimationTree.set("parameters/conditions/idle", is_idle)
AnimationTree.set("parameters/conditions/run", is_running)

Now this works fine as these animations are played with a condition but I can't do the same for attacks, I tried in a lot of ways and looked up videos and well I got them working really well by using:

@onready var  state_machine = $AnimationTree.get("parameters/playback")
func play_basic_attack():
  state_machine.travel("basicAttack")
  await $AnimationTree.animation_finished
  state_machine.travel("Idle")

The only problem I have with this is that I can't find a way to let the MultiplayerSynchronizer about this, for moment it was easy as the conditions added are right there :

You can see the red arrow is what works to be synced, if I call the basic attack in the same way it will be shown to the other peer by there are two results to this, either it keeps repeating or it stops at the end of the animation, so I need to ask the AnimationTree to travel to it so it can go through this process
and that works it's just I don't know how I can tell the MultiplayerSynchronizer to pick this up for other players.
The blue line shows what I assumed was the fix to this and to sync the condition/playback of the state machine but when I run my game the other players are T-Posing and I get the following error in the Debugger: process: Condition "playback_new.is_null()" is true. Returning: 0.0
<C++ Source> scene/animation/animation_node_state_machine.cpp:1219 @ process()
Any ideas how I could fix this ? Thank you very much.

Apices answered 27/3, 2023 at 23:38 Comment(0)
T
0

I have also that problem but with different error
and with 2d. I am lucky because my game runs as I want but with a n error which is not effect the game !! I have asked everywhere and no answer!!! Maybe it is a bug.

Tribromoethanol answered 18/6, 2023 at 10:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.