Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: What would be the best way to write a "pop_statistic" to a nakama relay server? #211

Open
racs4 opened this issue Jul 23, 2024 · 1 comment

Comments

@racs4
Copy link

racs4 commented Jul 23, 2024

If you're using godot multiplayer the "standard" way, you will use a ENetMultiplayerPeer in an ENetConnection. With this you can create

func get_received_data():
	var enet_connection = multiplayer.multiplayer_peer.host
	var data_received = enet_connection.pop_statistic(ENetConnection.HOST_TOTAL_RECEIVED_DATA)
	return data_received

func get_sent_data():
	var enet_connection = multiplayer.multiplayer_peer.host
	var data_sent = enet_connection.pop_statistic(ENetConnection.HOST_TOTAL_SENT_DATA)
	return data_sent

and add on the _ready of your main you can write:

func _ready():
        Performance.add_custom_monitor("Network/Received Data", get_received_data)
        Performance.add_custom_monitor("Network/Sent Data", get_sent_data)

to get received and sent bandwidth on the debugger profiler.

What would be the correct/best way to get something like this using NakamaMultiplayerBridge. On multiplayer.multiplayer_peer I have a NakamaMultiplayerPeer which has a Packet class inside of it. Getting the size of the last packet generated would be enough? (Maybe all that I'm writing here is bullshit - I'm new in game dev - , but if it is please let me know)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant