stride3d / stride3d/stride

Making NET 5 code-only projects easier to setup.

Open
#986 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-Build enhancement
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

I prefer coding my games without a bloated engine ui. Especially to have more control over how my projects load assets and definitions. I started by setting up a new solution, adding two projects: MyGame and MyGame.Desktop.
Both projects are using <TargetFramework>net5.0</TargetFramework>.

To be able to code my base game, i added Stride.Engine to the MyGame project using nuget and extended my base class from Stride.Engine.Game. For the MyGame.Desktop project i then added the <OutputType>exe</OutputType>

Expected result: The game starts up, and gives me a black screen. Sadly this did not work as expected and several different steps were required to get the whole thing running at all:

First of all the platform natives were not found. After a while of searching, i found the solution: <RuntimeIdentifier>win-x64</RuntimeIdentifier> has to be added to the MyGame.Desktop project. Thats the first thing i would wish for net5 projects to be not required.

After the natives were properly resolved, the game still crashed due to the engines internal shaders being found. Took me a while to figure out the solution: add Stride.Core.Assets.CompilerApp to the MyGame.Desktop project. This is the second ugly problem in my eyes. Requiring this package for the engines internal shaders is again just an additional problem you will encounter. People will expect the engine package to include the required dependencies by itself.

However as soon as the above package is added, you will encounter another new error: It expects some engine specific asset files to be available: GameSettings.sdgamesettings and MyGame.Desktop.sdpkg. This is again something which should be changed, as to get it running all it needs is:
GameSettings.sdgamesettings

!GameSettingsAsset
SerializedVersion: {Stride: 3.1.0.0}

MyGame.Desktop.sdpkg

!Package
SerializedVersion: {Assets: 3.1.0.0}
AssetFolders:
    -   Path: !dir .

As the two files are basically empty, except the path, which points to the current directory (which should be the default in my eyes), it should be able to skip them for a code-only setup. This is again another problem people will come up with.

After those shaders were properly copied, the game still crashes on startup, but this time its not a project setup problem, but more code based: You need to setup the GraphicsCompositor. This can luckily be done using the GraphicsCompositorHelper.CreateDefault(false); method. I wont concider this one a problem which needs to be adressed, but it makes this issue complete regarding everything someone must do to setup a code-only project.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two-project MyGame and MyGame.Desktop setup targeting net5.0, starting with the project settings for RuntimeIdentifier, OutputType, Stride.Engine, and Stride.Core.Assets.CompilerApp. Determine whether a code-only project can start without manual native, shader, and asset-file setup; done means those prerequisites are handled automatically, while GraphicsCompositor configuration remains required.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.