sample-game title and building it for XBOX Series X|S consoles. You then deploy the complete game to an XBOX dev kit, diagnose startup failures, and create an installable XVC.
The completed sample uses C++, Direct3D 12, and the GDK with XBOX Extensions (GDKX). It also uses DirectXTK12 as an optional rendering helper. Both paddles are computer controlled so the game can run unattended while you iterate on graphics, gameplay, and effects.
What you’ll build
By the end of this walkthrough, you’ll have:- A native XBOX GDK project (not a UWP project).
- Debug, Profile, and Release configurations for XBOX Series X|S consoles and XBOX One family consoles.
- An autoplay sample game with scoring, predictive paddle AI, particle effects, a motion trail, and a textured circular puck.
- A complete loose-file deployment running on an XBOX dev kit.
- An optional Store-associated XVC that can be installed and tested on the dev kit.
Before you begin
This walkthrough was validated with:- Visual Studio 2022 Enterprise 17.14.
- April 2026 Update 2 GDKX, edition
260402. Gaming.XBOX.Scarlett.x64for XBOX Series X|S consoles.Gaming.XBOX.XboxOne.x64for XBOX One family consoles.- DirectXTK12 commit
e656d54637b2830fc6eb5ecd9b329a9c72cb87d4.
260402 if you’re following the walkthrough with another release.
Step 1: Create the working folder
Open PowerShell and create an empty root folder.DeviceResources.*, Main.cpp, pch.*, StepTimer.h, and the shell visual PNG files from the Direct3D 12 XBOX Game template. Keep those generated files when adding the sample-specific source.
Step 2: Verify the XBOX GDK installation
Open the XBOX Series X|S VS 2022 Gaming Command Prompt installed with GDKX. The shortcut is normally under Microsoft GDK on the Start menu. You can also initialize the environment from an ordinary command prompt:GXDKEDITIONis empty.- The XBOX command-prompt shortcut is missing.
- Visual Studio doesn’t show XBOX project templates.
- The
Gaming.XBOX.Scarlett.x64MSBuild platform is unavailable. xbconnectorxbappcan’t be found.
Step 3: Create a native XBOX project
1
Open Visual Studio 2022 and select Create a new project
Set Language to C++, Platform to XBOX, and Project type to Games.
2
Select Direct3D 12 XBOX Game
Set the project name to
sample-game and the location to D:\repos\sample-game.3
Leave Place solution and project in the same directory cleared
So the solution is in the root and the project is in
D:\repos\sample-game\sample-game.4
Create the project
d3d12game_gx template files is a recovery technique, not the recommended new-project workflow.
Confirm the project is not UWP
Before adding game code, verify the project:- Contains
MicrosoftGameConfig.mgc. - Uses a
Gaming.XBOX.*.x64project platform. - Links to the XBOX GDK platform libraries.
- Does not use
Package.appxmanifestas its title configuration. - Was created from Direct3D 12 XBOX Game, not a Universal Windows template.
Step 4: Pin the GDK edition and configure console targets
Pinning the GDK edition prevents a future GDK install from silently changing the toolchain used by the project. In the main property group insample-game.vcxproj, set:
If the title only supports XBOX Series X|S consoles, you can omit the XBOX One family consoles configurations. See Cross-gen for shipping the same title across generations.
Step 5: Build the unmodified template
Build the generated template before adding dependencies or game code. This isolates toolchain problems from problems introduced by the sample. From an XBOX Series X|S VS 2022 Gaming Command Prompt:Step 6: Add DirectXTK12 as an optional helper
DirectXTK12 isn’t required to create a GDK title. The XBOX GDK template already provides the Direct3D 12 device, command queue, swap chain, and game loop needed to build a game against Direct3D 12 directly. This sample uses the separate Microsoft open-source DirectXTK12 library. The library reduces the amount of low-level rendering utility code required for sprite rendering, descriptor management, texture loading, resource upload, and graphics memory management. A title can replace these helpers with its own engine or a direct D3D12 implementation. Clone DirectXTK12 into the project:- Add
external\DirectXTK12\DirectXTK_GDKX_2022.vcxprojto the solution. - Add DirectXTK12 as a project reference from
sample-game. - Add
$(SolutionDir)external\DirectXTK12\Incto the include directories. - Build both projects for the same XBOX platform and configuration.
sample-game project uses this property:
CompileShaders.cmd through an explicit project-relative path:
Step 7: Add the game code
The sample separates gameplay state from rendering so the simulation can be tuned without changing Direct3D code. Keep the template-generated files, includingDeviceResources.*, Main.cpp, pch.*, StepTimer.h, and the five shell visual PNG files. Add these sample-specific files to the project:
Use a fixed simulation step
The project uses the template’sStepTimer with a 120 Hz fixed update. A fixed step keeps collision response and AI behavior stable when frame times vary.
The simulation contains:
- Two paddle states.
- One circular puck state.
- Scores for the left and right sides.
- A serve delay and alternating serve direction.
- Impact events for paddle, wall, and goal collisions.
Implement circular puck collision
Treat each paddle as an axis-aligned rectangle and the puck as a circle:- Find the point on the paddle rectangle closest to the puck center.
- Measure the squared distance from that point to the puck center.
- A collision occurred if the distance is no greater than the squared puck radius.
- Move the puck outside the paddle to prevent repeated overlap.
- Calculate the outgoing angle from the hit offset and paddle velocity.
- Increase puck speed slightly, up to a maximum.
Add predictive autoplay
Each paddle:- Predicts where the puck will intersect its horizontal position.
- Reflects the predicted coordinate across the top and bottom arena walls.
- Updates its target at a fixed reaction interval.
- Uses acceleration and maximum-speed limits rather than snapping.
- Adds a small deterministic targeting error.
Render the scene with DirectXTK12
Create:GraphicsMemory.- A descriptor heap containing a white texture and the puck texture.
- A normal-alpha
SpriteBatch. - An additive
SpriteBatchfor particles. - DDS textures through
ResourceUploadBatchandCreateDDSTextureFromFile.
SpriteBatch. Draw particles in the additive pass.
The completed sample renders in a 1920 by 1080 virtual coordinate system and scales that scene to the output viewport.
Keep effects restrained
The final tuning used:- A short, exponentially decaying screen shake.
- Smaller streak-shaped impact particles.
- More particles on paddle hits than wall hits.
- A stronger burst for a goal.
- A low-alpha puck trail.
- A brief green impact flash.
Step 8: Create and deploy the texture assets
The sample needs:Assets\white.dds: a 1 by 1 white RGBA texture used to draw rectangles and particles.Assets\xbox_logo.dds: a 256 by 256 RGBA texture used for the puck.
- Loads the source logo.
- Resizes it to 256 by 256.
- Applies a feathered circular alpha mask.
- Writes an RGBA8 DDS with a DX10 header.
- Creates the 1 by 1 white DDS.
sample-game.vcxproj:
A DDS file using the standard header plus a DX10 extension has 148 bytes before the pixel data. During the original session, a custom DDS writer emitted 152 bytes and the title failed during texture loading with
0x8007000D. If you use a custom DDS writer, validate the header layout before deployment.Step 9: Build the game
From the XBOX Series X|S VS 2022 Gaming Command Prompt:sample-game.exeMicrosoftGame.config- The shell visual PNG files
Assets\white.ddsAssets\xbox_logo.dds- Required runtime DLLs
- The Game OS image or other deployment metadata produced by the build
MicrosoftGameConfig.mgc. The GDK MGCCompile build item validates it and emits MicrosoftGame.config in the build output. Deployment and packaging both use the generated .config file. See Game config.
Step 10: Connect to the XBOX dev kit
Set the default console using its Tools IP address or host name:Step 11: Deploy the complete game
Deploy the entire build output folder:xbapp list after deployment to find the registered package full name and application user model ID (AUMID). The AUMID ends with !Game.
Step 12: Launch and verify the game
Launch the exact AUMID reported byxbapp list:
Step 13: Diagnose an immediate launch failure
If the game exits immediately, do not assume that deployment succeeded because the executable was copied.Get the last title result
Monitor debug output
Start a debug output monitor in one command prompt:OutputDebugStringA messages around:
- Game initialization.
- DirectXTK12 resource creation.
- Each texture load.
- Sprite pipeline creation.
- Texture upload completion.
- Frame exceptions.
white.dds. The loader returned 0x8007000D, which identified malformed DDS data. Correcting the DDS header and performing a clean full deployment fixed the launch.
For more launch diagnostics, run xbWatson while reproducing the failure. See also Error handling.
Step 14: Iterate safely
For most code-only changes:- Build Debug.
- Terminate the running package.
- Deploy the complete output folder.
- Launch the registered AUMID.
- Query the package state.
MicrosoftGameConfig.mgc, assets, or deployment metadata, uninstall the old loose deployment before deploying again. This prevents stale files or registration data from hiding a fix.
Optional: Create and test an XVC
Loose deployment is the fastest development loop. Create an XVC when you need to test retail-like installation or prepare a package for Partner Center. See Packaging for the full packaging reference.Associate MicrosoftGame.config with Partner Center
Get these values from Game setup > Identity details for the product:- Package Identity Name.
- Package Identity Publisher.
- Publisher Display Name.
- Store ID.
- XBOX Title ID.
- MSA App ID.
TargetDeviceFamily="Scarlett" is required for the XBOX Series X|S consoles package. Use a separate configuration for an XBOX One family consoles package.
Build the Release configuration
Stage the package content
Copy the Release output to a staging directory, but keepgameos.xvd outside the content map and do not include PDB files as ordinary package content.
Generate the layout
Create a dev-kit test package
Default test encryption is useful for local dev kit installation:Use submission encryption for a Partner Center package
Produce the sample-game package first with dev-kit test encryption so you can verify installation and launch. For a package that you will submit, follow the current packaging policy and use/lk or /l.
The recommended repeatable /lk workflow is:
