Skip to content

Plugins 1/12: companion packages - #3535

Merged
xen2 merged 11 commits into
masterfrom
feature/plugins/1-companions
Oct 15, 2026
Merged

xen2 merged 11 commits into
masterfrom
feature/plugins/1-companions

Conversation

@xen2

@xen2 xen2 commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

The plugin stack

A Stride plugin becomes a runtime package plus up to two companion packages that only the tools load: .Assets (asset types, compilers, templates; loaded by the asset compiler and Game Studio) and .Editor (Game Studio parts, with an optional .Editor.Wpf for views).

A game references the runtime only. Game Studio finds its features through declarations instead of hand-written lists, and the optional engine features move into this shape, so the editor and the asset compiler no longer reference them.

The user documentation is docs/build/plugins.md (#3544).

To see a complete plugin, create one from the stride-plugin template (dotnet new stride-plugin, or Add plugin in Game Studio), added in #3544.

# PR Content
1 #3535 Companion packages Declaring, packing and loading companion packages (this PR)
2 #3536 Editor and engine extension points Editor companions in Game Studio; declarations replace the editor's lists
3 #3538 Asset file extensions and upgrade helpers AssetFileExtension, package upgrader for plugin assets, MoveTypes
4 #3539 Bepu Stride.BepuPhysics.Assets, Stride.Assets.VHACD
5 #3540 Video Stride.Video.Assets, Stride.Video.Editor
6 #3541 Bullet physics and navigation Stride.Physics.Assets, Stride.Physics.Editor
7 #3542 SpriteStudio and Voxels Stride.SpriteStudio.Assets, Stride.SpriteStudio.Editor, Stride.Voxels.Editor
8 #3543 Audio Audio leaves the engine; Stride.Audio.Assets, Stride.Audio.Editor; project and code upgrade
9 #3544 Plugin authoring stride-plugin template, Add plugin, docs, toolkit-specific Editor packages, package render features
10 #3545 Reload and unload Rebuilding a plugin project while Game Studio is open
11 #3546 Particles, Audio views Stride.Particles.Editor, Stride.Audio.Editor.Wpf
12 #3547 UI Stride.UI.Assets, Stride.UI.Editor, Stride.UI.Editor.Wpf

Later, not in this stack: limiting Game Studio's lists (Add asset, Add component, type pickers) to what the edited project can use, and a plugin browser.


Stack: 1/12, on top of master. Merge in order. Review only the commits of this PR.

This PR adds companion packages: how a plugin declares them, how they are packed, and how the asset compiler and Game Studio load them.

No engine package uses them yet; PR 4 and later move the optional engine features into this shape.

How a plugin declares its companions

  • The companion project says what it is: <StridePackageKind>Assets</StridePackageKind> (or Editor).
  • The runtime project lists its companions:
    <StrideCompanionProject Include="..\MyPlugin.Assets\MyPlugin.Assets.csproj" />
    or, for a companion from a feed, <StrideCompanionPackage Include="MyPlugin.Assets" Version="1.2.0" Kind="Assets" />.
  • The companion's id, version and kind are read from its project and recorded in the runtime's packed .sdpkg.
  • Replaces="MyPlugin.Assets" lets a game use its own companion instead of a plugin's.

Changes

  • Loading: each declared Assets companion loads at its declared version, from the session, the local dev store, or a NuGet restore. Companions of companions load too.
  • Checks: a missing companion, or a wrong version or kind, is an error. A game that references a companion directly gets a warning.
  • Plugins in the game's solution: the game builds the companions of the plugins it references as projects, without shipping them.
  • Compile errors: an asset whose type is not loaded now fails the build instead of being skipped silently.
  • Rename: AssetAssemblies is now HostAssemblies in the .sdpkg (the old name still loads).

Impact on games and plugins

  • Games: nothing to do. An asset of a type no package provides is now a build error instead of being skipped.
  • Plugin authors: splitting a plugin is optional. All its packages must be published at the same version.

Testing

  • New packaging tests (CompanionPackageTests): restore from a feed, missing companion, version and kind checks, direct reference warning, companion of a companion, plugin projects in the game's solution, replacement by the game.
  • New unit tests for the build manifest and for companions after a dependency list is rebuilt.
  • To try: existing projects open and build as before, since no engine package declares companions yet.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🤖 Draft PR — automatic CI is skipped to save runner minutes.

  • Mark the PR ready for review to run the full automatic CI — or add a ci-run-on-draft label to run it now without leaving draft.
  • Or arm a specific opt-in suite: ci-enduser, ci-editor, ci-ios, ci-android.

@xen2
xen2 added this pull request to stack #3537 October 8, 2026 04:50
@xen2 xen2 added area-Asset area-Build enhancement New feature or request labels Oct 8, 2026
@xen2
xen2 marked this pull request as ready for review October 10, 2026 07:49
@xen2
xen2 force-pushed the feature/plugins/1-companions branch 2 times, most recently from ffff919 to df3cefc Compare October 12, 2026 23:48
@xen2

xen2 commented Oct 13, 2026 •

Copy link
Copy Markdown
Member Author

@Kryptos-FR
Thanks for the detailed review.
For reference, here it is: https://claude.ai/artifact/W3JaMuUcY3ryTbkyp1oPqw#396159ae-23af.my0fec0qv15.52067
Here is where each finding stands after the latest push, by PR.

Fixes are folded into the commits of the PR they belong to. Unchecked items are not addressed in this stack; most are follow-ups, a few are open questions.

#3535 Companion packages

  • Companion version fell back to 1.0.0 off Windows and outside a Stride checkout (the CI blocker)
  • Native library probing: relative directories skipped, RID-flattened native libraries registered
  • An unloadable asset is an error in game builds only; previews, thumbnails and the editor game warn and go on
  • Off Windows, a game build leaves out a companion that targets Windows only, instead of restoring it
  • AssetAssemblies → HostAssemblies: an [Obsolete] alias keeps the 4.4 API; the YAML reads both names
  • Companion restore reads only NuGet.config (RestoreSources, RestorePackagesPath, fallback folders, lock files)
  • Companion-of-companion versions depend on load order
  • Companion loading runs 3 times on solution open
  • The in-build restore of companions recurses into the runtime project
  • The host framework comes from the OS, not the process
  • CompanionPackage.Project is recorded but never read
  • -windows host assemblies of a multi-targeted project are recorded under the wrong folder (latent)

#3536 Editor discovery

  • [GameSystem] under trimming/AOT: the assembly processor emits [DynamicDependency] for each declared system
  • Inherited = false is honoured, and a failing constructor names the type
  • Editor games (scene, prefab, preview) create only the systems marked [GameSystem(Editor = true)] (audio is); creation order is fixed
  • Late discovery: each handler is isolated and logged; no synchronous Dispatcher.Invoke under the loader lock
  • AddService(Type, object) is on ServiceRegistry only, not on IServiceRegistry
  • [EditorGameService] is not inherited
  • TypeImage, StaticThumbnail and EnumImage are data-only attributes in Stride.Core.Assets; WPF reads them; no WPF method on the plugin base class
  • Registries written from loader threads and read from UI and game threads
  • Template prompt paths validated on their first segment only
  • EditorOverlay.VisibleByDefault never applies (latent)
  • ffmpeg probe: no timeout, arguments built by string interpolation
  • EditorSettingsAttribute and the template generators still live in WPF assemblies

#3538 Asset file extensions

  • .sdnavmesh maps to Stride.Navigation
  • STRDIAG014: a declaration in the Assets assembly no longer silences it; tests named Warning_*
  • The asset types that left the engine keep an untyped constant, and a new warning (STRDIAG015) names the package to reference
  • The package upgrader matches Stride.Engine case-insensitively, copies its Condition, and warns when Stride.Engine comes from an imported file
  • MoveTypes is dropped from the stack (no caller); it can land with its first use
  • Docs: only .sd* files get constants
  • The generator does not validate declared content types (internal type, conflicting declarations)
  • The upgrader scans the project folder rather than the package's AssetFolders
  • Nits: stale generator comment, a log line, the STRDIAG014 help link

#3539 Bepu

  • Three copies of the fill-mode enum; FillMode changes type
  • ConvexHullMesh is public with rough edges
  • Stride.Assets still references Stride.Assets.VHACD and Stride.Assets.FFmpeg
  • InternalsVisibleTo for Stride.BepuPhysics.Assets

#3540 Video

  • The companion version check (CI red from here on)
  • Texture.Swap rejects null and a texture of another device; its doc states what it does not move
  • A placeholder video's null URL serializes back as ""
  • Video knowledge left in core (sound importer extensions, AssemblyRecompiler)

#3541 Bullet

  • The Linux asset compiler loads Stride.Physics again (libbulletc preload no longer throws)
  • Game Studio sets Simulation.DisableSimulation again (from the Physics Editor package); the IsDisabled doc and mode check are fixed
  • Heightmap and texture importers: a stable order, the texture importer first
  • Navigation assets live in the Physics companion (open question: its own Assets companion before the Bullet rename?)

#3542 SpriteStudio and Voxels

  • ModelPreviewView is no longer registered for the open generic PreviewFromEntity<>; SpriteStudio declares its own view
  • SpriteStudioComponent.LocalBounds getter has side effects
  • DerivedFrom is undocumented and DerivedAssetTemplateGenerator untested
  • Voxels has no plugin class (question: should the docs call the plugin class optional?)

#3543 Audio

  • MemberToExtension: identifier guard, cref and named-argument cases; each upgrade isolated in the runner
  • Game.Audio needs C# 14: the upgrader warns when LangVersion is lower
  • The log now says to remove Stride.Audio if the project does not use audio
  • The [GameSystem] direct-reference rule is documented
  • The moved sound preview loses its translations; the inserted using can land above the license header

#3544 Plugin authoring

  • Toolkit: an Editor package built on the WPF editor is Wpf automatically; solution projects are filtered too; a skipped package is logged; unknown toolkit names warn
  • Dotted plugin names (Acme.Fog): projects and namespaces keep the dots, types take the last segment
  • Startup dialog names and template packing (source name): fixed; Add plugin finds the created projects by kind and cleans up on failure
  • The template's Editor project sets EnableWindowsTargeting
  • Add plugin restores the game and updates its dependencies; the new reference shows in Game Studio
  • Add dependency offers a plugin reachable only transitively, marked "already available"
  • Template: shipped assets in the Assets package, as the docs say; PackageTags comment removed; "Plugin name:" prompt
  • Package.Toolkit is not saved in a solution .sdpkg
  • IThumbnailComponent is an editor concern in Stride.Engine
  • Render-feature providers find stages by literal names
  • Docs gaps: version source, publishing and consuming, debugging

#3545 Assembly reload

  • Reloading a root asset with a source file ("Assets must have the same source")
  • The whole dependent set builds first; one failed build reloads nothing
  • Returning assets go through their upgraders, for every format key
  • Open editors of the affected assets are closed before a reload or unload (their changes stay in the session)
  • Each asset is restored on its own
  • Asset view models are not recreated
  • Unload leaks (name map, static images, resource dictionaries)
  • The WPF/BAML type-name fallback is global
  • Host assemblies matched by simple name win over the game's deps.json
  • A loadability flip does not expand to dependents

#3546 Particles and #3547 UI

  • The compositor upgrader removes a plugin's render feature only when the project's restore had no errors and it neither resolves nor declares the plugin; otherwise the feature is kept. Both cases log a warning
  • Samples packaging gap (NU1101) and the core suites' version failures
  • The Particles test checks that only an Editor companion is declared
  • Stride.Core no longer grants its internals to Stride.UI
  • Stride.Graphics, Stride.Input and Stride.Games still grant their internals to Stride.UI (text and sprite drawing, PointerEvent.DeltaPosition, the Android edit-text popup): needs a public API, planned as a follow-up
  • Stride.UI.Editor grants its internals to Stride.UI.Editor.Wpf
  • The compositor decision is per package (a library vs. its executable)
  • Compositors with a rotated archetype id are skipped
  • The UI design sheet URL rewrite is silent; the packaging fixture uses a bare reference
  • A view model uses a WPF view-layer constant

CI fixes found along the way

  • Linux/macOS: a plugin assembly loaded by the asset compiler resolves its native libraries (its load context gets the resolver too)
  • The in-build restore of Assets companions runs only for a companion never restored or changed since (it collided with the solution restore)
  • Packaging tests delete each case's temp tree (one full run filled the Windows runner's disk)
  • Tests for the 4.5 audio project upgrade
  • The Linux packaging job sets up Lavapipe (a shared action, also used by the Linux screenshot job), so its consumers compile assets that need a graphics device (a skybox, a model for a Bepu hull), and the consumers' runtime content checks run off Windows too; the skips are removed, and the consumer fixture names its platform as a game's platform project does
  • "Referenced build manifest not found": a build that reads another project's manifest requested only its Build, which could return while another request was still writing the manifest (an AfterTargets hook). It now requests the manifest target itself (seen on ApiNeutral, and in 3 of 5 iOS builds)
  • An Assets companion is built without the graphics API and the test SDK's own globals: on iOS the test suites' companion builds built the whole engine a second time
  • CI: ApiNeutral audits its build for parallel-build races #3576 (merged): ParallelBuildAuditor reports this kind of hook race, and the ApiNeutral job audits its own build
  • The manifest is also written before CoreCompile, so any Build of a project returns once its manifest is written (the audit still found overlaps on Stride.slnx and on companions)

Game Studio manual test (2026-10-14/15)

A manual pass in Game Studio (upgrade, Add dependency, previews, plugin authoring, reload, removing a plugin) found these; all fixed in the PR they belong to:

Also planned

  • Build time of the manifest target: one reference query instead of two or three, and a companion's identity without an extra evaluation; measure master against the stack first

@xen2
xen2 force-pushed the feature/plugins/1-companions branch 3 times, most recently from 3e34253 to 7e5ef4c Compare October 13, 2026 10:43
@xen2

xen2 commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

The unchecked items from the review are now tracked in #3580 (before 4.5) and #3581 (later).

@xen2
xen2 force-pushed the feature/plugins/1-companions branch from 7e5ef4c to 8dfcfb9 Compare October 14, 2026 09:20
xen2 added 11 commits October 15, 2026 00:56
…anifest (a companion project states its kind, StridePackageKind; the runtime lists its companion projects or packages, whose id, version and kind are read from them at build and pack time; Replaces drops a companion declared elsewhere)
…, dev-redirect or NuGet restore); error on unloadable assets at compile
…ion mismatch, own version, missing kind, direct reference, project reference, replacement by the game)
…ts project references and lists their manifests (CompanionManifests) for the asset compiler, so a game references an in-solution plugin's runtime project only; the declaring project restores a companion that was never restored, so its manifest and packed sdpkg always carry the id (the pack-time resolution target is gone)
…set type deriving from that plugin's); one that comes with a companion's restore closure loads as a companion, without the direct-reference warning
… dependency) gets back the companions the session loaded for its packages
…registers the native libraries a RID build flattens next to the assembly (managed DLLs skipped)
…s its own NuGet restore of over 1 GB, and a full run filled a CI runner's disk); STRIDE_KEEP_TEST_DIRS keeps them
…x action, also used by the Linux screenshot job), so its consumers compile assets that need a graphics device; the consumers' runtime content checks run off Windows too
…deWriteAssetBuildManifest with its path (references, Assets companions, the test SDK's wait for the Game build): that project's Build could return while another request was still writing it (a hook of ResolveProjectReferences, which that Build found completed); StrideWriteAssetBuildManifest depends on ResolveProjectReferences, so it can be requested on its own
…he test SDK's own globals of the build that builds it (StrideCompanionBuildRemoveProperties, which the test SDK fills), as a project reference would be: on iOS the whole engine graph was built a second time from the test suites' companion builds
@xen2
xen2 force-pushed the feature/plugins/1-companions branch from 8dfcfb9 to b12cd43 Compare October 14, 2026 16:17
@xen2
xen2 merged commit f718431 into master Oct 15, 2026
33 checks passed
@xen2
xen2 deleted the feature/plugins/1-companions branch October 15, 2026 01:32
@xen2 xen2 added the area-Plugins Plugin system: companion packages, editor and engine extension points, plugin authoring label Oct 15, 2026
This was referenced Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Asset area-Build area-Plugins Plugin system: companion packages, editor and engine extension points, plugin authoring enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant