Giter Club home page Giter Club logo

network_synchronizer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

network_synchronizer's Issues

Remove exceptions

As of Godot 4.2 and later, Godot disables exceptions by default. While they can be re-enabled, it would be best to remove them from this library for several reasons:

  • Avoid extra steps when using this library (the step of needing to enable exceptions)
  • Reduce binary size by about 20%
  • Reduce build time by between 10% and 50%
  • There are likely performance improvements to having exceptions disabled

See godotengine/godot#80612

Currently, this error is shown when trying to compile:

./modules/network_synchronizer/net_utilities.h:40:2: error: cannot use 'try' with exceptions disabled
        try {
        ^
./modules/network_synchronizer/net_utilities.h:49:2: error: cannot use 'try' with exceptions disabled
        try {
        ^

Buffer errors in case of 2 and more clients

DollController starts call _apply_epoch() in process() just after creation.
But at this moment buffers are empty, so in example project in NetworkedController in method _apply_epoch I added checks for buffer size. Without checks it tries to read Vectors from empty buffers. And it will continue until server send real epoch.
But if you can add check for buffer size, you still get error because DollController calls seek() on empty buffer.

Attached example project for 3.x, ported for 4.0
Tested on Godot 4 alpha15 + NetSync
example-project-3.x.zip

Rename setup_deferred_sync to something with clearer intent

We discussed that a bit together with @AndreaCatania and @RevoluPowered but "deferred" is already used by godot to mean "at the end of this frame". But in network_synchronizer, we mean it in the sense of "less often, and the state instead of the inputs" so we might want another word for that.

To make it be clearly different from the simulation part of the NetSync code, I'm kind of partial to the word "trickled" as it is not as loaded in meaning as "streaming".

Also, we already are somewhat streaming inputs in the other part, while in the "trickled" part, we are sending the full state periodically in a lower amount per second than the streaming input part.

I'll open a PR for this renaming, but please comment if you have any better naming, or anything of that sort.

Scene synchronizer does not support indexed values

The barometer of whether a variable is found or not is done through

const Variant old_val = p_node->get(p_variable, &valid);

which means that variables like character:rotation is invalid. Likewise, all values are called via get().

Switching to get_indexed() would increase versatility.

Can't compile due some miss declarations.

Can't compile because some declarations don't match.

The functions SceneSynchronizerBase::set_frame_confirmation_timespan
and SceneSynchronizerBase::set_objects_relevancy_update_time should recive a float according to scene_synchronizer.h but in
scene_synchronizer.cpp it recives a real_t.
The function SceneSynchronizerBase::get_objects_relevancy_update_time acording with the declaration on scene_synchronizer.h should return a float but on scene_synchronizer.cpp it returns a real_t.

Maybe it's missing a typedef or #define somewhere.

MultiplayerSynchronizer and 4.1

Sorry to create an issue for a question but couldn't find any other place to reach out.
I've been looking for a solution for my multiplayer FPS game that has functionality for predicition & reconciliation. Looks like the project is dead on however what's not clear from the doc is

  • is it compatible with 4.1 or upcoming 4.2
  • is it a complete replacement for MultiplayerSyncronizer and MultiplayerSpawner nodes or is it supposed to be complimentary
  • apart from the example project are there any documents? is this an addon/extension? does it need to be compiled, how to start using etc?

thank you

Getting an exception followed by the client crashing when joining a server

Hello, I'm getting an exception that points to this line on scene_synchronizer.cpp:

image

My project is super simple so I'm hitting my head against a wall trying to find out what I'm doing wrong...
I even tried to compile the engine with the debug symbols to figure this out... and also tried to contact you on twitter.

I've tried it on both 4.3 and 4.2 Godot branches.

When using the module and having the autoload that extends GdSceneSynchronizer, After trying to connect to the server as the client, the client crashes instantly.

I don't know what I'm doing wrong...
ย 
Log:
image

ERROR: Condition "!is_inside_tree()" is true. Returning: ERR_UNCONFIGURED
   at: Node::rpcp (scene\main\node.cpp:733)
scene\main\node.cpp:733 - Condition "!is_inside_tree()" is true. Returning: ERR_UNCONFIGURED
Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_493585427225c794\nvwgf2umx.dll'.
Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_493585427225c794\nvldumdx.dll'.
ERROR: Can't create the `F:/godot/godot/bin/net-sync-debugs/dump/debugger.py` file.
   at: (modules\network_synchronizer\core\scene_synchronizer_debugger.cpp:154)
Can't create the `F:/godot/godot/bin/net-sync-debugs/dump/debugger.py` file.
Loaded 'C:\Windows\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_493585427225c794\nvldumdx.dll'. 
Loaded 'C:\Windows\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_493585427225c794\nvwgf2umx.dll'. 
Loaded 'C:\Windows\System32\mswsock.dll'. 
ERROR: Trying to call an RPC via a multiplayer peer which is not connected.
   at: (modules\multiplayer\scene_rpc_interface.cpp:467)
Trying to call an RPC via a multiplayer peer which is not connected.
ERROR: Can't create the `F:/godot/godot/bin/net-sync-debugs/dump/debugger.py` file.
   at: (modules\network_synchronizer\core\scene_synchronizer_debugger.cpp:154)
Can't create the `F:/godot/godot/bin/net-sync-debugs/dump/debugger.py` file.
ID= 1793853108 connection established!
++ New player connected: 1

As for my project, its super simple, here's the script that inherits from GdSceneSynchronizer

extends GdSceneSynchronizer

const IP_ADDRESS: String = "127.0.0.1"
const PORT: int = 9999

@onready var player_scene := preload ("res://character.tscn")

func _ready():
	multiplayer.peer_connected.connect(peer_connected)
	multiplayer.peer_disconnected.connect(peer_disconnected)
	multiplayer.connected_to_server.connect(connected_to_server)
	multiplayer.connection_failed.connect(connection_failed)

func start_server():
	var peer = ENetMultiplayerPeer.new()
	peer.create_server(PORT, 99)
	multiplayer.multiplayer_peer = peer

func start_client():
	var peer = ENetMultiplayerPeer.new()
	peer.create_client(IP_ADDRESS, PORT)
	multiplayer.multiplayer_peer = peer

func peer_connected(id: int):
	print("++ New player connected: ", id)
	# spawn_player(id)

func peer_disconnected(id: int):
	print("-- Player disconnected: ", id)

func connected_to_server():
	print("ID= ", multiplayer.get_unique_id(), " connection established!")

func connection_failed():
	print("[ERROR] ID= ", multiplayer.get_unique_id(), " connection failed!")

func spawn_player(id: int):
	var player = player_scene.instantiate()
	player.set_multiplayer_authority(id)
	player.name = str(id)
	player.global_position = Vector3(randf_range( - 7, 7), 0, randf_range( - 7, 7))
	get_tree().root.add_child(player)

And this is my menu, it had the code above before but I moved it cause I was just trying anything I could think of to get this running.

extends CanvasLayer

@onready var menu := $PanelContainer

func _on_server_pressed():
	GameSync.start_server()
	menu.visible = false

func _on_client_pressed():
	GameSync.start_client()
	menu.visible = false

I put the project in a repo to make things a bit easier...
https://github.com/MathyFey/NetworkSyncTest

input_network_encoder.cpp binds function "decode" with too many arguments

Or script_decode is defined as having too few.

input_network_encoder.cpp defines "decode" with one too many arguments, resulting in an error in godot's debugger. "Method definition provides more arguments than the method actually has InputNetwokEncoder::decode".

ClassDB::bind_method(D_METHOD("decode", "buffer", "inputs"), &InputNetworkEncoder::script_decode);
Array script_decode(Object *p_buffer) const;

cc @AndreaCatania

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.