In this lesson, you will learn how to use the Unreal Insights tool to visualize RPC packet flow and identify latency bottlenecks in your networked gameplay.
Visualizing Network Streams
While you have used Network Profiler in the past to track variable replication, Unreal Insights provides a more granular, timeline-based view of your packet throughput. By launching your game with the -trace=net command-line argument, the engine records every packet sent and received, categorizing them by RPC types, replicated properties, and connection state.
Once you open the .utrace file in the Unreal Insights browser, focus your attention on the Networking track. Here, you can see specific packets mapped against your frame time. If you notice a "spike" in packet size or a delay between a Server RPC invocation and its execution on the client, you are likely hitting a bottleneck in your bandwidth or processing queue.
Analyzing RPC Bottlenecks
To verify your implementation, look for the RPCs sub-track within the Networking view. This allows you to select specific RPC calls. If you observe that your ServerRPC_PerformAction is consistently occurring across multiple frames or experiencing "jitter" in arrival time, investigate these three common causes:
- Reliability Overflow: You may be sending too many
ReliableRPCs, forcing the network buffer to wait for acknowledgement, which introduces latency. - Frequency Saturation: If you are calling a
MulticastRPC every tick, Insights will show a massive cluster of packets that exceeds yourNetUpdateFrequency. - Packet Fragmentation: Use the Packet Size view to ensure your RPC calls aren't forcing the engine to split data across multiple packets, which increases overhead.
For instance, if you have a combat system using:
// If this is triggered by every frame of an animation,
// Insights will show a "Reliable RPC" spike on your timeline.
UFUNCTION(Server, Reliable, WithValidation)
void Server_Attack();
Insights will highlight the exact point where these calls clog the network buffer, allowing you to decide if you should switch to Unreliable or throttle the frequency.
Key Takeaway: Unreal Insights turns abstract network performance into a visual timeline, enabling you to pinpoint which specific RPCs are saturating your bandwidth or causing unacceptable latency.