XBOX 360 Getting Starting

From Alpha Archive Wiki
Jump to navigation Jump to search

Xbox 360: Getting Started

Developing for Xbox 360

To develop for the Xbox 360 you must be a Microsoft Certified Xbox 360 Developer and own the appropriate hardware. See the Xbox 360 Setup page for a seat setup checklist.

Access Xbox 360 unique functionality

Unity Xbox provides a number of new scripting APIs to access Xbox Live services, storage devices, Avatars and much more. See the UnityEngine.X360 namespace in the scripting API.

How Unity Xbox differs from Desktop Unity

Strongly Typed JavaScript

  • Dynamic typing in JavaScript is always turned off in Unity on Xbox. This is the same as adding #pragma strict to your scripts, but it is done by default instead, in order to improve performance. When you launch an existing Unity Project, with dynamic typing, you will see compiler errors. You can easily fix them by either using static typing for the variables that are causing errors or taking advantage of type interface.

Ahead-Of-Time (AOT) compilation

  • Scripts are AOT compiled and loaded in as normal Xbox 360 dynamic libraries. JITing is not supported.
  • Exotic class libraries (reflection, LINQ etc) not fully supported.

Limited memory

  • Expect about 440MB free system memory with an empty project loaded.

Fixed resolution

  • 720p (1280x720) is the only resolution you’ll have to deal with.

No hardware MSAA

  • Unity for Xbox does not do hardware MSAA. Use “AntialiasingAsPostEffect” technique “FXAA3” from the “Image Effects” standard package for best results.

XMA audio compression

  • Unity will compress audio to XMA when targeting Xbox 360.
  • Unity will use OGG in the editor (XMA can not be played on the PC). Expect audio quality to differ and check the output Xbox produces.
  • Only two channels are supported when load type is “Compressed in memory”.


SETUP

Step-by-step guide for installing Unity for Xbox 360:

  1. Install Visual Studio 2010
  2. Install Microsoft XDK (Full)
  3. XEDK environment variable must be set up - XDK setup does this automatically.
  4. Exact version number will be provided with every Unity build.
  5. Set up a default devkit or testkit in your Xbox 360 Neighborhood.
  6. Install Unity.

Build information:

  • XDK version: November 2012, #21250.7.


Project Structure

Special directories:

PROJECT/Assets/StreamingAssets - for assets that Unity should not process. Files are copied to OUTPUT\Media\Raw.

  • Videos.
  • Asset bundles.
  • Custom assets.

PROJECT/Assets/Plugins - for native plugins. .def and .xex files are copied to OUTPUT\Media\Plugins.

Runtime paths:

  1. Xbox mounts the game folder to game:.
  2. Unity executable is located at game:\Project.XEX.
  3. Unity data files are located at _game:\Media_.
  4. Unity compiled script assemblies are located at _game:\Media\Managed_.
  5. Raw assets are located at _game:\Media\Raw_.


Project Settings

Unity for Xbox 360 comes with additional project settings.

Build Type

Debug player has full debug output and asserts enabled.

  1. Editor-player connection enabled.
  2. Unity profiler enabled.
  3. Full debug information emitted to standard output.
  4. Linked with debug libs.
  5. PDBs for managed code emitted to BUILD_TARGET\Media\Managed.

Development player has most of the debug functionality required for normal development.

  1. Editor-player connection enabled.
  2. Unity profiler enabled.
  3. Critical debug information emitted to standard output.
  4. Linked with instrumented libs to enable PIX captures.
  5. PDBs for managed code emitted to BUILD_TARGET\Media\Managed.

Master player is TCR compliant.

  1. All standard output disabled.
  2. Linked with retail libs.

Explicit Null Checks

Development Build feature that enables you to catch null references. Enabling it will cause the compiler to emit explicit null checks around every managed deref operation and throw a NullPointerException. This does influence performance slightly. Disabling it will cause the console to crash under the same conditions. See Debugging for more details.

Compress Libs

Enables compression of the main executable and script assemblies. Decreases project boot time (esp. from DVD), but increases build time.

Run Method

“Build and Run” command behavior can be customized:


  1. Copy to HDD - the usual way of testing Xbox 360 applications. The whole project output folder is copied to a devkit.
  2. DVD Emulation - a disc layout file AutoLayout.XGD is created in the project output folder and the Game Disc Emulator is started. Devkit must be connected via the DVD EMU USB port (see DVD Emulation_ in the Xbox 360 SDK Documentation for details). Note that you will have to close the Game Disc Emulator window prior to the next build.
  3. No timing - the emulator does not emulate DVD behavior or introduce any latency into file read times.
  4. Accurate - the emulator emulates DVD behavior by introducing accurate latency based on the LBAs of the files accessed. Note that the automatically generated layout might be suboptimal for your game.

Title Id

Title id of your game. Format: ABCD1234. Contact your developer account manager at Microsoft for details. A title id is required by certain Xbox features (i.e. storage or Xbox Live services).

ImageXEX config override

Specifies a configuration file for the XEX image conversion tool. Unity player is converted to a XEX during the process. See XEX Image Converter in the Xbox 360 SDK Documentation for details.

SPA config

Specifies a SPA configuration file to be embedded in the executable. This configuration is required by certain Xbox features (i.e. Xbox Live services). Step-by-step guide:

  1. Download the Xbox LIVE Publishing Toolkit from the Xbox Developer site.
  2. Prepare a configuration using the Xbox LIVE Game Configuration tool and upload it to PartnerNet. See LIVE Environments in the the Xbox 360 SDK Documentation for details.
  3. Generate the .SPA and .SPA.H files for your configuration.
  4. Enter the path to the .SPA file.

Generate _SPAConfig.cs

Convenience feature enabled only when the SPA config is specified. Enabling this will have Unity look for a .SPA.H file in the same folder as the specified .SPA file and convert it to a Unity script containing a single enum SPAConfig. Hardcoding values is not an option as they may change after rebuilding the SPA files.

Enable Avatar rendering

Initializes the Avatar system. See Avatars for more details.

Deploy Kinect resources

Copies Kinect resources (Database.xmplr and NuiIdentity.bin.be) to the project output folder.

Deploy Speech resources

Copies Speech resources (selected languages) to the project output folder.

Enable Kinect

Enables Kinect systems in UnityEngine.Kinect.

Enable Kinect AutoTracking

Enables automatic skeleton tracking. If disabled, UnityEngine.Kinect.Skeleton.SetTrackedSkeletons must be called to specify tracked skeletons. Only visible if Enable Kinect is checked.

Enable Kinect Fitness

Enables Kinect Fitness API.

Enable GPU skinning

Enables Unity to use a GPU skinning path with memexport.

Stripping Level

Enables code stripping. Strips managed bytecode and unused native code. Greatly reduces DLL size and boot time. “micro mscorlib” is not available for Xbox 360. Selecting it will act as “Strip ByteCode”.


Building Plugins for Xbox 360

Plugin requirements:

- Linked against the same libraries as Unity.

   *Development Build uses instrumented XDK libraries.
   *Non-development Build uses release XDK libraries.

- Access to certain system services might not be possible if Unity already uses them:

  • Avatar system can be disabled in Player Settings if a custom implementation is desired.

Plugin development:

  1. An Xbox 360 DLL is written as usual.
  2. A relocation address must be provided manually:
  • See library Project Properties - Xbox 360 Image conversion - Base Address.
  • Available address range: 0x06000000 to 0x08000000.
  1. Compiled libraries are be placed in PROJECT\Assets\Plugins folder. See See Project Structure for more details.
  2. A library definition file must be provided (PLUGINNAME.def).
  3. See Mono Interop docs for marshaling details.

Examples

See “Xbox 360 - Native Plugin Example” package.