Components = new();
+
+ public void SystemAdded(IServiceRegistry registryParam) { }
+ public void SystemRemoved() { }
+
+ public void OnComponentAdded(ISpecialTick item) => Components.Add(item);
+ public void OnComponentRemoved(ISpecialTick item) => Components.Remove(item);
+
+ // The execution order of this Update, smaller values execute first compared to other IComponent Processors
+ public int Order => 0;
+
+ public void Update(GameTime gameTime)
+ {
+ foreach (var comp in Components)
+ comp.Tick();
+ }
+ }
+}
+```
+
+## Performance
+While it is more flexible, processing components as interfaces instead of concrete class may introduce some overhead.
+If the system you're writing is performance critical you should look into strategies to elide or reduce virtual calls in your hot path.
diff --git a/en/manual/engine/file-system.md b/en/manual/engine/file-system.md
index b268bf28d..4fc0d4743 100644
--- a/en/manual/engine/file-system.md
+++ b/en/manual/engine/file-system.md
@@ -19,11 +19,11 @@ var gamesave2 = VirtualFileSystem.ApplicationRoaming.OpenStream("gamesave001.dat
## Default mount points
-| Mount point | Description | Writable | Cloud | Notes | PC | Android | iOS | Windows Phone 8.1
-| ----------- | -------------| -------- | ----- | -------| ---- | -------- | ------- | --
-| data | Application data, deployed by package | ✗ | ✗ | | Output directory/data | APK itself | Deployed package directory | InstalledLocation.Path
-| binary | Application binaries, deployed by package | ✗ | ✗ | Usually the same as *app_data* (except on Android) | Assembly directory | Assembly directory | Assembly directory | Assembly directory
-| roaming | User specific data (roaming) | ✓ | ✓ | Backup | Output directory/roaming, *%APPDATA%* | *$(Context.getFilesDir)/roaming* | Library/roaming | Roaming
-| local | User application data | ✓ | ✓ | Backup | Output directory/local | $(Context.getFilesDir)local | Library/local | Local
-| cache | Application cache | ✓ | ✗ | DLC, etc. Might be deleted manually by user (restore, clear data, etc...) | Output directory/cache, with do-not-back-up flags | *$(Context.getFilesDir)/cache* | Library/caches | LocalCache
-| tmp | Application temporary data | ✓ | ✗ | Might be deleted without notice by OS | Output directory/temp, *%TEMP%/%APPNAME%* | *$(Context.getCacheDir)* | tmp | Temporary
\ No newline at end of file
+| Mount point | Description | Writable | Cloud | Notes | PC | Android | iOS |
+|-------------|-------------------------------------------|----------|-------|---------------------------------------------------------------------------|---------------------------------------------------|----------------------------------|----------------------------|
+| data | Application data, deployed by package | ✗ | ✗ | | Output directory/data | APK itself | Deployed package directory |
+| binary | Application binaries, deployed by package | ✗ | ✗ | Usually the same as *app_data* (except on Android) | Assembly directory | Assembly directory | Assembly directory |
+| roaming | User specific data (roaming) | ✓ | ✓ | Backup | Output directory/roaming, *%APPDATA%* | *$(Context.getFilesDir)/roaming* | Library/roaming |
+| local | User application data | ✓ | ✓ | Backup | Output directory/local | $(Context.getFilesDir)local | Library/local |
+| cache | Application cache | ✓ | ✗ | DLC, etc. Might be deleted manually by user (restore, clear data, etc...) | Output directory/cache, with do-not-back-up flags | *$(Context.getFilesDir)/cache* | Library/caches |
+| tmp | Application temporary data | ✓ | ✗ | Might be deleted without notice by OS | Output directory/temp, *%TEMP%/%APPNAME%* | *$(Context.getCacheDir)* | tmp |
\ No newline at end of file
diff --git a/en/manual/files-and-folders/distribute-a-game.md b/en/manual/files-and-folders/distribute-a-game.md
index 9195c9a23..2a3525f9d 100644
--- a/en/manual/files-and-folders/distribute-a-game.md
+++ b/en/manual/files-and-folders/distribute-a-game.md
@@ -65,7 +65,7 @@ After you create a release build, how you distribute it is up to you.
To run games made with Stride on Windows, users need:
-* .NET 4.6.1
+* .NET 8 SDK
* DirectX11 (included with Windows 10 and later), OpenGL, or Vulkan
diff --git a/en/manual/game-studio/index.md b/en/manual/game-studio/index.md
index c1d07fc5b..b7b61f617 100644
--- a/en/manual/game-studio/index.md
+++ b/en/manual/game-studio/index.md
@@ -15,7 +15,7 @@ Game Studio is also integrated with your Visual Studio projects, so you can seam
![Game Studio](../get-started/media/game-studio-main-interface.png)
-The **asset editor** (A) is used to edit assets and scenes. Some asset types, such as scenes [scenes](create-a-scene.md), have dedicated editors where you can make complex changes to the asset. To open a dedicated editor (when available), double-click the asset or right-click it and select **Edit asset**.
+The **asset editor** (A) is used to edit assets and scenes. Some asset types, such as [scenes](create-a-scene.md), have dedicated editors where you can make complex changes to the asset. To open a dedicated editor (when available), double-click the asset or right-click it and select **Edit asset**.
The **Property Grid** (B) displays the properties of the asset or entity you select. You can edit the properties here.
@@ -47,4 +47,4 @@ You can show and hide different parts of the Game Studio in the View menu. You c
* [Edit prefabs](prefabs/edit-prefabs.md)
* [Nested prefabs](prefabs/nested-prefabs.md)
* [Override prefab properties](prefabs/override-prefab-properties.md)
-* [World units](world-units.md)
\ No newline at end of file
+* [World units](world-units.md)
diff --git a/en/manual/get-started/launch-stride.md b/en/manual/get-started/launch-stride.md
index 26377b758..62875e59a 100644
--- a/en/manual/get-started/launch-stride.md
+++ b/en/manual/get-started/launch-stride.md
@@ -16,7 +16,7 @@ If you choose to install the latest version, the Stride Launcher asks if you wan
![Install Visual Studio integration](media/install-VS-plug-in-prompt.webp)
-The Stride Visual Studio extension adds syntax highlighting, live code validation, error checking, and navigation. It also lets you you [edit shaders directly from Visual Studio](../graphics/effects-and-shaders/custom-shaders.md). You don't need to install the extension to use Stride, but we recommend it, especially for programmers.
+The Stride Visual Studio extension lets you you [edit shaders directly from Visual Studio](../graphics/effects-and-shaders/custom-shaders.md). You don't need to install the extension to use Stride, but we recommend it, especially for programmers.
## Manage different versions of Stride
diff --git a/en/manual/get-started/visual-studio-extension.md b/en/manual/get-started/visual-studio-extension.md
index 04e6eba85..a8c559ba7 100644
--- a/en/manual/get-started/visual-studio-extension.md
+++ b/en/manual/get-started/visual-studio-extension.md
@@ -2,7 +2,7 @@
Beginner
-The **Stride Visual Studio extension** adds syntax highlighting, live code validation, error checking, and navigation. It also lets you you [edit shaders directly from Visual Studio](../graphics/effects-and-shaders/custom-shaders.md).
+The **Stride Visual Studio extension** lets you [edit shaders directly from Visual Studio](../graphics/effects-and-shaders/custom-shaders.md).
You don't need to install the extension to use Stride, but we recommend it, especially for programmers.
diff --git a/en/manual/graphics/materials/shading-attributes.md b/en/manual/graphics/materials/shading-attributes.md
index 7f2c21330..8ccabffa6 100644
--- a/en/manual/graphics/materials/shading-attributes.md
+++ b/en/manual/graphics/materials/shading-attributes.md
@@ -20,7 +20,6 @@ The **diffuse** is the basic color of the material. A pure diffuse material is c
The final diffuse contribution is calculated like this:
- the **diffuse** defines the color used by the diffuse model
-
- the **diffuse model** defines which shading model is used for rendering the diffuse component (see below)
Currently, the diffuse attribute supports only a **diffuse map**.
@@ -42,7 +41,7 @@ Under the Lambert model, light is reflected equally in all directions with an in
| Property | Description
| ------------- | -----------
-| Diffuse map | The diffuse map color provider
+| Diffuse map | The diffuse map color provider
| Diffuse model | The shading model for diffuse lighting
## Specular
@@ -62,10 +61,8 @@ By taking into into account the fact that almost all materials always have some
The final specular color is calculated by mixing a fixed low-reflection color and the diffuse color.
- With the metalness color at `0.0`, the effective specular color is equal to `0.02`, while the diffuse color is unchanged. The material is not metal but exhibits some reflectance and is sensitive to the Fresnel effect.
-
- With the metalness color at `1.0`, the effective specular color is equal to the diffuse color, and the diffuse color is set to `0`. The material is considered a pure metal.
-
- ![media/material-attributes-26.png](media/material-attributes-26.png)
+ ![media/material-attributes-26.png](media/material-attributes-26.png)
The screenshots below show the result of the metalness factor on a material with the following attributes:
@@ -100,15 +97,9 @@ The microfacet is defined by the following formula, where Rs is the resulting sp
| Property | Description
| ------------------- | -------
-| Fresnel | Defines the amount of light that is reflected and transmitted. The models supported are:
**Schlick**: An approximation of the Fresnel effect (default)
**Thin glass**: A simulation of light passing through glass
**None**: The material as-is with no Fresnel effect
-| Visibility | Defines the visibility between of the microfacets between (0, 1). Also known as the geometry attenuation - Shadowing and Masking - in the original Cook-Torrance. Stride simplifies the formula to use the visibility term instead:
![media/material-attributes-35.png](media/material-attributes-35.png)
and
![media/material-attributes-36.png](media/material-attributes-36.png)
**Schlick GGX** (default)
**Implicit**: The microsurface is always visible and generates no shadowing or masking
**Cook-Torrance**
**Kelemen**
**Neumann**
**Smith-Beckmann**
**Smith-GGX correlated**
**Schlick-Beckmann**
-| Normal Distribution |
Defines how the normal is distributed. The gloss attribute is used by this part of the function to modify the distribution of the normal.
**GGX** (default)
**Beckmann**
**Blinn-Phong**
-| Fresnel | Defines the amount of light that is reflected and transmitted. The models supported are:
**Schlick**: An approximation of the Fresnel effect (default)
**Thin glass**: A simulation of light passing through glass
**None**: The material as-is with no Fresnel effect
-| Visibility | Defines the visibility between of the microfacets between (0, 1). Also known as the geometry attenuation - Shadowing and Masking - in the original Cook-Torrance. Stride simplifies the formula to use the visibility term instead:
![media/material-attributes-35.png](media/material-attributes-35.png)
and
![media/material-attributes-36.png](media/material-attributes-36.png)
**Schlick GGX** (default)
**Implicit**: The microsurface is always visible and generates no shadowing or masking
**Cook-Torrance**
**Kelemen**
**Neumann**
**Smith-Beckmann**
**Smith-GGX correlated**
**Schlick-Beckmann**
-| Normal Distribution |
Defines how the normal is distributed. The gloss attribute is used by this part of the function to modify the distribution of the normal.
**GGX** (default)
**Beckmann**
**Blinn-Phong**
-| Fresnel | Defines the amount of light that is reflected and transmitted. The models supported are:
**Schlick**: An approximation of the Fresnel effect (default)
**Thin glass**: A simulation of light passing through glass
**None**: The material as-is with no Fresnel effect
-| Visibility | Defines the visibility between of the microfacets between (0, 1). Also known as the geometry attenuation - Shadowing and Masking - in the original Cook-Torrance. Stride simplifies the formula to use the visibility term instead:
![media/material-attributes-35.png](media/material-attributes-35.png)
and
![media/material-attributes-36.png](media/material-attributes-36.png)
**Schlick GGX** (default)
**Implicit**: The microsurface is always visible and generates no shadowing or masking
**Cook-Torrance**
**Kelemen**
**Neumann**
**Smith-Beckmann**
**Smith-GGX correlated**
**Schlick-Beckmann**
-| Normal Distribution |
Defines how the normal is distributed. The gloss attribute is used by this part of the function to modify the distribution of the normal.
**GGX** (default)
**Beckmann**
**Blinn-Phong**
+| Fresnel | Defines the amount of light that is reflected and transmitted. The models supported are:
**Schlick**: An approximation of the Fresnel effect (default)
**Thin glass**: A simulation of light passing through glass
**None**: The material as-is with no Fresnel effect
+| Visibility | Defines the visibility between of the microfacets between (0, 1). Also known as the geometry attenuation - Shadowing and Masking - in the original Cook-Torrance. Stride simplifies the formula to use the visibility term instead:
![media/material-attributes-35.png](media/material-attributes-35.png)
and
![media/material-attributes-36.png](media/material-attributes-36.png)
**Schlick GGX** (default)
**Implicit**: The microsurface is always visible and generates no shadowing or masking
**Cook-Torrance**
**Kelemen**
**Neumann**
**Smith-Beckmann**
**Smith-GGX correlated**
**Schlick-Beckmann**
+| Normal Distribution | Defines how the normal is distributed. The gloss attribute is used by this part of the function to modify the distribution of the normal.
**GGX** (default)
**Beckmann**
**Blinn-Phong**
## Emissive
diff --git a/en/manual/graphics/textures/index.md b/en/manual/graphics/textures/index.md
index 30ab71323..a235aba62 100644
--- a/en/manual/graphics/textures/index.md
+++ b/en/manual/graphics/textures/index.md
@@ -63,8 +63,6 @@ The following properties are common to all textures.
| Width | The width of the texture in-game
| Height | The height of the texture in-game
| Use percentages | Use percentages for width and height instead of actual pixel size
-| Width | The width of the texture in-game
-| Height | The height of the texture in-game
| Type | Use **Color** for textures you want to display as images, **Normal map** for normal maps, and **Grayscale** to provide values for other things (eg specular maps, metalness maps, roughness maps). Color textures and normal maps have additional properties (see below).
| Generate mipmaps | Generate different versions of the texture at different resolutions to be displayed at different distances. Improves performance, removes visual artifacts, and reduces pop-in when using **streaming**, but uses more memory. Unnecessary for textures always at the same distance from the camera (such as UIs).
| Compress | Compress the final texture to a format based on the target platform and usage. The final texture is a multiple of 4. For more information, see [Texture compression](compression.md).
diff --git a/en/manual/graphics/textures/skyboxes-and-backgrounds.md b/en/manual/graphics/textures/skyboxes-and-backgrounds.md
index 248ce650b..28d81b137 100644
--- a/en/manual/graphics/textures/skyboxes-and-backgrounds.md
+++ b/en/manual/graphics/textures/skyboxes-and-backgrounds.md
@@ -54,6 +54,7 @@ Instead of using a cubemap, you can use a **360° panoramic texture** as a 3D ba
| 360° panorama | Appearance in game
|----------------|-------------
| ![Panorama texture](media/MyPanorama.jpg) | ![Panorama in game](media/panorama-in-game.jpg)
+
*Image courtesy of [Texturify](http://texturify.com)*
>[!Note]
diff --git a/en/manual/index.md b/en/manual/index.md
index 5a0b0a4f0..9e74b235d 100644
--- a/en/manual/index.md
+++ b/en/manual/index.md
@@ -10,6 +10,16 @@ These pages contain information about how to use Stride, an open-source C# game
## Latest documentation
### Recent updates
+
+#### Contributors
+
+- New [Contributing - Core Team](../contributors/core-team.md) - The Stride core team
+- Updated [Contributing - Roadmap](../contributors/roadmap.md) - Status added
+
+#### Manual
+- Updated [Scripts - Types of script](scripts/types-of-script.md) - Asynchronous script example improved
+- New [Scripts - Gizmos](scripts/gizmos.md) - Description and example of the Flexible Processing system
+- New [ECS - Flexible Processing](engine/entity-component-system/flexible-processing.md) - Description and example of the Flexible Processing system
- Updated [Linux - Setup and requirements](platforms/linux/setup-and-requirements.md) - Fedora OS option added
- New [Scripts - Serialization](scripts/serialization.md) - Explanation of serialization
- Updated [Scripts - Public properties and fields](scripts/public-properties-and-fields.md) - Content improvements and additions
diff --git a/en/manual/nuget/create-packages.md b/en/manual/nuget/create-packages.md
index 4ac2f3ff6..4e6ec4a69 100644
--- a/en/manual/nuget/create-packages.md
+++ b/en/manual/nuget/create-packages.md
@@ -5,9 +5,6 @@
## Open your project in Visual Studio
-> [!Note]
-> Game Studio will later support creating NuGet packages directly.
-
First of all, after saving all your changes, open your project with Visual Studio. You can easily do this by clicking the appropriate button on the toolbar:
![Open project in Visual Studio](../game-studio/media/open-project-in-visual-studio.png)
diff --git a/en/manual/physics/fix-physics-jitter.md b/en/manual/physics/fix-physics-jitter.md
index 72a931613..be4371321 100644
--- a/en/manual/physics/fix-physics-jitter.md
+++ b/en/manual/physics/fix-physics-jitter.md
@@ -8,7 +8,7 @@ In Stride, there is no default smoothing applied to entities that are attached t
In this tutorial, we will explore how to add smoothing to an entity using a SyncScript.
> [!Note]
-> You can also decrease the `Fixed Time Step` in the physics settings configuration to achieve more accurate physics simulations. For example, changing it from `0.016667` to `0.008` will increase accuracy but at the cost of higher CPU usage.
+> You can also decrease the `FixedTimeStep` in the physics settings configuration to achieve more accurate physics simulations. For example, changing it from `0.016667` to `0.008` will increase accuracy but at the cost of higher CPU usage.
## Code to handle smoothing between two entities
The following code is all that's needed to smoothly attach two entities. Ensure that you unparent the entity you are trying to smooth, otherwise the transform processor will override this script.
@@ -42,7 +42,7 @@ public class SmoothFollowAndRotate : SyncScript
## Example Usage
-This example demonstrates modifications to the **First Person Shooter** Template to integrate smooth camera movement.
+This example demonstrates modifications to the **First Person Shooter** template to integrate smooth camera movement.
1. Detach the camera from the physics entity.
2. Remove the FPS camera script from the camera.
@@ -84,29 +84,32 @@ var inverseView = Matrix.Invert(camera.ViewMatrix);
```
to
-`var inverseView = camera.Transform.WorldMatrix;`
+
+```cs
+var inverseView = camera.Transform.WorldMatrix;
+```
### FpsCamera.cs
Remove
```cs
- ///
- /// Gets the camera component used to visualized the scene.
- ///
- private Entity Component;
+///
+/// Gets the camera component used to visualized the scene.
+///
+private Entity Component;
```
and change
```cs
- private void UpdateViewMatrix()
- {
- var camera = Component;
- if (camera == null) return;
- var rotation = Quaternion.RotationYawPitchRoll(Yaw, Pitch, 0);
-
- Entity.Transform.Rotation = rotation;
- }
+private void UpdateViewMatrix()
+{
+ var camera = Component;
+ if (camera == null) return;
+ var rotation = Quaternion.RotationYawPitchRoll(Yaw, Pitch0);
+
+ Entity.Transform.Rotation = rotation;
+}
```
to
diff --git a/en/manual/platforms/index.md b/en/manual/platforms/index.md
index 7c939e0c7..b950dbf5a 100644
--- a/en/manual/platforms/index.md
+++ b/en/manual/platforms/index.md
@@ -6,9 +6,9 @@ Stride is cross-platform game engine. This means you can create your game once,
## Supported platforms
-* Windows Desktop 7, 8, 10
-* Windows Universal (UWP)
-* [Linux (Ubuntu)](linux/index.md)
+* Windows 7, 8, 10
+* Windows Universal Platform (UWP)
+* [Linux](linux/index.md)
* Android 2.3 and later
* [iOS 8.0 and later](ios.md)
diff --git a/en/manual/platforms/linux/setup-and-requirements.md b/en/manual/platforms/linux/setup-and-requirements.md
index e08738b75..d9fdcee96 100644
--- a/en/manual/platforms/linux/setup-and-requirements.md
+++ b/en/manual/platforms/linux/setup-and-requirements.md
@@ -13,7 +13,7 @@ You need the following packages:
* [FreeType](#freetype)
* [OpenAL](#openal)
* [SDL2](#sdl2)
-* [Latest .NET](https://dotnet.microsoft.com/en-us/download)
+* [FreeImage](#freeimage)
## FreeType
@@ -87,16 +87,31 @@ sudo pacman -S sdl2
---
-## .NET
+## FreeImage
-For information about how to install .NET, see the [.NET instructions for Linux](https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites).
+[FreeImage](https://freeimage.sourceforge.io/) is battle-tested library for loading and saving popular image file formats like BMP, PNG, JPEG etc. The minimum required version is 3.18 and can be installed via:
-We recommend to install .NET 8. To check which version you have installed, type:
+### [Debian / Ubuntu](#tab/freeimage-ubuntu)
+
+```bash
+sudo apt install libfreeimage-dev
```
-dotnet --info
+
+### [Fedora](#tab/freeimage-fedora)
+
+```bash
+sudo dnf install freeimage-devel
```
+### [Arch](#tab/freeimage-arch)
+
+```bash
+sudo pacman -S freeimage
+```
+
+---
+
## See also
* [Create a Linux game](create-a-linux-game.md)
diff --git a/en/manual/requirements/index.md b/en/manual/requirements/index.md
index af5f336ba..5df7c1ede 100644
--- a/en/manual/requirements/index.md
+++ b/en/manual/requirements/index.md
@@ -11,13 +11,15 @@ To develop projects with Stride, you need:
| CPU | x64
| GPU | Direct3D 10+ compatible GPU
| RAM | 4GB (minimum), 8GB (recommended) [see (2)]
+| .NET SDK | 8+ [see (3)] |
(1) Earlier versions of Windows _may_ work but are untested.
(2) RAM requirements vary depending on your project:
* Developing simple 2D applications doesn't require much RAM.
* Developing 3D games with lots of assets requires larger amounts of RAM.
-
+
+(3) .NET SDK is being downloaded with the Stride installer.
## Mobile development requirements
@@ -25,10 +27,10 @@ To develop for mobile platforms, you also need:
| Platform | Requirements
|----------|-------
-| Android | Xamarin [see (3)]
-| iOS | Mac computer, Xamarin [see (3)]
+| Android | Xamarin [see (4)]
+| iOS | Mac computer, Xamarin [see (4)]
-(3) Xamarin is included with Visual Studio installations. For instructions about how to install Xamarin with Visual Studio, see [this MSDN page](https://docs.microsoft.com/en-us/visualstudio/cross-platform/setup-and-install).
+(4) Xamarin is included with Visual Studio installations. For instructions on installing Xamarin with Visual Studio, see [this MSDN page](https://docs.microsoft.com/en-us/visualstudio/cross-platform/setup-and-install).
## Running Stride Games
diff --git a/en/manual/scripts/gizmos.md b/en/manual/scripts/gizmos.md
new file mode 100644
index 000000000..be60d4c8a
--- /dev/null
+++ b/en/manual/scripts/gizmos.md
@@ -0,0 +1,172 @@
+# Gizmos
+
+Intermediate
+Programmer
+
+**Gizmos** are a tool which you can implement over your components to provide visual assistance for designers when manipulating component values.
+
+Here's an exhaustive example one could implement:
+```cs
+using Stride.Core;
+using Stride.Core.Mathematics;
+using Stride.Engine;
+using Stride.Engine.Gizmos;
+using Stride.Graphics;
+using Stride.Graphics.GeometricPrimitives;
+using Stride.Rendering;
+using Stride.Rendering.Materials;
+using Stride.Rendering.Materials.ComputeColors;
+
+// We will be implementing a Gizmo for the following class
+public class MyScript : StartupScript
+{
+
+}
+
+// This attribute specifies to the engine that the following gizmo class is bound to 'MyScript',
+// the game studio will pick that up and spawn an instance of that class for each 'MyScript' in the scene
+[GizmoComponent(typeof(MyScript), isMainGizmo:false/*When true, only the first gizmo on an entity with true is visible, false means that it is always visible*/)]
+public class Gizmo : IEntityGizmo
+{
+ private bool _selected, _enabled;
+ private MyScript _component;
+ private ModelComponent _model;
+ private Material _material, _materialOnSelect;
+
+ // This property is set based on whether the gizmo is globally turned on or off in the editor's view settings
+ public bool IsEnabled
+ {
+ get
+ {
+ return _enabled;
+ }
+ set
+ {
+ _enabled = value;
+ _model.Enabled = _enabled;
+ }
+ }
+
+ // The size slider value in the view settings pane
+ public float SizeFactor { get; set; }
+
+ // The editor will set this property whenever the entity the component is on is selected
+ public bool IsSelected
+ {
+ get
+ {
+ return _selected;
+ }
+ set
+ {
+ _selected = value;
+ _model.Materials[0] = _selected ? _materialOnSelect : _material;
+ // The logic below shows gizmos for all components when they are on in the gizmo settings, and when off, only shows the one from the selected entity
+ // Removing the line hides gizmos even when selected when the gizmo settings is off
+ _model.Enabled = _selected || _enabled;
+ }
+ }
+
+ // This constructor is called by the editor,
+ // A gizmo class MUST contain a constructor with a single parameter of the component's type
+ public Gizmo(MyScript component)
+ {
+ _component = component;
+ }
+
+ public bool HandlesComponentId(OpaqueComponentId pickedComponentId, out Entity? selection)
+ {
+ // This function is called when scene picking/mouse clicking in the scene on a gizmo
+ // The engine calls this function on each gizmos, gizmos in term notify the engine
+ // when the given component comes from them by returning true, and provide the editor with the corresponding entity this gizmo represents
+ if (pickedComponentId.Match(_model))
+ {
+ selection = _component.Entity;
+ return true;
+ }
+ selection = null;
+ return false;
+ }
+
+ public void Initialize(IServiceRegistry services, Scene editorScene)
+ {
+ // As part of initialization, we create a model in the editor scene to visualize the gizmo
+ var graphicsDevice = services.GetSafeServiceAs().GraphicsDevice;
+
+ // In our case we'll just rely on the GeometricPrimitive API to create a sphere for us
+ // You don't have to create one right away, you can delay it until the component is in the appropriate state
+ // You can also dynamically create and update one in the Update() function further below
+ var sphere = GeometricPrimitive.Sphere.New(graphicsDevice);
+
+ var vertexBuffer = sphere.VertexBuffer;
+ var indexBuffer = sphere.IndexBuffer;
+ var vertexBufferBinding = new VertexBufferBinding(vertexBuffer, new VertexPositionNormalTexture().GetLayout(), vertexBuffer.ElementCount);
+ var indexBufferBinding = new IndexBufferBinding(indexBuffer, sphere.IsIndex32Bits, indexBuffer.ElementCount);
+
+ _material = Material.New(graphicsDevice, new MaterialDescriptor
+ {
+ Attributes =
+ {
+ Emissive = new MaterialEmissiveMapFeature(new ComputeColor(new Color4(0.25f,0.75f,0.25f,0.05f).ToColorSpace(graphicsDevice.ColorSpace))) { UseAlpha = true },
+ Transparency = new MaterialTransparencyBlendFeature()
+ },
+ });
+ _materialOnSelect = Material.New(graphicsDevice, new MaterialDescriptor
+ {
+ Attributes =
+ {
+ Emissive = new MaterialEmissiveMapFeature(new ComputeColor(new Color4(0.25f,0.75f,0.25f,0.5f).ToColorSpace(graphicsDevice.ColorSpace))) { UseAlpha = true },
+ Transparency = new MaterialTransparencyBlendFeature()
+ },
+ });
+
+ _model = new ModelComponent
+ {
+ Model = new Model
+ {
+ (_selected ? _materialOnSelect : _material),
+ new Mesh
+ {
+ Draw = new MeshDraw
+ {
+ StartLocation = 0,
+ // You can swap to LineList or LineStrip to show the model in wireframe mode, you'll have to adapt your index buffer to that new type though
+ PrimitiveType = PrimitiveType.TriangleList,
+ VertexBuffers = new[] { vertexBufferBinding },
+ IndexBuffer = indexBufferBinding,
+ DrawCount = indexBuffer.ElementCount,
+ }
+ }
+ },
+ RenderGroup = IEntityGizmo.PickingRenderGroup, // This RenderGroup allows scene picking/selection, use a different one if you don't want selection
+ Enabled = _selected || _enabled
+ };
+
+ var entity = new Entity($"{nameof(Gizmo)} for {_component.Entity.Name}"){ _model };
+ entity.Transform.UseTRS = false; // We're controlling the matrix directly in this case
+ entity.Scene = editorScene;
+
+ vertexBuffer.DisposeBy(entity);
+ indexBuffer.DisposeBy(entity); // Attach buffers to the entity for manual disposal later
+ }
+
+ public void Dispose()
+ {
+ _model.Entity.Scene = null;
+ _model.Entity.Dispose(); // Clear the two buffers we attached above
+ }
+
+ public void Update()
+ {
+ // This is where you'll update how the gizmo looks based on MyScript's state
+ // Here we'll just ensure the gizmo follows the entity it is representing whenever that entity moves,
+ // note that UseTRS is disabled above to improve performance and ensure that there are no world space issues
+ _model.Entity.Transform.LocalMatrix = _component.Entity.Transform.WorldMatrix;
+ }
+}
+```
+And the result:
+
+![Green sphere gizmo](media/gizmo.png)
+
+Do note that you may have to restart the editor if it was open while you introduced this new gizmo.
\ No newline at end of file
diff --git a/en/manual/scripts/index.md b/en/manual/scripts/index.md
index 3cc081fbc..96aa06820 100644
--- a/en/manual/scripts/index.md
+++ b/en/manual/scripts/index.md
@@ -39,4 +39,5 @@ You can still use standard C# classes in Stride, but these aren't called scripts
* [Events](events.md)
* [Debugging](debugging.md)
* [Preprocessor variables](preprocessor-variables.md)
-* [Create a model from code](create-a-model-from-code.md)
\ No newline at end of file
+* [Create a model from code](create-a-model-from-code.md)
+* [Create Gizmos for you components](gizmos.md)
\ No newline at end of file
diff --git a/en/manual/scripts/media/gizmo.png b/en/manual/scripts/media/gizmo.png
new file mode 100644
index 000000000..bc199a16e
--- /dev/null
+++ b/en/manual/scripts/media/gizmo.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0a62f0db688ba96190cb147747afcb9c43818717b62eb334f86ca6a0dceb0c86
+size 92679
diff --git a/en/manual/scripts/types-of-script.md b/en/manual/scripts/types-of-script.md
index c40162fd7..1efae7183 100644
--- a/en/manual/scripts/types-of-script.md
+++ b/en/manual/scripts/types-of-script.md
@@ -16,10 +16,10 @@ Example:
```cs
public class StartUpScriptExample : StartupScript
{
- public override void Start()
- {
- // Do some stuff during initialization
- }
+ public override void Start()
+ {
+ // Do some stuff during initialization
+ }
}
```
@@ -36,10 +36,10 @@ The following script performs updates every frame, no matter what:
```cs
public class SampleSyncScript : SyncScript
{
- public override void Update()
- {
- // Performs the update on the entity — this code is executed every frame
- }
+ public override void Update()
+ {
+ // Performs the update on the entity — this code is executed every frame
+ }
}
```
@@ -48,7 +48,6 @@ public class SampleSyncScript : SyncScript
Asynchronous scripts are initialized only once, then canceled when removed from the scene.
* Asynchronous code goes in the [Execute](xref:Stride.Engine.AsyncScript.Execute) function.
-
* Code performing the cancellation goes in the [Cancel](xref:Stride.Engine.ScriptComponent.Cancel) method.
The following script performs actions that depend on events and triggers:
@@ -56,22 +55,38 @@ The following script performs actions that depend on events and triggers:
```cs
public class SampleAsyncScript : AsyncScript
{
- public override async Task Execute()
- {
- // The initialization code should come here, if necessary
-
- while (Game.IsRunning) // loop until the game ends (optional depending on the script)
- {
- await MyEvent;
-
- // Do some stuff
-
- await Script.NextFrame(); // wait for the next frame (optional depending on the script)
- }
- }
+ public override async Task Execute()
+ {
+ // The initialization code should come here, if necessary
+ // This method starts running on the main thread
+
+ while (Game.IsRunning) // loop until the game ends (optionalpendingon the script)
+ {
+ // We're still on the main thread
+
+ // Task.Run will pause the execution of this method until the task is completed,
+ // while that's going on, the game will continue running, it will display new frames and process inputs appropriately
+ var lobbies = await Task.Run(() => GetMultiplayerLobbies());
+
+ // After awaiting a task, the thread the method runs on will have changed,
+ // this method now runs on a thread pool thread instead of the main thread
+ // You can manipulate the data returned by the task here if needed
+ // But if you want to interact with the engine safely, you have to make sure the method runs on the main thread
+
+ // await Script.NextFrame() yields execution of this method to the main thread,
+ // meaning that this method is paused, and once the main thread processes the next frame,
+ // it will pick that method up and run it
+ await Script.NextFrame();
+ // So after this call, this method is back on the main thread
+
+ // You can now safely interact with the engine's systems by displaying the lobbies retrieved above in a UI for example
+ }
+ }
}
```
+Check out an example from our [Async scripts tutorial](../../tutorials/csharpintermediate/async-scripts.md).
+
## See also
* [Create a script](create-a-script.md)
@@ -80,4 +95,4 @@ public class SampleAsyncScript : AsyncScript
* [Scheduling and priorities](scheduling-and-priorities.md)
* [Events](events.md)
* [Debugging](debugging.md)
-* [Preprocessor variables](preprocessor-variables.md)
\ No newline at end of file
+* [Preprocessor variables](preprocessor-variables.md)
diff --git a/en/manual/toc.yml b/en/manual/toc.yml
index 0d9a02fb3..3b89b3431 100644
--- a/en/manual/toc.yml
+++ b/en/manual/toc.yml
@@ -118,6 +118,8 @@ items:
href: engine/entity-component-system/usage.md
- name: Manage entities
href: engine/entity-component-system/managing-entities.md
+ - name: Flexible processing
+ href: engine/entity-component-system/flexible-processing.md
- name: File system
href: engine/file-system.md
- name: Build pipeline
@@ -496,6 +498,8 @@ items:
href: scripts/preprocessor-variables.md
- name: Create a model from code
href: scripts/create-a-model-from-code.md
+ - name: Create Gizmos for you components
+ href: scripts/gizmos.md
- name: Sprites
href: sprites/index.md
diff --git a/en/manual/troubleshooting/stride-doesnt-run.md b/en/manual/troubleshooting/stride-doesnt-run.md
index dfb20a46b..3e2d6eafc 100644
--- a/en/manual/troubleshooting/stride-doesnt-run.md
+++ b/en/manual/troubleshooting/stride-doesnt-run.md
@@ -43,7 +43,7 @@ If you have Visual Studio 2022 (or later) installed, you need to have the follow
* **.NET desktop development** with **Development tools for .NET** optional component enabled.
> [!Note]
-> Earlier versions might work with older version of Stride. However, for Stride 4.2 and later you need to have .NET 8 support.
+> Earlier versions might work with older version of Stride. However, for Stride 4.2 and later you only need to have .NET 8 SDK installed.
### Build Tools for Visual Studio 2022 (optional)
diff --git a/en/toc.yml b/en/toc.yml
index 6508c1dbc..c4c808ee8 100644
--- a/en/toc.yml
+++ b/en/toc.yml
@@ -23,6 +23,6 @@
# - name: 🔍 Diagnostics
# href: diagnostics/
# homepage: diagnostics/index.md
-- name: 🏋🏽 Community resources ⭐New
+- name: 🏋🏽 Community resources
href: community-resources/
homepage: community-resources/index.md
\ No newline at end of file
diff --git a/en/tutorials/toc.yml b/en/tutorials/toc.yml
index 55a98778f..9b43fd3c2 100644
--- a/en/tutorials/toc.yml
+++ b/en/tutorials/toc.yml
@@ -76,7 +76,7 @@ items:
href: csharpintermediate/ui-basics.md
- name: Collision triggers
href: csharpintermediate/collision-triggers.md
- - name: Racyasting
+ - name: Raycasting
href: csharpintermediate/raycasting.md
- name: Project and Unproject
href: csharpintermediate/project-and-unproject.md
diff --git a/jp/manual/files-and-folders/distribute-a-game.md b/jp/manual/files-and-folders/distribute-a-game.md
index 738550fc7..5a55dae4a 100644
--- a/jp/manual/files-and-folders/distribute-a-game.md
+++ b/jp/manual/files-and-folders/distribute-a-game.md
@@ -57,7 +57,7 @@
Stride で作成されたゲームを Windows で実行するには、次のものが必要です。
-* .NET 4.6.1
+* .NET 8 SDK
* DirectX11 (Windows 10 以降に含まれます)、OpenGL、または Vulkan
diff --git a/jp/manual/graphics/textures/skyboxes-and-backgrounds.md b/jp/manual/graphics/textures/skyboxes-and-backgrounds.md
index 2aaaec5c6..aad855ffd 100644
--- a/jp/manual/graphics/textures/skyboxes-and-backgrounds.md
+++ b/jp/manual/graphics/textures/skyboxes-and-backgrounds.md
@@ -124,6 +124,7 @@ Instead of using a cubemap, you can use a **360° panoramic texture** as a 3D ba
| 360° パノラマ | ゲームでの見た目
|----------------|-------------
| ![Panorama texture](media/MyPanorama.jpg) | ![Panorama in game](media/panorama-in-game.jpg)
+
*画像提供: [Texturify](http://texturify.com)*