Unleashing the Power of Visual Studio 2022 for C++ Game Development

David Li

screenshot of gears 5 with unreal engine and visual studio logos

In Visual Studio 2022 v17.7, we are excited to bring you a multitude of performance tune-ups, productivity enhancements, and Unreal Engine integrations for C++ game development. In this blog post, you will learn how to take advantage of these new improvements whether you use Unreal Engine or a proprietary game engine. Not a game developer? See how these features can also benefit your C++ projects.

At Visual Studio, we are dedicated to understanding the unique challenges faced by AAA game developers. We recognize that AAA game developers work with large and complex C++ codebases, which often come with special requirements and constraints. Through working closely with world-class game developers, including The Coalition for our new “Find All Blueprint References” feature, we’ve learned firsthand the various productivity challenges working with these codebases may bring. These productivity and performance improvements for large codebases will also benefit you if you are a general C++ developer.

The latest release, Visual Studio 2022 17.7, is the culmination of all our efforts in the past year. In the latest version of Visual Studio, you now have a serious collection of tools at your disposal. For IDE performance, we have sped up the amount of time it takes when you load or close your solution, and up to 21% faster F5 performance for Unreal Engine projects. For Unreal Engine integrations, we previously introduced capabilities to see Blueprint references and stream your UE Logs in the IDE. Now, you can work with Blueprints more efficiently with the new Find All Blueprint References feature. Building on top of our Code Analysis via the Unreal Header Tool, we have added the ability to check your code for Unreal Engine Naming Convention conformance. Lastly, Build Insights integration and #include cleanup, tools to fine tune your builds, are now available.

New in Visual Studio 2022

Here are some of the major areas we’ve focused on in this release:

Area Enhancements
Performance
Unreal Engine Integration
C++ Productivity
Optimizing C++ Build Times

Collaborating with The Coalition

“It’s awesome to be able to partner and collaborate with the Visual Studio team on features such as ‘Find All Blueprint References’ as it brings great value not only to our development team but anyone using the Unreal Engine. Additions like this show that the Visual Studio team not only listen to the gaming community but are also actively working to make iteration in engines like Unreal better than ever.”

– Phil Cousins, Tech Director, The Coalition

Visual Studio Toolbox Live

Check out these features in action on the latest episode of Visual Studio Toolbox Live.

Performance Boosts for C++ Game Development & Large Codebases

Last year, we shared Visual Studio 2022 Performance: Faster C++ Source Code Indexing. Since then, the team has continued to work on additional performance improvements for large C++ projects. We have significantly sped-up Solution Load and Solution Close scenarios. In addition, the time it takes to parse C++ solutions for the first time is also greatly reduced. Lastly, we made further improvements for the time it takes to get to your code. While these improvements are significant for large projects, you should still notice a speedup if your project is smaller in nature. For more information, please see Visual Studio 2022 – 17.6 Performance Enhancements.

Results

A bar chart showing VS performing faster in C++ Solution parse, and solution load
When Parsing C++ solutions for the first time, you will see the task complete 3.2x faster. There are also improvements when loading a solution for the first (cold) time, and subsequent times (warm).

A bar graph showing VS performing faster for solution close, colorization and search
For both closing the solution for the first (cold) time, and subsequent times (warm), you will see Visual Studio complete the task 1.9X and 2.2X faster, respectively.

Testing Methodology

We used a real-world AAA Unreal Engine 5 game to benchmark the performance improvements in Visual Studio 2022. We measured the scenarios by capturing internal logs. The graphs above illustrate the improvements over the course of one year, from version 17.2 in May 2022 to version 17.6 in May 2023. To replicate real-world game developer workflows, we used a gaming PC with high RAM and core count.

Impact Analysis

Our biggest performance improvement is a 3.2x speed-up in Visual Studio’s parsing of C++ projects during the first run. We received valuable feedback from game developers on how to enhance this area, and we’re eager to hear how much more productive you’ll be when opening projects for the first time.

Next, thanks to community and game developer feedback, we allocated additional resources to focus on the Solution Load and Close scenarios. We heard that these are important workflow scenarios, especially from those who may open and close solutions multiple times a day. While the numerical reduction is a few seconds, we hope that this improvement will further improve productivity and reduce mental task switching throughout the day.

Lastly, we have made additional performance improvements to colorization and search on top of previous improvements. Please stay tuned as we continue to make investments in the performance of Visual Studio in these areas.

Using Unreal Engine Integrations

Unreal Engine integrations will only show up when you are working on an Unreal Engine project. To ensure these features are active, double check that the “IDE support for Unreal Engine” component is enabled in the “Game development for C++” workload in the VS Installer. For more information, please see Install Visual Studio Tools for Unreal Engine.

A screencap of the Visual Studio installer. Game development with C++ workload is open, with IDE support for Unreal Engine selected

Unreal Engine Blueprint Find All References

Get ready to level up your Blueprints workflow! Available now, you can easily search for UFUNCTION references from within Visual Studio. Start by right clicking on the symbol and click “Find All Blueprint References”.

A picture of the context menu when right clicking on a blueprint reference. the option "Find All Blueprint References" is highlighted

After the search is completed, you will be able to view the references of UFUNCTIONs and perform filtering or grouping actions.

Image uebpfar example

The latest version of our Unreal Engine plugin “Visual Studio Integration Tool” from the Unreal Engine Marketplace or GitHub is required.

Code Analysis for Unreal Engine: Naming Convention Checker

Visual Studio will now help you keep your code conformant to the Unreal Engine Naming Convention. By adding a .editorconfig file to your project at the solution root level, you will receive real-time hints in the Error List window when your symbols do not match the UE naming convention. In addition, Quick Fixes are available at your fingertips for an easy resolution.

A quick fix showing ue naming convention suggestion

While this results from Unreal Engine developer feedback, the feature is not specific to Unreal Engine. You can customize your own .editorconfig file for Visual Studio for your general C++ project. More documentation will come at a later date, please use the UE .editorconfig as a starting point for now.

Image ue naming settings

This feature is on by default. To change whether Visual Studio should treat the checks as Warnings or Suggestions, go to Tools > Options > Text Editor > C/C++ > Code Style > Linter and change “Naming Convention (experimental)”.

Special Macro Indentation Rules for Unreal Engine

We’ve listened to your feedback and added special indentation rules for UE Macros and Slate Declarative syntax. Visual Studio will now apply formatting rules in your Unreal Engine Projects.

An example of proper UE style indentation in VS

This feature is on by default. To verify Unreal Engine specific formatting is enabled, search “Unreal Engine” in Options or go to Tools -> Options -> Text Editor -> C/C++ -> Code Style -> Formatting -> Unreal Engine and check “Apply special formatting for Slate declarative syntax and Unreal Engine reflection macros.”

Visual Studio will properly indent code on lines after reflection macros and use special rules for the Slate declarative syntax.

Enhanced C++ Productivity Features

In Visual Studio 2022 17.7, we have also added C++ productivity features that will empower all C++ developers.

Improved Doxygen Comments Support

Due to your feedback, we have added additional support for Doxygen Comments that exposes descriptions that are shared for all overloads of a function. When hovering over an overloaded function, you will now see Quick Info display descriptions written in the Doxygen Comment. This feature is especially helpful for you in Unreal Engine development where you may encounter many of these overloaded functions. To learn more, please visit our Improved Doxygen Overload Resolution.

A snippet of UE code with doxygen comments
The cope snippet above shows an overloaded function with Doxygen comments.

A quick info tooltip in VS prior to the new feature. It does not show shared descriptions
[Before] Prior to this feature, Visual Studio does not show shared descriptions for overloaded functions.
A quick info tooltip in VS that shows shared descriptions in overloaded functions
[After] With the new Doxygen improvements, Visual Studio will now show shared descriptions on all overloaded functions.

Visualize Macro Expansion

In previous versions of Visual Studio, we have added the ability to expand and copy expanded C++ macros. Thanks to your feedback, you can now visualize your macros step by step.

When you hover over any C++ macro in Visual Studio 2022 17.0, you are presented with a new option “Visualize Expansion” that enables you to see the preprocessor passes of the expansion.

A quick info tip of a UE macro, there is a new option Visualize Macro Expansion

After clicking the option, Visual Studio will open a new window with the first step of the expansion. By clicking the arrows, you can navigate each step of the expansion.

The window that allows you to expand macros step by step

For more information on how this feature works, please see Visual Macro Expansion for C++.

Optimizing Build Times in Visual Studio

Over the years, we constantly hear from C++ developers wanting more tools to improve their build iteration time. This is especially true for C++ game developers as games continue to grow bigger and more complex. In Visual Studio 2022, we are introducing two new features that will empower you to improve your build times. New in Visual Studio 2022, Build Insights Integration and #include Cleanup will give you the information you need to optimize your build.

#include Cleanup

This feature has been causing crashes for some users, so it has been disabled in 17.7.3. We hope to fix these issues and re-enable it in 17.8.

Thanks to your feedback, you can now use #include cleanup to remove unused headers, add direct headers, and help you maintain clean code. To maximize the use of #include cleanup, we recommend first using the direct include suggestions, then the unused include suggestions.

By default, #include cleanup is disabled, but you can enable it by navigating to Tools > Options > Text Editor > C/C++ > IntelliSense and selecting “Enable #include cleanup.” Once enabled, you have the flexibility to adjust the settings and configure different levels to meet your specific needs and preferences.

A screenshot of the tools options window. Search for code cleanup to enable #include cleanup

For detailed information on how to fully utilize the new #include clean up tool, please see #include cleanup in Visual Studio.

Build Insights Integration

We are thrilled to announce that Build Insights is now seamlessly integrated. Build Insights provides you with valuable information needed when optimizing your C++ build times. Try it today with your C++ project!

Context menu "Build" that has options to launch Build Insights

Start your Build Insights trace capture with the click of a button for your C++ project, or selected projects.

An example of a build insights report

After compilation, Build Insights will generate a diagnostic report that enables you to identify costly includes and provides you with an option to navigate directly to header files.

The bottom corner of the build insights report has a WPA button that will allow you to open your trace in Windows Performance Analyzer

For power users, you can open Windows Performance Analyzer (WPA) from within the report.

We are working hard to continually improve Build Insights Integration. What you see today is only the beginning! For more information, please see Build Insights Now Available in Visual Studio 2022.

Share your feedback and stay connected with Visual Studio!

We appreciate the time you’ve spent reporting issues/suggestions and hope you continue to give us feedback when using Visual Studio on what you like and what we can improve. Your feedback is critical to help us make Visual Studio the best tool it can be! You can share feedback with us via Developer Community: report any bugs or issues via report a problem and share your suggestions for new features or improvements to existing ones.

Stay connected with the Visual Studio team by following us on YouTube, Twitter, LinkedIn, Twitch and on Microsoft Learn.

On behalf of the whole Visual Studio team, thanks for reading and Happy Coding!

2 comments

Discussion is closed. Login to edit/delete existing comments.

  • msaqib farooqi 0

    a nice development, but the welcome page is not showing in the visual studio 2022 community addition.

  • Caleb Murphy 0

    it is a game-changer for C++ game development, but I like to create unity webgl browser games

Feedback usabilla icon