FAQ

Have a question that is not listed here? Proceed to the community section to learn how to get in contact and ask your question.

When should I call ProcessRequests()?

It is recommend to call ProcessRequests() after or before all game systems update otherwise there is a potential of hooks modifying system data during an update.

How many requests can it process per frame?

By default, ProcessRequests() processes one request per frame. This can be configured by passing the number of requests to process in the method call. Example:

ProcessRequests(3);

What is the IsImmediate flag used for?

The IsImmediate flag is used to notify Bifrost to skip placing an incoming request onto the queue and process it directly on the Bifrost background thread. By default, the flag is set to false as majority of hook implementations require to be executed by a game thread to avoid threading errors.

Note that only hooks that are registered as IsImmediate may be called immediately otherwise a BifrostInfrastructureException is thrown.

Can I send events to a subset of connected clients?

Bifrost does not support sending events to specific clients. All clients will receive events.

Can multiple client connections impact responsiveness of the Bifrost server?

Since the server uses one queue to process requests for all clients, the server responsiveness is slower the more requests there are. For the C++ implementation, the server also uses one background thread and a shared queue to handle all responses. If a client is slow or unresponsive, it may affect the responsiveness for other clients. The C# implementation, however, uses a unique channel/queue per connected client to handle responses.

Bifrost server is failing to start. What could be wrong?

One reason is because the port may be in use already by another process. The following command can be used in powershell to verify if a port is in use by another process.

Get-Process -Id (Get-NetTCPConnection -LocalPort PORTNUMBER).OwningProcess

How to use a specific MSVC compiler version?

The most reliable way to force Visual Studio to compile with a specific MSVC version is to only have a single version installed.

If you have multiple MSVC toolsets installed and need to target a specific one, there’s a couple ways to try:

  1. Modify the Build.cs and specify the toolset version in GenerateCMakeArguments.

    For example to use 14.40.33807, you can add the arguments like this: yield return "-T version=\"14.40.33807\"";

  2. Set the VCToolsRedistVersion and VCToolsVersion environment variables before invoking Nuke. For example:

    $env:VCToolsRedistVersion=$env:VCToolsVersion="14.40.33807"
    .\build.cmd InstallCPP --cmake-configurations RelWithDebInfo
    

Common Issues

Have a question related to Protobuf? Proceed to the Bifrost 4.2 common issues section.

Redefined Macros

Several commonly redefined macros (new, max, min, etc.) are used within Bifrost and its libraries. The redefined macros may result in compiler errors like: Syntax error: 'key', type 'unknown-type' unexpected or not enough arguments for a function-like macro.

A simple fix to this issue is to temporarily undefined the redefinition within any of the impacted files from the Bifrost libraries.

#pragma push_macro("TheMacro")
#undef TheMacro
Impacted_Code
#pragma pop_macro("TheMacro")

Unexpected crash in destructor or in std::mutex::lock

The new MSVC tools changed the std::mutex constructor to a constexpr that causes issues in projects built with old tools. Until all machines are using the latest tools, the workaround is to define the following preprocessor macro:

_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR

Example stack traces for crash:

[2024.10.23-23.01.12:826][  0]LogYourGameTestTools: Starting Bifrost...
[2024.10.23-23.01.12:855][  0]LogCore: Error: Fatal error!

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000020

0x00007ff703237b02 YourGame.exe!FXboxCommonPlatformStackWalk::CaptureStackBackTrace []
0x00007ff7033c87c5 YourGame.exe!FGenericPlatformStackWalk::StackWalkAndDump []
0x00007ff703260ea0 YourGame.exe!ReportCrash []
0x00007ff7111ac226 YourGame.exe!WinMain$filt$0 []
0x00007ffd306eee10 VCRUNTIME140.dll!UnknownFunction []
0x00007ffd337d3eaf ntdll.dll!UnknownFunction []
0x00007ffd3374eae6 ntdll.dll!UnknownFunction []
0x00007ffd337d2e9e ntdll.dll!UnknownFunction []
0x00007ffd30663077 MSVCP140.dll!UnknownFunction []
0x00007ff70dce7f26 YourGame.exe!Microsoft::XboxStudios::Bifrost::Transport::BaseTcpTransport::~BaseTcpTransport []
0x00007ff70dce3c3a YourGame.exe!Microsoft::XboxStudios::Bifrost::ServerWithReferences<Microsoft::XboxStudios::Bifrost::Serializer::JSONSerializer,Microsoft::XboxStudios::Bifrost::Transport::Win_TcpTransport>::ServerWithReferences<Microsoft::XboxStudios::Bifrost::Serializer::JSONSerializer,Microsoft::XboxStudios::Bifrost::Transport::Win_TcpTransport> []
0x00007ff70dce487a YourGame.exe!Microsoft::XboxStudios::Bifrost::UnrealToolkit::BifrostHookService::BifrostHookService []
0x00007ff70dd0ea4a YourGame.exe!Microsoft::XboxStudios::Bifrost::UnrealToolkit::UnrealBifrostService<Microsoft::XboxStudios::YourGame::BleYourGameBifrostServer>::UnrealBifrostService<Microsoft::XboxStudios::Branston::BleBranstonBifrostServer> []
msvcp140!mtx_do_lock mutex.cpp:100 0x9Cforza_gaming_xbox_scarlett_x64_profile!Microsoft::XboxStudios::Bifrost::Transport::BaseTcpTransport::GetConnectedStreams BaseTcpTransport.cpp:110