Skip to content

Commit

Permalink
Send temporary data once every 3 frames to reduce data usage.
Browse files Browse the repository at this point in the history
100KiB (1Mbps) is too much for a mere 5 vehicles. 30KiB is more
acceptable.
  • Loading branch information
Demindiro committed Jul 12, 2021
1 parent 470cddd commit 4f570e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gd/maps/the_pit/the_pit.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4f570e3

Please sign in to comment.