Unleashing the Power of Visual Studio 2022 for C++ Game Development
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:
|Unreal Engine Integration
|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.
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.
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.
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”.
After the search is completed, you will be able to view the references of UFUNCTIONs and perform filtering or grouping actions.
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.
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.
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.
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.
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.
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.
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.
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.
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!
Start your Build Insights trace capture with the click of a button for your C++ project, or selected projects.
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.
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.
On behalf of the whole Visual Studio team, thanks for reading and Happy Coding!