Bringing Custom Crash Responses to Unreal Engine

Bringing Custom Crash Responses to Unreal Engine
Show a customized, crash-specific message when your game crashes.
Locked in an intense battle, hanging on for dear life, on the verge of nigh-impossible victory and then… boom! Positively, absolutely, unquestionably, no one wants a crash to interrupt their favorite game. Crashes are a frustrating yet inevitable part of gaming, and the only thing worse than being on the receiving end of a crash is being on the receiving end of the same crash repeatedly.
Crashes happen. When they do, developers need to put themselves in the shoes of the person playing their game. Would you want to scroll through forums with half-broken searches, check every Discord channel, read various spell books, and recite magic incantations until you found a fix for your crash? Definitely not. With communication channels more fragmented than ever, how the heck are users supposed to find the information they need to fix their crash?
Here’s an idea: why not tell your users how to fix their issue right when the crash occurs? Perhaps a fix isn’t available yet, but maybe your team is aware of the problem and working on a solution? Or, at the very least, let the user know that the issue has been recorded and the team will review it soon? Guess what? BugSplat partnered with the PAYDAY 3 team and built a solution for Unreal Engine that enables developers to communicate with their users right when a crash occurs.
In this article, we’ll show you how Hugo Nedelec and Starbreeze Entertainment tweaked Unreal Engine’s CrashReportClient to leverage BugSplat’s Support Response feature and display crash-specific messages in PAYDAY 3. The changes to PAYDAY’s CrashReportClient mentioned in this article have not been released yet, but are expected to go live in a future update.
Create Group Rules
When dealing with hundreds, thousands, or even millions of crashes, it is essential to divide like crashes into groups that share the same underlying root cause. By sorting crashes by their root cause, developers can quickly identify the crashes that occur most frequently and/or affect the most significant number of users. Within BugSplat, groups of crashes can be created automatically by specifying Grouping Rules.
Adding rules to ignore common code when creating crash groups allows Unreal developers to create tailored support responses that accurately target specific crashes. Creating ignore and group by rules allows for finer-grained control over the groups BugSplat creates by skipping uninteresting call stack frames, like KERNELBASE!RaiseException
and FDebug::EnsureFailed
. After creating grouping rules, you can reprocess your crashes to apply the new rules.

To create some automated grouping rules, navigate to the Grouping page. Once a good list of grouping rules has been established, developers who use BugSplat can configure a group-specific support response page. Crashes belonging to groups that haven’t defined a group-specific support response will display a default (fallback) support response page.
Before configuring a group-specific support response, please review our Grouping Crashes documentation. It is also worth investigating which Grouping Options are most suitable for your organization. If you find that unrelated items from the same function are being grouped, consider enabling the “Include Line Number” option to create more targeted groups.
Configure the Support Response Page
Once you’ve configured grouping rules, navigate to the Dashboard page to see a pie chart of the groups that occurred most frequently over the selected time frame.

Alternatively, you can navigate to the Summary page and sort by 'Users Affected' to prioritize crashes that affected the largest number of users.

Click the Stack Group column link to go to the Stack Group page. On the Stack Group page, click the Support Response button.

The page you’re presented with is a group-specific support response. To edit the fallback support response, click the Edit Default Response button. You can also set a logo to display alongside the support response message by clicking the Update Company Logo button.
BugSplat can also create key-specific support responses. The value you use for a key is arbitrary. One example use case for the key field is to use a country locale code (e.g. de-DE), and configure localized support responses per locale code. Use the markdown editor to configure your support response page.
When you’re done, click Save to create your message and update the preview.
BugSplat Support Response
Modify Unreal Engine
ℹ️ The diffs in the following section are condensed to better fit the article format. If you’d like to view the full set of changes to Unreal Engine 5.5.3 the diff is available here.
The final step is to modify CrashReportClient to display the contents of the URL returned when the crash is uploaded to BugSplat. Modifications to support viewing the BugSplat support response require a source build of Unreal Engine.
The first step required to display a support response is to include WebBrowser in CrashReportClient’s PrivateDependencyModuleNames list.
Engine/Source/Programs/CrashReportClient/CrashReportClient.build.cs
In newer versions of Unreal, we need to initialize the WebBrowserModule; otherwise, the SWebBrowser control will not load our support response page. We’ll also make a minor adjustment that keeps the program open after the send button is clicked.
Engine/Source/Programs/CrashReportClient/CrashReportClient.build.cs
Next, define properties to control the visibility of various elements in the CrashReportClient dialog. Also include SWebBrowser.h and define a reference to the BrowserWidget.
Engine/Source/Programs/CrashReportClient/Private/SCrashReportClient.h
Once the crash report is uploaded, BugSplat will return a URL that points to the corresponding support response. We’ll register a lambda function that gets called with the BugSplat support URL and updates the browser widget. After registering our lambda, we will implement the various visibility controls we defined in the previous step. We’ll also modify the Slate definition for CrashReportClient to remove the existing Send and Close/Restart buttons and add a new Send button that waits for the support response URL to be returned.
Engine/Source/Programs/CrashReportClient/Private/SCrashReportClient.cpp
We’ll also need to declare a delegate so the crash dialog can register to load the support response when it becomes available. The following snippet will also define some properties to control the state of the crash dialog.
Engine/Source/Programs/CrashReportClient/Private/CrashReportClient.h
After declaring the delegate and defining some of the dialog control properties, add the corresponding implementations for controlling when the loading throbber is visible, the ability to show the submit button and send the crash report, and broadcasting when the support response is available for display.
Engine/Source/Programs/CrashReportClient/Private/CrashReportClient.cpp
Define fields and properties we’ll use in the next step to process the response data from the crash upload.
Engine/Source/Programs/CrashReportClient/Private/CrashUpload.h
We’re almost ready to display the support response! First, we will modify the upload URL to pass Unreal’s PCallStackHash, allowing BugSplat to return support responses more quickly for crashes that have already been processed. Next, we’ll add our timeout to the crash upload request. We also need to parse the response from BugSplat and extract the infoUrl property from the response’s JSON body.
Engine/Source/Programs/CrashReportClient/Private/CrashUpload.cpp
Testing Your Changes
Build and run your game and generate a crash report. If you did everything correctly, you should see something that resembles the following.
Unreal Engine with BugSplat Support Response
Special Thanks
We want to take a moment to thank Hugo Nadelec and Starbreeze Entertainment. Most of the Unreal Engine code in this article was Hugo’s work, and he was kind enough to share it with us.