From 4f570e397157997f6df1228bb5154202c7f5739f Mon Sep 17 00:00:00 2001 From: David Hoppenbrouwers Date: Mon, 12 Jul 2021 16:13:01 +0200 Subject: [PATCH] Send temporary data once every 3 frames to reduce data usage. 100KiB (1Mbps) is too much for a mere 5 vehicles. 30KiB is more acceptable. --- gd/maps/the_pit/the_pit.gd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gd/maps/the_pit/the_pit.gd b/gd/maps/the_pit/the_pit.gd index 37fa148..fb3b09c 100644 --- a/gd/maps/the_pit/the_pit.gd +++ b/gd/maps/the_pit/the_pit.gd @@ -133,7 +133,11 @@ func _physics_process(delta: float) -> void: if v != null: var pt = v.create_packet() rpc("sync_permanent_vehicle_data", i, pt[0]); - rpc_unreliable("sync_temporary_vehicle_data", i, pt[1]); + # Send a packet every 3 frames (20 packets/sec) + temp_packet_counter += 1 + if temp_packet_counter >= 3: + rpc_unreliable("sync_temporary_vehicle_data", i, pt[1]); + temp_packet_counter = 0 # Process damage events if !server_mode: