> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Intelligent Delivery: Feature と Recipe

> Intelligent Delivery: Feature と Recipe

このトピックでは、ゲームの初回およびその後のインストール時間を改善するために、Feature と Recipe を使用する方法について説明します。Feature と Recipe は共に、ユーザーが初回インストール時、およびその後シェル内から追加および削除できる、ベースゲーム内のコンテンツグループを定義します。実行時 API を使用して、Feature のインストール状態を動的にクエリし、Feature の追加と削除をトリガーすることもできます。

Feature は、開発者向けの ID 文字列属性を指定する XML 要素です。シェルで表示するためのユーザー向けのローカライズ可能な表示名と画像も指定します。Feature は 1 つ以上のタグを指定します。インストールおよび更新時に、システムはインストール済み Feature によって参照されるすべてのタグを見つけ、それらのタグを含むすべてのチャンクをインストールします。

Recipe は、インストールすべき Feature のリストを指定する XML 要素です。常に既定の Recipe があり、Recipe が含む Feature は常にインストールされます。追加の Recipe を定義できます。それらは、次のコードに示すように、ユーザーまたは現在のコンソールが指定された任意の `StoreIds` に対するエンタイトルメントを持っている場合、インストール時にアクティブになります。

```xml theme={null}
<Recipes>
    <!-- A recipe is always active if it has no child StoreId elements—the name "default" is a convention. -->
    <Recipe Id="default" IncludedFeatures="CampaignFeature;MultiPlayerFeature"/>

    <!-- This recipe is active by default, but only on Xbox Series X hardware.  -->
    <Recipe Id="default-anaconda" IncludedFeatures="HDFeature" Devices="Xbox-Anaconda"/>

    <!-- PremiumProduct recipe is active, which means PremiumFeature installs if user owns 9PXXXXXXXXXX. -->
    <Recipe Id="PremiumProduct" IncludedFeatures="PremiumFeature">
        <StoreId>9PXXXXXXXXXX</StoreId>
    </Recipe>
</Recipes>
<Features>
    <Feature Id="CampaignFeature" DisplayName="ms-resource:CampaignFeatureName" Image="campaignlogo.png" Tags="Campaign1;Campaign2"/>
    <Feature Id="MultiPlayerFeature" DisplayName="ms-resource:MultiPlayerFeatureName" Image="MPlogo.png" Tags="Multiplayer1;Multiplayer2" />
    <Feature Id="HDFeature" DisplayName="ms-resource:HDTexturesFeatureName" Image="HDlogo.png" Tags="hd"/>
    <Feature Id="PremiumFeature" DisplayName="ms-resource:PremiumFeatureName" Image="Premiumlogo.png" Tags="extras"/>
</Features>


<Chunk Id="8000" Tags="Campaign1">
<Chunk Id="8001" Tags="Campaign2">
<!-- This chunk uses the # character, so it's only installed if both the Campaign and HD features are active. -->
<Chunk Id="8001" Tags="Campaign1#hd"> 

<Chunk Id="9000" Tags="Multiplayer1">
<!-- This chunk uses the # character, so it's only installed if both the Multiplayer and HD features are active. -->
<Chunk Id="9001" Tags="Multiplayer1#hd"> 

<!-- This chunk is installed if either the Multiplayer or SinglePlayer features are active. -->
<Chunk Id="10000" Tags="Multiplayer1;Campaign1">
<!-- This chunk is installed if either the (Multiplayer feature and HD feature) or (SinglePlayer feature and HD feature) are active. -->
<Chunk Id="10001" Tags="Multiplayer1#hd;Campaign1#hd">

<Chunk Id="11000" Tags="extras">
<!-- This chunk uses the # character, so it's only installed if both the Premium and HD features are active. -->
<Chunk Id="11001" Tags="extras#hd"> 
```

<Note>Feature は複数のタグ属性を含むことができ、セミコロンで区切ります。チャンク内のいずれかのタグがアクティブな Feature に含まれていれば、そのチャンクはインストール対象に含まれます。`#` 記号は、`#` の両側のタグが共にアクティブな場合にタグをインストールします。</Note>

## Feature 表示名のローカライズ

`DisplayNames` のローカライズは、*MicrosoftGame.config* ファイル内の name 属性のローカライズと同じ方法で行われます。これは、`ms-resource:name` 形式を、ゲームの strings ディレクトリ内の *.resw* ファイルおよび適切に名前が付けられたサブディレクトリ内のロケール別文字列と共に使用することで行われます。詳細については、[MicrosoftGame.Config のローカライズ](/build/core-features/common/game-config/MicrosoftGameConfig-Localization) を参照してください。

<Note>MicrosoftGame.config および Intelligent Delivery で使用されるローカライズされた文字列値および画像は、開発者サンドボックスでも小売でも、公開されたパッケージ内で暗号化されません。タイトル、アイコン、その他機密性の高いコンテンツにはゲーム内でプレースホルダー値を使用してください。機密性の高いコンテンツには、開発中、タイトルの公開開示前、またはタイトル内で見つかる特定のコンテンツで Intelligent Delivery が参照するコンテンツが含まれます。</Note>

## 非表示の Feature

Feature を非表示としてマークすることで、インストール時、またはタイトルがインストールされた後のシェル管理時に、ユーザーがそれらを選択可能なオプションとして表示するかどうかを決定することを防ぎます。非表示の Feature を使用する際は注意が必要です。それらを追加または削除する唯一の方法は、タイトル内の API を使用することだからです。タイトルで発見されたバグは、それらを修正するコンテンツ更新を提供するまで、アクセス不可能なコンテンツをもたらす可能性があります。次のコードは、非表示としてマークされた Feature の例です。

```xml theme={null}
  <Feature Id="HiddenFeature" Hidden="true" Tags="HiddenFeature1" />
```

## Feature のインストールステータスの確認

Feature を使用して、その Feature で指定されたタグを持つすべてのチャンクの存在を確認できます。これらの実行時クエリを実行する場合、Device および Language 指定子が考慮されます。Feature 内にデバイスまたは言語固有のコンテンツがある場合、1 つの言語と、その Feature 内の現在のデバイスに適用可能なすべてのチャンクがインストールされている限り、`true` として返されます。

たとえば、Campaign Feature のアセットがチャンク 8000、8001、8002 に含まれている場合、そのチャンクセットが完全にインストールされプレイ可能かどうかを判断するために [XPackageFindChunkAvailability](/reference/system/xpackage/functions/xpackagefindchunkavailability) メソッドを呼び出す代わりに、3 つのチャンクすべてにカスタムタグ「campaign1」を付け、Campaign Feature で「campaign1」を参照できます。次に、Campaign Feature ID を持つ [XPackageChunkSelector](/reference/system/xpackage/structs/xpackagechunkselector) を使用して [XPackageFindChunkAvailability](/reference/system/xpackage/functions/xpackagefindchunkavailability) メソッドを呼び出すことで、そのデータセットのインストールステータスを簡単に取得できます。

<a id="ID4EHB" />

## リファレンス API ドキュメント

* [XPackage (API 内容)](/reference/system/xpackage/xpackage_members)
  * 関数
    * [XPackageFindChunkAvailability](/reference/system/xpackage/functions/xpackagefindchunkavailability)
    * [XPackageInstallChunks](/reference/system/xpackage/functions/xpackageinstallchunks)
  * 構造体
    * [XPackageChunkSelector](/reference/system/xpackage/structs/xpackagechunkselector)

## 関連項目

[Intelligent Delivery の概要](/build/core-features/common/packaging/overviews/intelligentdelivery)
[XPackageChunkSelector](/reference/system/xpackage/structs/xpackagechunkselector)
[XPackageInstallChunks](/reference/system/xpackage/functions/xpackageinstallchunks)
[MicrosoftGame.Config のローカライズ](/build/core-features/common/game-config/MicrosoftGameConfig-Localization)


## Related topics

- [Intelligent Delivery](/ja-jp/build/core-features/common/packaging/overviews/intelligentdelivery.md)
- [XR-129 Intelligent Delivery のコンテンツ管理](/ja-jp/publishing/certification/xr/xr-129.md)
- [Intelligent Delivery: OnDemand コンテンツ](/ja-jp/build/core-features/common/packaging/intelligentdelivery-ondemand.md)
- [FMA: XR-129 Intelligent Delivery のコンテンツ管理](/ja-jp/publishing/certification/fma/xr-129.md)
- [XBOX Game エネルギー効率化の基本](/ja-jp/build/game-principles/sustainability/energy-efficiency-essentials.md)
