You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Although its completely undocumented, Stride is very close to having a robust real-time solution to loading external asset databases in real-time within a running game instance. Now, I've looked at the inner workings of the ContentManager, file providers, and database classses and what is happening in there is not straight forward, so I may be missing something. Afterall, I have no idea how the editor is able to load assets in real time like it does.
I've been able to place assets in a class library, force it to compile the assets to a content database via <StrideIsExecutable>true</StrideIsExecutable>, and load the assets into a ContentManager with the following code
ContentManager buildContentManager(string modDirectory)
{
var contentDbPath = Path.Combine(modDirectory, _contentDbPath); // contentDbPath is data/db
// stride needs something for the root path in order for everything to work.
var id = "/" + Guid.NewGuid();
// file provider does some special self registration
_ = new FileSystemProvider(id, contentDbPath);
var objectDb = new ObjectDatabase(id, "index", "/local/db");
var databaseProvider = new DatabaseFileProvider(objectDb);
var service = new DatabaseFileProviderService(databaseProvider);
var contentManager = new ContentManager(service);
return contentManager;
}
The problem I think I'm running into however, is that the game's content manager and its database provider are coupled tightly with other areas of game code including render logic. So although I'm able to load, say a model from the mod's content manager successfully, placing it in the scene does not have it rendered. Presumably, this is because some other code is looking for that model in the game's content manager.
Describe the solution you'd like
Please note I'm not too familiar with Stride's codebase, so I may be spitballing bad ideas here.
I think the easiest solution would be to create "Patching" methods to the game's content manager so that I can place content within but have them only exist in memory. Likewise, an unpatch method to remove the asset.
Another solution would be to decouple other areas of code to a given content manager. It smells like a codesmell that somehow somewhere in the code a model is being referenced back to the content manager. I may be missing something, this may not even be the case.
A more proper solution is probably a richer ContentManager that can infer from multiple sources.
Finally, in any case, I think documentation on how to go about making a Stride game moddable in terms of assets would be of great value.
Describe alternatives you've considered
I have been able to get a working solution by saving assets loaded from a mod's ContentManager into the game's ContentManager at runtime. This isn't elegant however, because it clutters the game's database with mod files that would have to be cleaned up and managed later.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Although its completely undocumented, Stride is very close to having a robust real-time solution to loading external asset databases in real-time within a running game instance. Now, I've looked at the inner workings of the ContentManager, file providers, and database classses and what is happening in there is not straight forward, so I may be missing something. Afterall, I have no idea how the editor is able to load assets in real time like it does.
I've been able to place assets in a class library, force it to compile the assets to a content database via
<StrideIsExecutable>true</StrideIsExecutable>
, and load the assets into aContentManager
with the following codeThe problem I think I'm running into however, is that the game's content manager and its database provider are coupled tightly with other areas of game code including render logic. So although I'm able to load, say a model from the mod's content manager successfully, placing it in the scene does not have it rendered. Presumably, this is because some other code is looking for that model in the game's content manager.
Describe the solution you'd like
Please note I'm not too familiar with Stride's codebase, so I may be spitballing bad ideas here.
I think the easiest solution would be to create "Patching" methods to the game's content manager so that I can place content within but have them only exist in memory. Likewise, an unpatch method to remove the asset.
Another solution would be to decouple other areas of code to a given content manager. It smells like a codesmell that somehow somewhere in the code a model is being referenced back to the content manager. I may be missing something, this may not even be the case.
A more proper solution is probably a richer ContentManager that can infer from multiple sources.
Finally, in any case, I think documentation on how to go about making a Stride game moddable in terms of assets would be of great value.
Describe alternatives you've considered
I have been able to get a working solution by saving assets loaded from a mod's
ContentManager
into the game'sContentManager
at runtime. This isn't elegant however, because it clutters the game's database with mod files that would have to be cleaned up and managed later.The text was updated successfully, but these errors were encountered: