Giter Club home page Giter Club logo

Comments (3)

AndreaCatania avatar AndreaCatania commented on May 28, 2024 2

Hi, I was able to reproduce the crash and I fixed it here.

Now that the bug is fixed, you have to:

  1. Follow the instructions: #113 (comment)
  2. Spawn the character on all the connected clients upon peer connection.
  3. Make sure the spawned character (node) authority is set to the just connected peer on all the peers.
  4. Register the character as controlled by the connecter peer using:
func _ready() -> void:
	GdSceneSync.register_node(self)


func _setup_synchronizer(local_id) -> void:
	GdSceneSync.setup_controller(self, get_multiplayer_authority(), _collect_inputs, _count_input_size, _are_inputs_different, _controller_process)
	GdSceneSync.register_variable(self, "transform")


# ------------------------------------------------------------------- Networking
func _collect_inputs(delta: float, buffer: DataBuffer) -> void:
      var input_move : Vector3 = ....
      buffer.add_vector3(input_move )


func _count_input_size(inputs: DataBuffer) -> int:
	var buffer_size = 0

	buffer_size += inputs.get_vector3_size()
	
	return buffer_size 


func _are_inputs_different(inputs_A: DataBuffer, inputs_B: DataBuffer) -> bool:
	if inputs_A.size != inputs_B.size:
		return true

	var input_move_A= inputs_A.read_vector3()
	var input_move_B = inputs_B.read_vector3()
	if input_move_A != input_move_B:
		return true

	return false


func _controller_process(delta: float, buffer: DataBuffer) -> void:
    var input_move = inputs_A.read_vector3()
	
    # Process the character.

NOTE: The algorithm you put inside _controller_process MUST be deterministic and inside _setup_synchronizer you MUST register as sync all the variables you change inside _controller_process.
Please post a question if you need help with that.

from network_synchronizer.

MathyFey avatar MathyFey commented on May 28, 2024

Actually this might be more useful:

Godot Engine v4.2.2.rc.custom_build.c7fb0645a - https://godotengine.org
Vulkan API 1.3.271 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 3050
 
USER ERROR: Condition "!is_inside_tree()" is true. Returning: ERR_UNCONFIGURED
   at: Node::rpcp (scene\main\node.cpp:733)
USER ERROR: Can't create the `F:/godot/godot/bin/net-sync-debugs/dump/debugger.py` file.
   at: SceneSynchronizerDebugger::setup_debugger_python_ui (modules\network_synchronizer\core\scene_synchronizer_debugger.cpp:154)
USER ERROR: Trying to call an RPC via a multiplayer peer which is not connected.
   at: SceneRPCInterface::rpcp (modules\multiplayer\scene_rpc_interface.cpp:467)
USER ERROR: Can't create the `F:/godot/godot/bin/net-sync-++ New player connected: 1072216734
USER ERROR: Condition "!is_inside_tree()" is true. Returning: Transform3D()
   at: Node3D::get_global_transform (scene\3d\node_3d.cpp:343)
USER ERROR: Attempted to free invalid ID: 11317238825133
   at: RenderingDeviceVulkan::_free_internal (drivers\vulkan\rendering_device_vulkan.cpp:8594)
al_transform (scene\3d\node_3d.cpp:343)

================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.2.2.rc.custom_build (c7fb0645af400a1859154bcee9394e63bdabd198)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] <lambda_b7d093ff36b5886126bfb4cd623d2190>::operator() (F:\godot\godot\modules\network_synchronizer\scene_synchronizer.cpp:3670)
[1] <lambda_b7d093ff36b5886126bfb4cd623d2190>::operator() (F:\godot\godot\modules\network_synchronizer\scene_synchronizer.cpp:3670)
[2] NS::ClientSynchronizer::parse_sync_data (F:\godot\godot\modules\network_synchronizer\scene_synchronizer.cpp:3418)
[3] NS::ClientSynchronizer::parse_snapshot (F:\godot\godot\modules\network_synchronizer\scene_synchronizer.cpp:3700)
[4] NS::ClientSynchronizer::receive_snapshot (F:\godot\godot\modules\network_synchronizer\scene_synchronizer.cpp:2577)
[5] NS::SceneSynchronizerBase::rpc_receive_state (F:\godot\godot\modules\network_synchronizer\scene_synchronizer.cpp:1128)
[6] std::_Func_impl_no_alloc<<lambda_80543f754b581fa0436334ad3f7ba8e7>,void,DataBuffer &>::_Do_call (C:\Work\Tools\VS\2022\Community\VC\Tools\MSVC\14.37.32822\include\functional:839)
[7] NS::NetworkInterface::rpc_receive (F:\godot\godot\modules\network_synchronizer\core\network_interface.h:133)
[8] GdNetworkInterface::gd_rpc_receive (F:\godot\godot\modules\network_synchronizer\godot4\gd_network_interface.cpp:296)
[9] call_with_variant_args_dv<GdSceneSynchronizer,Vector<unsigned char> const &> (F:\godot\godot\core\variant\binder_common.h:450)
[10] MethodBindT<GdSceneSynchronizer,Vector<unsigned char> const &>::call (F:\godot\godot\core\object\method_bind.h:333)
[11] Object::callp (F:\godot\godot\core\object\object.cpp:775)
[12] SceneRPCInterface::_process_rpc (F:\godot\godot\modules\multiplayer\scene_rpc_interface.cpp:286)
[13] SceneRPCInterface::process_rpc (F:\godot\godot\modules\multiplayer\scene_rpc_interface.cpp:228)
[14] SceneMultiplayer::_process_packet (F:\godot\godot\modules\multiplayer\scene_multiplayer.cpp:241)
[15] SceneMultiplayer::poll (F:\godot\godot\modules\multiplayer\scene_multiplayer.cpp:144)
[16] SceneTree::process (F:\godot\godot\scene\main\scene_tree.cpp:497)
[17] Main::iteration (F:\godot\godot\main\main.cpp:3634)
[18] OS_Windows::run (F:\godot\godot\platform\windows\os_windows.cpp:1474)
[19] widechar_main (F:\godot\godot\platform\windows\godot_windows.cpp:182)
[20] _main (F:\godot\godot\platform\windows\godot_windows.cpp:206)
[21] main (F:\godot\godot\platform\windows\godot_windows.cpp:218)
[22] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[23] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================

from network_synchronizer.

AndreaCatania avatar AndreaCatania commented on May 28, 2024

Hi, I'll be able to check this tomorrow. In the meanwhile try to call "clear()" and then "reset_synchronizer_mode()" at the end of "start_server()" and "start_client()". Let me know and if it doesn't work, don't worry, we will figure out.

from network_synchronizer.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.