Is it better to remove scripts on runtime or set scripts on runtime?

Godot Version

4.6

Question

I have a multiplayer game, and whenever a new player joins it adds the script which is attached to the CharacterBody3D node which I have made. This means that whenever my client moves their button it also applies for all connected players (for a second because it doesn’t have multiplayer authority). This causes a stuttering effect.

Should I

  1. Create 2 different nodes and do a complex workaround so multiplayer peers are actually using a different version to the client player
  2. Start all players with no scripts and then add the client player it’s script on runtime
  3. Start all players with scripts and then remove all of the non-client scripts on runtime.
  4. Your suggestions

Instantiating a scene that includes an attached script is best. You probably do not want different client scripts for the high level multiplayer to work best. Your stutter may just be from connecting to a peer or loading from disk, is the stutter constant or only on a new player?

The stutter is consant, the multiplayer players move on the client side and the move back to their original spot after 250ms.

You’ve got something wrong with your networking then. Either you’re using @rpc calls incorrectly or not using them at all. Using them correctly is how you use the same player script and have input only move the local player.

1 Like