Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions en/includes/asset-status-dots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
In the **Asset view**, you can see a dot in the top left corner of every asset that signifies how it will be compiled.

![](media/asset-view-indicators.webp)

Each color represents something:

* 🔵 **Blue** (will be compiled) - this asset is marked as root, meaning that it will always be compiled in the game no matter if it's referenced or not.
* 🟢 **Green** (will be compiled) - this asset is referenced by another asset that is used in the game, meaning that it will be compiled.
* ⚫ **Gray** (won't be compiled) - this asset isn't referenced by any other asset that's used in the game, meaning that it won't be compiled.
2 changes: 2 additions & 0 deletions en/includes/content-loading-warning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> [!WARNING]
> When assets are loaded manually, **they have to be manually unloaded too**, or else Stride will keep the assets **loaded in memory forever**.
4 changes: 2 additions & 2 deletions en/manual/animation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Skeletons don't have to resemble the skeletons of real humans or animals. You ca
**Skinned models** are models that have been skinned to match a skeleton. The **skin** describes how vertices of the mesh transform when bones move.

>[!NOTE]
>In Game Studio, you can only create simple 3D models such as spheres and cubes. For information about how to do this, see [Create assets](../game-studio/create-assets.md). To create more complex models, use dedicated software like 3DS Max, Maya, or Blender, then [import the model into Game Studio](import-animations.md).
>In Game Studio, you can only create simple 3D models such as spheres and cubes. For information about how to do this, see [Create an asset](../assets/create-an-asset.md). To create more complex models, use dedicated software like 3DS Max, Maya, or Blender, then [import the model into Game Studio](import-animations.md).

## Animation clips

Expand All @@ -53,4 +53,4 @@ The templates **First-person shooter**, **Third-person platformer** and **Top-do
* [Procedural animation](procedural-animation.md)
* [Custom blend trees](custom-blend-trees.md)
* [Model node links](model-node-links.md)
* [Custom attributes](custom-attributes.md)
* [Custom attributes](custom-attributes.md)
44 changes: 44 additions & 0 deletions en/manual/assets/archetypes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Archetypes

<span class="badge text-bg-primary">Intermediate</span>

Stride allows you to create variants of the same asset that only change a selected number of properties, while remaining synchronized with the base.

![](media/archetypes.webp)

Here is some terminology to keep in mind:

* **Archetype** - the original asset.
* **Derived asset** - an asset that derives from an archetype.

## Creating a derived asset

In the **Asset view**, right click on the asset you want to derive from and select **Create derived asset**.

![](media/asset-view-create-derived.webp)

**Game Studio** then creates a new derived asset which you can modify.

## Overriding values

When changing a property of a derived asset in the **Property grid**, it will be marked as overridden. Overridden properties are slightly brighter and bolder.

![](media/property-grid-overriden-property.webp)

Overridden properties will not be updated when they are changed on the archetype.

## Reverting overrides

In case you want to revert a property override to use the same values as the archetype, right click on it in the **Property grid** and select **Reset to base value**.

## Unlink from archetype

If you want to turn a derived asset into a normal one (unlinking it from the archetype), in the **Asset view** right click on it and select **Clear archetype**.

![](media/property-grid-reset-to-base.webp)

Now, the asset will no longer follow changes done to the archetype.

## See also

* [Create an asset](create-an-asset.md)
98 changes: 98 additions & 0 deletions en/manual/assets/asset-bundles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Asset bundles

<span class="badge text-bg-primary">Advanced</span>
<span class="badge text-bg-success">Programmer</span>

After compilation, assets are turned into **asset bundles**. By default, only one asset bundle is created, but this can be changed in order to, for example: separate DLC content into it's own bundle, so that it could be sold separately.

When the game starts, Stride only loads the `default` bundle. Other bundles need to be loaded manually through code.

## Create an asset bundle

> [!NOTE]
> Currently, this has to be done manually.

In order to create new asset bundles, you'll have to modify the `.sdpkg` file of a project package. For more information about project package properties visit [this page](../files-and-folders/project-packages/package-properties.md).

Bundles are defined under the `Bundle` property. Each bundle has a `Name`, a list of `Dependencies` on other bundles and a list of `Selectors` that specify which assets belong to the bundle.

There are 2 types of selectors:
* 🏷️ **Tag selector** - selects assets that have at least one of the specified `Tags`.
* 📁 **Path selector** - selects assets based on the provided list of `Paths`. Filters work similarly to the [`.gitignore` filtering convention](https://git-scm.com/docs/gitignore#_pattern_format) with a few exceptions: `!` (negations), `[]` (groups) and `#` (comments). This means that you can select **individual files**, **entire folders** or **files with a specific extension**.

Here's an example configuration:

```yaml
Bundles:
- Name: CustomBundleA
Selectors:
- !TagSelector
Tags:
- MyTag1
- MyTag2
- Name: CustomBundleB
Dependencies:
- CustomBundleA
Selectors:
- !TagSelector
Tags:
- MyTag3
- MyTag4
- !PathSelector
Paths:
- folder1/
- /folder2/
- *.sdtex
- folder3/*.sdscene
```

> [!CAUTION]
> If any of your custom bundles are **empty**, Stride will **fail to build** the game.

### Root assets

It's important to note that assets from optional bundles (such as DLC content) **shouldn't be referenced by assets from the default bundle**. If the other bundle is missing, Stride will fail when trying to load it's assets.

However, if a bundle's assets are unreferenced, Stride will not compile them. To prevent this, make sure to **mark the appropriate assets (such as scenes) as root**. The assets will then be accessible in code.

For more information about root assets, visit [Asset compilation](asset-compilation.md).

### Compiling behaviour

Stride tries to place assets in the most appropriate bundle.

1. Assets not defined in `Bundles` are placed in the **default** bundle, which is loaded automatically when the game starts.
2. If an asset is selected by **BundleA** and **BundleB**, but **BundleB** has a dependency on **BundleA**, that asset is placed only in **BundleA**.
3. If an asset is selected by **BundleA** and **BundleB** and both of them aren't dependent on each other, that asset is placed in both of them.

> [!NOTE]
> Loading two bundles with the same asset won't result in a duplicate.

## Loading bundles

Stride **automatically loads the default bundle**. However, other bundles need to be manually loaded through code using [`LoadBundle`](xref:Stride.Core.Storage.ObjectDatabase.LoadBundle*).

```csharp
await Content.FileProvider.ObjectDatabase.LoadBundle("NameOfBundle");
```

> [!NOTE]
> When loading a bundle, it's dependencies are loaded automatically.

Assets can then be loaded via the **content system**. For more information, visit the [use an asset in code page](use-an-asset-in-code.md).

## Bundle location

Bundles are located in `data/db/bundles` next to the built executable. You can recognize them by their name.

For more information about the build location, visit the [build file structure page](../files-and-folders/building-the-game/build-file-structure.md).

![](media/asset-bundle-location.webp)

> [!NOTE]
> Bundles tend to be split into multiple files that start with the same name.

## See also

* [Asset compilation](asset-compilation.md)
* [Use an asset in code](use-an-asset-in-code.md)
62 changes: 62 additions & 0 deletions en/manual/assets/asset-compilation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Asset compilation

<span class="badge text-bg-primary">Beginner</span>

Assets are compiled into **bundles**.

## Which assets are compiled

Stride only compiles assets which are used in the game. This means that if an asset isn't referenced by another asset that is determined as needed, it will be ignored.

TODO: VISUALIZATION

## Blue, green and gray dots

[!INCLUDE [asset-status-dots](../../includes/asset-status-dots.md)]

## Root assets

🔵 **Root assets** are assets that will always be compiled, no matter if they are referenced or not.

A few remarks:

* Root assets can be defined in a [project package](../files-and-folders/project-packages/index.md) to which they belong or any other [project package](../files-and-folders/project-packages/index.md) that uses it as a [dependency](../files-and-folders/project-packages/dependencies.md).
* You can only mark individual assets as root, not folders.

### How to mark an asset as root

You can mark an asset as root by right clicking on it in the **Asset view** and selecting **🔵 Include in build as root asset**.

![](media/asset-view-include-root.webp)

> [!WARNING]
> Marking an asset as root in **Game Studio** will only mark it **for the selected platform**. Make sure to either:
> * Mark the asset as root for every platform your project targets
> * Edit the main [project package](../files-and-folders/project-packages/index.md)'s `.sdpkg` file manually. For more information, visit the [package properties page](../files-and-folders/project-packages/package-properties.md).

## Checking assets

You can use [`Content.FileProvider.ContentIndexMap`](xref:Stride.Core.Serialization.Contents.IContentIndexMap) to check what assets are available.

```csharp
if (Content.FileProvider.ContentIndexMap.Contains("Models/Enemy"))
{
// Execute code if the asset exists
}

var allContent = Content.FileProvider.ContentIndexMap.GetMergedIdMap()
.Select(x => x.Key);
```

> [!NOTE]
> The content system also contains shaders and shader information. If you want to use [`GetMergedIdMap`](xref:Stride.Core.Serialization.Contents.IContentIndexMap.GetMergedIdMap) to check which assets are loaded, consider filtering out paths that start with `shaders/` and `__shaders_bytecode__/`.
>
> ```csharp
> var allAssets = Content.FileProvider.ContentIndexMap.GetMergedIdMap()
> .Select(x => x.Key)
> .Where(x => !x.StartsWith("shaders/") && !x.StartsWith("__shaders_bytecode__/"));
> ```

## See also

* [Use an asset in code](use-an-asset-in-code.md)
30 changes: 30 additions & 0 deletions en/manual/assets/create-an-asset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Create an asset

<span class="badge text-bg-primary">Beginner</span>

Assets can be created with **Game Studio** in the **Asset view**.

## Create an asset

To create an asset, click the **➕ Add assets** button in the **Asset view** and select the type of asset you want to create.

![](media/asset-view-create-new.webp)

## Create an asset from resource

To create an asset from a resource, simply drag and drop it into the **Asset view** and select the type of asset you want to create.

![](media/asset-view-from-resource-type.webp)

If the resource isn't present in the resources folder, **Game Studio** will ask you if you want to move it there. In the majority of cases, **you will want to click yes**.

![](media/asset-view-copy-resource.webp)

Finally, you will be asked if you want to **move it to the default location**. Again, most of the time **you will want to do this**, unless you need more control over where resources end up.

![](media/asset-view-resource-default-location.webp)

## See also
* [Edit an asset](edit-an-asset.md)
* [Use an asset](use-an-asset.md)
* [Use an asset in code](use-an-asset-in-code.md)
41 changes: 41 additions & 0 deletions en/manual/assets/edit-an-asset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Edit an asset

<span class="badge text-bg-primary">Beginner</span>

Most assets are just a simple list of properties, which can be edited in the **Property grid**. However, more complex assets (such as scenes) require the use of a **dedicated editor**.

## Editing in Property grid

When you select an asset in the **Asset view**, it's properties will show up in the **Property grid**.

![](media/property-grid-asset-properties.webp)

Your changes will be reflected in the **Asset preview** in real time.

![](media/asset-preview.webp)

> [!NOTE]
> Modified assets aren't automatically saved. You will have to save them manually by going to **File > Save** or by pressing **Ctrl + S**.

## Editing using a dedicated editor

Certain assets require the use of a dedicated editor. The most notable example of this are **Scenes**.

Currently, the assets that have a dedicated editor are:

* Graphics compositor
* Prefabs
* Scenes
* Sprite sheets
* Ui pages
* Ui libraries
* Scripts

To open a dedicated editor for an asset either **double click it**, right click and select **🖉 Edit asset** or select it and press **Ctrl + Enter**.

![](media/asset-view-edit-asset.webp)

# See also

* [Use an asset](use-an-asset.md)
* [Use an asset in code](use-an-asset-in-code.md)
42 changes: 42 additions & 0 deletions en/manual/assets/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Assets

<span class="badge text-bg-primary">Beginner</span>

**Assets** are representations of elements in a project (such as scenes, textures or audio), which can be used by scripts or other assets. An example would be the **model component** using a **model asset**.

**Resources** on the other hand are the files containing actual data (such as images or music), which can be used by assets.

In short:
* **Resources** - raw data files (`.png`, `.wav`, `.fbx`)
* **Assets** - usable elements in the game. They can use resource files and contain additional properties.

## Blue, green and gray dots

Stride only compiles assets which are used in the game. This means that if an asset isn't referenced by another asset that is determined as needed, it will be ignored.

TODO: VISUALIZATION

[!INCLUDE [asset-status-dots](../../includes/asset-status-dots.md)]

For more information about how assets are compiled, visit [Asset compilation](asset-compilation.md)

## Location of assets and resources

In **Game Studio** you can view assets in the **Asset view** by selecting an **assets** folder in the **solution explorer**.

![](media/solution-explorer-assets.webp)

As for **resources**, it isn't possible to view them in **Game Studio**. You can browse through them by opening the directory containing your project and going to a resource folder of the target [project package](../files-and-folders/project-packages/index.md).

For more information, visit [Project file structure](../files-and-folders/project-structure.md).

## In this section

* [Create an asset](create-an-asset.md)
* [Edit an asset](edit-an-asset.md)
* [Use an asset](use-an-asset.md)
* [Use an asset in code](use-an-asset-in-code.md)
* [Tags](tags.md)
* [Archetypes](archetypes.md)
* [Asset compilation](asset-compilation.md)
* [Asset bundles](asset-bundles.md)
3 changes: 3 additions & 0 deletions en/manual/assets/media/archetypes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions en/manual/assets/media/archetypes.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions en/manual/assets/media/asset-bundle-location.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions en/manual/assets/media/asset-bundle-location.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions en/manual/assets/media/asset-preview.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions en/manual/assets/media/asset-view-create-derived.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions en/manual/assets/media/asset-view-edit-asset.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions en/manual/assets/media/property-grid-asset-properties.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions en/manual/assets/media/property-grid-asset-reference.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions en/manual/assets/media/property-grid-overriden-property.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading