xyz ive put the code in the main scene script
#main.gd
extends Control
@onready var udp_ping_server: ServerNode = $UdpPingServer
@onready var udp_ping_client: ClientNode = $UdpPingClient
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if udp_ping_client.udp.get_available_packet_count() > 0:
var ut = Time.get_unix_time_from_system()
var ms = Time.get_ticks_msec()
var packet_ms = udp_ping_client.udp.get_packet().get_string_from_utf8().to_int()
var fps = Engine.get_frames_per_second()
var latency = ms - packet_ms
var engine_time = 1000 / fps
var real_latency = latency - engine_time
#print("tick: %s ms" % ms)
print("latency: %s ms" % latency)
#print("latency: %s ms" % real_latency)
pass
wich is at the top of the tree and the latency now is doubled.
usually it was bellow 20ms now its 34ms.
Also, i have tested this with client/server apps wich is why i created this example to prove that this is a problem. I have other app that ran as server and client on different machines. Latency times were exactly the same, didnt matter wether im doing this on the same app or different machines.
for context this is what devs said on this https://github.com/godotengine/godot/issues/93805
EDIT:
Tried switching nodes around, didnt help either
