[VERSION 2.0.0] Packet Profiler - easily measure all of your remotes!

Packet Profiler

by Pyseph
image

Get the plugin here

Get the in-game profiler here


Table of Contents

Introduction

Packet Profiler is a plugin which allows you to accurately read remote data sent by different contexts. Unlike the vague and uninformative Stats windows which only show the current KB/s receive and send rates, this plugin allows you to accurately see packet data each frame, along with precise byte size information.

Functionality

Packet Profiler was made with design slightly similar to the MicroProfiler, which is Roblox’s performance debugging tool. You can pause the profiler either by manually clicking the button, or selecting any frame.
When left-clicking a frame, the contents of that frame will be shown in the Packet Chart window, in the form of a pie chart along with columns of data to the right:
image

You can open up each column and see the exact remote data which was sent. The data shows how much bytes each field takes so that you can more easily determine what takes up most size.

Since data sizes vary for different games, you can adjust the scale of each frame through the KB scale on the topbar, like so:

In-game Profiling

Sometimes, simply profiling in studio may not be enough. As such, you can use this plugin in-game! Simply grab the latest release .rbxm file and place it inside StarterPlayerScripts. You can then open the UI through Ctrl + F5, and pause/unpause through Ctrl + P.
https://github.com/PysephWasntAvailable/PacketProfiler/releases/

Alternatively, you can install the in-game profiler through Wally:
https://wally.run/package/pysephwasntavailable/packetprofiler

For ease of use, you can resize the in-game plugin just the same:

Support for remote compression libraries

Remote compression libraries have become very popular – one of their hallmark features being the compression of multiple remote calls into one. By default this would make the remote data harder to read, as multiple remotes are displayed in one. As such, packet profiler allows the libraries to provide the packet profiler with the decompressed remote names and packet data.

To do so, add a ModuleScript named RemoteName.profiler anywhere in ReplicatedStorage. Its return must be a function, with the return type of { { Name: string, Arguments: {any} } }?. The ModuleScript is called by the packet profiler, and receives the remote object as its first argument, and the first argument sent from the remote as the second.
WARNING: The ModuleScript is called for all remotes – if the remote is not from your compression library, you should disregard all the data and simply return nil.


Plugin Link: https://www.roblox.com/library/10332340067/PacketProfiler

GitHub Link: GitHub - Pyseph/PacketProfiler: Remote packet analyzer tool for Roblox

168 Likes

UPDATE: Thanks to further black-box testing and packet sniffing, the majority of the most used data types should be almost perfectly accurate for how they’re calculated. I cannot provide a guarantee that it’s perfect, but it’s pretty darn close! :slightly_smiling_face:

## PSA
This plugin wasn’t made with the notion of being able to calculate the packet sizes down to every byte. Roblox doesn’t offer any way to measure incoming packets, and so the only way to find out how large they are is by manually calculating the size based on input data.
There’s some incorrectness towards how some data types such as strings are calculated, but it becomes hard to fully replicate undocumented behavior.

Roblox pls document packet encoding behavior or give APIs to measure packets

9 Likes

What a great tool you have made here!!!

3 Likes

This is really cool! I’m not the best using debuggers but I understand their power and for someone who cares that much about network usage as me this can be pretty useful. Clearly a much cooler way of viewing network traffic other than using the Stats or CTRL + F7.

I’ll also check the source code, I always wondered how I could do so to track the data that remotes use in my game, this may open my eyes.

Edit: Actually looked up at the source code and to be honest, the way in which you get the packet info seems pretty intuitive, but I never thought about it hehe. Also, thank you for those useful links to documentation about datatypes.

3 Likes

v1.0.1

  • Added asserts to make sure RemoteName.profiler module returns a function
  • Fixed pie chart scrolling frame’s canvas size being larger than the amount of items
  • You can now click on the columns next to the pie chart and see the raw remote data which was sent
    image
6 Likes

Yoink! Downloading this right now.

2 Likes

v1.0.2

  • Added syntax highlighting to packet data shown in the packet chart
    image
  • Renamed TableToString.lua to more fitting TableToSyntaxString.lua
3 Likes

v1.0.3

  • Added byte size counts for individual elements, E.g number → 10 bytes
  • Added UI padding to data elements in pie chart
  • Improved pie chart visual UI

image

4 Likes

v.1.0.4..v1.0.7

  • Fixed right-side padding of packet data in pie chart
  • Enabled clipping bounds for packet data in pie chart
  • Pie chart and tooltip now show 3 decimal places in KB instead of 2
  • added 100 byte and 10 byte scale options
  • Server context ignores first argument (Player)
  • Pie chart uses different units based on packet size
  • Remote connections are now only instantiated when you open the profiler, as to prevent the plugin from taking priority from other remote connections
  • Fixed first packet argument not being logged properly
  • Fixed an issue where byte size was incorrectly calculated when ran on server context
1 Like

This is an absolutely phenomenal plugin! Great job!

3 Likes

v1.0.8

  • Updated booleans to take 2 bytes to pass through remotes instead of 1
  • Updated Faces and Axes to take 6 bytes to pass through remotes instead of 1
  • If remote data is over the max rich-text character limit, font colors are removed
  • Remote data fields now use scrolling frames to allow scrolling through long packets
  • Changed chart item separator to be same size as remote data
4 Likes

v1.1.0

  • Added support for in-game profiling. A separate section has been added for this in the original post!
  • Moved Running indicator towards the rightmost side of the profiler bar to allow clicking without interfering with CoreGui menu UI
  • Fixed Running indicator’s Y-axis size being 0
3 Likes

v1.2.0

  • Added Wally support
  • Reorganized file structure to separate plugin, studio and in-game workflows
  • Added installation methods for the plugin on the GitHub repository page
2 Likes

I am attempting to use this in-game and it spits out an error:

Not quite sure what I did wrong. I followed the steps under “In-game profiling”

2 Likes

I’ll look into it. Thanks for the report!

2 Likes

I’ve updated the releases page with a newer version. Could you update your code and confirm that it works?

2 Likes

This is extremely great, I love it.

Is there a way to see other stuff perhaps like Instance replication? I suspect that might be very complicated, maybe impossible, but it would be nice to have.

2 Likes

Roblox does not provide any APIs to listen to packets sent by non-remotes - only way to do so would be through packet sniffers, which directly intercept remotes sent to-and-fro the Roblox client.
The only in-house way to do so currently is through the Stats window, which has a Network tab.

2 Likes

I downloaded v1.2.0 from the releases page, and I’m getting the same error as before.

2 Likes

Could you try this version and see if it works for you?
releasebuild.rbxm (100.0 KB)