Cross-Platform Game Project Converter
Describes how XNA Game Studio 3.0 facilitates the process of converting a game for Windows, Xbox 360, or Zune to any of the other two game platforms.
The conversion process creates a new game project of the appropriate type. The new game project will be created in the same folder as the source project, and will share content and settings from the original game project.
- Limitations of Game Conversion
- Cross-Platform Game Conversion
- Changes Made to a Project During Conversion
- Linked Projects After Conversion
- References the Conversion Utility Cannot Replace
- Changes that May Be Necessary after Conversion
Limitations of Game Conversion
The conversion utility is not meant to be an end-to-end conversion, but it greatly simplifies the process of converting a game to the corresponding platform. Specific code changes will still be required. For example, if a Windows game is controlled by the keyboard and mouse, the converted game will not be changed to respond to an Xbox 360 game controller. You can use the cross-platform conditional compilation symbols to create sections of code that will execute only on the appropriate platform.
Cross-Platform Game Conversion
To convert a game for another platform
Load the game into a supported version of Visual Studio tools.
From the Project menu, choose the Create Copy of [project name] item, where the [project name] will be the name of the game project.
The presented items in the Project menu will vary according to the designated platform of the currently selected project:
Windows Xbox 360 Zune Create Copy of [Project Name] for Xbox 360
Create Copy of [Project Name] for Zune
Create Copy of [Project Name] for Windows
Create Copy of [Project Name] for Zune
Create Copy of [Project Name] for Windows
Create Copy of [Project Name] for Xbox 360
When complete, a new version of the game project will be added to your solution. It will be named for the platform (for example, "Xbox 360 Copy of [Project Name]" or "Windows Copy of [Project Name]"). The new game project will be selected.
Press F2 to if you wish to rename the project from the name given by the conversion utility.
Note
The solution may only contain one copy of a project for each platform. Solutions that do not conform to this will be unable to correctly synchronize projects and produce an error message during conversion.
Changes Made to a Project During Conversion
- All references to XNA Framework assemblies will be replaced with their equivalents for the other platform.
- All original configurations will be replaced with default configurations for the new platform.
- The XnaPlatform project property will change to that of the new platform.
- The Content Build Compression properties are set to the default values for the new platform.
- The ProjectGuid property will be replaced. This is not the same as the GUID assembly attribute (usually found in AssemblyInfo.cs), which will not be changed.
- The default Platform property and project output type settings will be replaced with values for the appropriate target platform.
Linked Projects After Conversion
The new project created by the conversion wizard shares code, content and settings from the original game project by being linked.
Projects copied through the conversion wizard are linked so that:
- An item or folder added to any project is also added to the other projects.
- An item or folder renamed in any project is also renamed in the other projects.
- An item or folder deleted from any project is also deleted from the other projects.
All other actions not specifically cited above are not synchronized between projects. Of particular note, this includes the following actions:
Excluding an item from a project has no effect on other projects. This is useful for items that are inappropriate for one platform (or more), yet needed for another platform (or platforms). For an example, see How To: Create a Cross-Platform Game Solution.
Changing properties in a project or folder has no effect on other projects.
The exception to this behavior is items in and properties of linked content project folders (for example, the Content project or content projects that you create) that exist within game projects. Excluding an item from a content project always excludes the item from all of its linked content projects. (As examining the properties of the linked content project folders will show, each is referencing the same project file. So, adding or removing an item to one will affect all.) This behavior is unique to content projects.
Note
Folders that are empty (as when they are first created) are not synchronized between projects. Once items are placed into a folder (so that it is no longer empty), the folder is synchronized across all other other projects.
References the Conversion Utility Cannot Replace
HintPath metadata (added using browse-to-file) and strong name references will be changed into simple-named references.
Project references to non-XNA Framework projects will be deleted.
Note
Unlike references to non-XNA Framework projects, all referenced XNA Framework game or game library projects are recursively converted. This means that if an XNA Framework project references another in the solution (with a project-to-project reference), conversion of the referencing project automatically converts the referenced project. The result is the converted copy of the first project referencing the converted copy of the second project.
For example, if you are converting a Windows game to the Xbox 360 that references a Windows game library in the same solution, conversion also occurs for the Windows game library. After a completed conversion, the result is an Xbox 360 game (a converted copy of the Windows game) that references an Xbox 360 game library (a converted copy of the Windows game library).
COM references will be deleted. The conversion wizard will provide a warning to the output window when this occurs.
COM file references will be deleted. The conversion wizard will provide a warning to the output window when this occurs.
Web references are removed, possibly resulting in compile time errors for the converted project. For example, any code that instantiates a Web reference-related class or invokes its methods will cause compile-time errors. The conversion wizard will provide a warning to the output window when this occurs.
Warning
If you need to remove a file from only one project, use the Exclude from Project command rather than the Delete command. The Delete command removes the file from disk, making it inaccessible to the other project.
Changes that May Be Necessary after Conversion
In some cases, a converted reference (for example, a strong name reference) may fail to resolve. If this happens, either delete the reference or replace it with a reference to an assembly version for the correct platform.
For example, if a reference to System.Data (often added automatically to Windows projects) was converted for the Xbox 360, you must remove it because System.Data are not supported on Xbox 360. However, if the converted reference was to something like a third-party game engine, you might be able to change the reference to an Xbox 360 version of the engine instead.
If a converted reference is deleted, ensure that any platform-specific code does not depend on that reference.
Any code specific to one target platform, for example, mouse-based user input in a Windows game, will not be converted for the other platform. You must manually change this code to use an Xbox 360-compatible input device.
Other common examples include any .settings files (due to missing types), code generated from any Windows Forms in the project, and certain types of resources. For example, string or binary resources are fine but bitmap resources will fail.
See Also
Developing Cross-Platform Games
Creating a Windows Game or Library Project
Creating an Xbox 360 Game or Library Project
Creating a Zune Game or Library Project