Direct. X game development with C++ in Visual Studio. Leverage the full power of C++ to build high- end games powered by Direct. X to run on a variety of devices in the Windows family, including desktops, tablets, and phones. In this blog post we will dive into Direct. X development with C++ in Visual Studio. First we’ll look at how to acquire the tools needed for Direct. X desktop and Universal Windows Platform (UWP) development, then we will get started with a built- in project template, followed by writing C++ code and HLSL (High Level Shader Language) shaders for the Direct. X game. Next we will use the world- class Visual Studio debugger and the Visual Studio Direct. X graphics debugger and profiler to catch and fix issues in the code. Finally, we will talk about how to test your Direct. X game and collaborate with your team members using Visual Studio. Install Visual Studio for Direct. X development. First, download Visual Studio 2. Visual Studio installer. To build Direct. X desktop games, choose the “Game development with C++” workload under the “Mobile & Gaming” category. This workload gives you the core tools to build Direct. X games for desktop, which includes the Visual Studio core editor, Visual C++ compiler, Windows Universal C Runtime, and Visual Studio debugger. The pre- selected components are highly recommended. Here are the two recommended components and the rest of the optional components that are useful for building Direct. X games: C++ profiling tools: includes Graphics Diagnostics for Direct. X (a. k. a. Visual Studio graphics debugger) and a set of profiling tools for memory, CPU and GPU. Selected by default. Windows 1. 0 SDKs: The latest Windows 1. SDK is selected by default. Windows 8. 1 SDK and UCRT (Universal C Runtime) SDKIncredi. Build: installs Incredi. Build from incredibuild. Cocos: installs Cocos Creator from cocos. Cocos. 2d games. Unreal Engine installer: installs Epic Games Launcher from unrealengine. Team Development with Visual Studio Team Foundation Server patterns & practices J.D. Meier Jason Taylor Alex Mackman Prashant Bansode Kevin Jones. Unreal Engine. If you’re also interested in building Direct. X games for UWP to run on a variety of devices in the Windows family, you can install the tools by checking the “Universal Windows Platform development” workload under the “Windows” category with the “C++ Universal Windows Platform tools” option selected. The C++ UWP component adds the core C++ UWP support and 3 Direct. X project templates for Direct. X1. 1 and Direct. Intro to the Eclipse plugin available for Visual Studio Team Services. Purchased Visual Studio subscriptions. Visual Studio subscriptions offered through the Microsoft Partner Network. Internal or external development and testing. Visual Studio Team Services is a cloud-based solution for developers with everything from hosted-code repositories and issue-tracking to load-testing and automated. Visual Studio is a suite of component-based development tools and other technologies for building powerful, high-performance applications. In addition, Visual Studio. X1. 2 to get you started quickly. The “Graphics debugger and GPU profiler” component is highly recommended for Direct. X development, as it brings in the Graphics Diagnostics feature for Direct. X graphics debugging and GPU Usage feature for profiling GPU and CPU usage in Direct. X games. Getting started. Direct. X game for UWPThe UWP workload comes with 3 Direct. X project templates. Use the menu item New- > Project to launch the New Project dialog and then type “Direct. X” in the search box in the upper right corner to find the project templates for Direct. X: Direct. X1. 1 App, Direct. X1. 2 App, Direct. X1. 1 and XAML App. Select one template and click OK. After the project is created, you’re all set to run the Direct. X app right away by pressing F5 or clicking Debug- > Start with debugging from the menu. You should see a colored 3. D cube spinning on your screen. Direct. X game for desktop. To build a Direct. X desktop app, you can start with the Win. Project template in the New Project dialog, or download a Win. Direct. X1. 1 samples or Direct. X1. 2 samples as a starting point. Write C++ code with the full power of the Visual Studio IDENow we have a basic 3. D app running, it’s time to add game logic in C++. Use the full power of Visual Studio productivity features, including Intelli. Sense and code navigation, to write your game code in C++. Member list and Quick Info, as shown in the following screenshot, are just two examples of the Intelli. Sense features Visual Studio offers to make code writing easier and faster. Member list shows you a list of valid members from a type or namespace. Typing in “- > ” following an object instance in the C++ code will display a list of members, and you can insert the selected member into your code by pressing TAB, or by typing a space or a period. Quick Info displays the complete declaration for any identifier in your code. In the following screenshot, Visual Studio is showing the list of members of an instance of the DX: :Device. Resources object and the declaration of the Get. Back. Buffer. Renderer. Target. View method, making writing Direct. X code a lot easier. Refactoring, Auto- complete, squiggles, reference highlighting, syntax colorization, code snippets are some of the other useful productivity features to be of great assistance in code writing and editing. Navigating in large codebases and jumping between multiple code files can be a tiring task. Visual Studio offers many great code navigation features, including Go To Definition, Go To Line/Symbols/Members/Types, Find All References, View. Call Hierarchy, Object Browser, and many more, to boost your productivity. The Peek Definition feature, as shown in the following screenshot, brings the definition to the current code file, allows viewing and editing code without switching away from the code that you’re writing. You can find Peek Definition by opening the context menu on right click or shortcut Alt+F1. In the example in the screenshot, Visual Studio brings in the definition of the Create. Input. Layout method that lives in the d. Direct. X code more efficiently. Write and debug shaders. Besides C++ code, writing shader code is another big part of building Direct. X games. The Visual Studio shader editor recognizes HLSL, FX, and other types of shader files, and provides syntax highlighting and braces auto- completion, making it easier to read and write shader code. Debugging shader code from a captured frame is another great way to pinpoint the source of rendering problems. Simply set a breakpoint in your shader code and press F5 to debug it. You can inspect variables and expressions in Locals and Autos windows. Learn more about the HLSL Shader Debugger. Debug C++ code with the world- class Visual Studio debugger. Troubleshooting issues in the code can be time- consuming. Use the Visual Studio debugger to help find and fix issues faster. Set breakpoints in your C++ code and press F5 to launch the debugger. When the breakpoint is hit, you can watch the value of variables and complex expressions in the Autos and Watch windows as well as in the data tips on mouse hover, view the call stack in the Call Stack window, and step in and step out of the functions easily. In the example in the screenshot below, the Autos window is showing us the data in the constant buffer and the value of each member of the device resource object instance, making stepping through Direct. X code easy and efficient. But that is not all what the Visual Studio debugger can do. For example, the Edit and Continue capability allows you to edit your C++ code during a debugging session and see the impact right away without having to rebuild the application, saving a huge amount of development time. You can find more details in this blog post C++ Debugging and Diagnostics. Visual Studio Graphics Diagnostics. Debugging rendering issues. Rendering problems can be very tricky to troubleshoot. Whether it’s a position offset, color incorrectness, or a flickering problem, Visual Studio Graphics Diagnostics, a. You can inspect each Direct. X event, graphics object, pixel history, and the graphics pipeline to understand exactly what occurred during the frame. This tool also captures call stacks for each graphics event, making it easy to navigate back to your C++ code in Visual Studio. Learn more about Visual Studio Graphics Diagnostics. Analyze frame performance. If you are looking for ways to increase the frame rate for your Direct. X games, Visual Studio Frame Analysis can be very helpful. It analyzes captured frames to look for expensive draw calls and performs experiments on them to explore performance optimization opportunities for you. The results are presented in a useful report, which you can save and inspect later or share with your team members. For more information on how to use this tool, see blog post Visual Studio Graphics Frame Analysis in action! Analyze GPU Usage. While the Frame Analysis tool can help pinpoint the expensive draw calls, understanding how your game performs on the CPU and the GPU in real- time is essential as well. The Visual Studio GPU Usage tool collects CPU and GPU performance data in real- time, and it complements Frame Analysis that is performed on captured frames in an offline fashion to provide you a complete view of your game performance. By reading the GPU usage detailed report, you can easily identify where the performance bottleneck is, whether it’s on the CPU or the GPU, and help you locate the potential problematic code in the app. This GPU Usage tool in Visual Studio blog post includes a more detailed introduction to the tool. Unit testing. Shipping high- quality games requires good testing. Visual Studio ships with a native C++ unit test framework that you can use to write your unit tests. Add a new unit test project to your solution by clicking on menu New- > Project and selecting the Native Unit Test Project template. This automatically adds a test project to your solution. In the created unittest. TEST. You can then open the Test Explorer window by clicking on menu Test- > Window- > Test Explorer to run your tests. Also, take advantage of the built- in code coverage tool (menu Test- > Analyze Code Coverage) to understand how much of your code has been covered by your unit tests. This gives you confidence in shipping high- quality games. Collaborate with your team members. Building a great game usually involves more than one developer. When it comes to source code storing and sharing and cloud build, Visual Studio Team Services has you covered.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |