stride3d / stride

Stride (formerly Xenko), a free and open-source cross-platform C# game engine.
https://stride3d.net
MIT License
6.61k stars 953 forks source link

[RFC] Migrate to AvaloniaUI #1629

Open ParadiseFallen opened 1 year ago

ParadiseFallen commented 1 year ago

Is your feature request related to a problem? Please describe. Right now we have editor only for win platform. For going crossplat we need to migrate to avalonia or maui MAUI dosen't fits bc support for linux provide community and not MS devs.

Describe the solution you'd like MVVM Crossplat RxUI Stride.Editor.

Describe alternatives you've considered There is also MVU approach but in MVU we CAN'T easily replace views if we need and it will make editor plugins & customization harder to develop. On the other side MVU MUCH simplier then MVVM. However, even with all the pros and cons, I tend to favor slightly more development time and flexibility than ease and complexity of extensibility.

Additional context dunno

Here are some questions that can aid in the description of the feature request:

Doprez commented 1 year ago

Adding these links here in case they are still relevant to this topic.

Readme created by Eideren that discusses similar points here: https://gist.github.com/Eideren/6424455fd25f3820bbce6594d67e307b

Useful design doc about the stride Repo that could help clear some things up: https://gist.github.com/manio143/b6666eedb1403deb5525961697d0c25d

A brief example of how to start from Manio using Avalonia: https://github.com/manio143/StrideComponentsEditorAvalonia

manio143 commented 1 year ago

There was a short conversation recently on discord about using Avalonia for the editor - it seems it's doable but currently complicated to get the GPU rendering of the scene embedded directly in the Window as it's currently done with WPF. One company (closed source) made it work and it looks great: https://blog.jetbrains.com/dotnet/2021/05/10/case-study-how-gritworld-uses-rider-and-avalonia-to-build-a-powerful-3d-engine/ Here's an issue talking some details about it: https://github.com/AvaloniaUI/Avalonia/discussions/8199 More discussions with little to no results: https://github.com/AvaloniaUI/Avalonia/discussions/5432, https://github.com/AvaloniaUI/Avalonia/discussions/7137 And there's a lot of success regarding making a video player with Avalonia: https://github.com/AvaloniaUI/Avalonia/discussions/10683

But as I was going through the issues I stumbled over this one: https://github.com/AvaloniaUI/Avalonia/issues/9925 Even with some samples https://github.com/AvaloniaUI/Avalonia/tree/master/samples/GpuInterop

Didn't have too much time to dig deeper and try any of this myself but is seems promising.

yangguosdxl commented 1 year ago

any new progress??

Doprez commented 1 year ago

Im not sure if anyone actually has a branch but I am looking into it just to see what is possible.

Unfortunately Im a serial multitasker so it is very slow.

https://github.com/Doprez/stride/commit/1048eb42450b7ac1c50d5cd3f4a05e851b07ed76 I did merge the above branch into my fork to see if I can learn from it but no real progress yet, at least for me.

Doprez commented 1 year ago

Adding some more resources here for embedding stride into alternate frameworks.

https://github.com/Doprez/Awesome-Stride/blob/main/README.md#embeded-stride

ParadiseFallen commented 1 year ago

@Doprez need to mention it on main page

Doprez commented 1 year ago

Which is the main page?

ParadiseFallen commented 1 year ago

@Doprez https://github.com/stride3d/stride/blob/master/README.md

Eideren commented 1 year ago

I think it makes far more sense as a page on the wiki

ParadiseFallen commented 1 year ago

@Eideren just a link in primary readme. not all peoples checks wiki pages

VaclavElias commented 1 year ago

Don't forget we have got also this https://github.com/stride3d/stride/wiki/Community-Projects

ParadiseFallen commented 1 year ago

@VaclavElias lets merge em then

Doprez commented 1 year ago

I know for me the only reason I made a personal list was due to a lack of validation. I still need to check that some of the projects on my list work at all (They could either be someones idea that wasnt completed or just an old version that may not work with current stride).

I do want to start adding some of the links from my list into the wiki as I validate but it will be slow.

Another thing I could do is add my list to the main readme under the Community section labelled as "Unofficial list of Stride resources" if that makes sense.

@Eideren @VaclavElias

VaclavElias commented 1 year ago

@Eideren just a link in primary readme. not all peoples checks wiki pages

Generally primary readmy needs to be better interlinked with our wiki. I would like to look into it in the future once I finish web and docs. I guess @Doprez would have seen the existing link and elaborated on that existing wiki page in the first place if he discovered it 🤔🤣.

Doprez commented 1 year ago

Another benefit of having a repo dedicated or the "awesome-list" is that it can show up on the awesome lists https://github.com/search?q=awesome as a common search.

Eitherway I think its unrelated to this topic for further discussion. Ill create 2 seperate PR's one for the Wiki and one for the main readme and it can be decided then if we want both or just the one.

Doprez commented 1 year ago

been looking at this again and just wanted to add some interesting findings. Ryujinx currently has an example of using Opengl AND Vulkan with Avalonia inside of a NativeControlHost. this is the project running Avalonia the default is still using SDL in the main branch.

They have a list of some issues but it seems like some might be specific to Ryuijinx Avalonia Ryujinx issues.

Thats it for now I am taking a peak at how we do the rendering in Stride and it may not be the worst thing to implement as a test for Opengl. I will be tracking it here as I learn wish me luck!

damian-666 commented 1 year ago

the stride editor has docking/ scripting , but all that tabbed is even harder than just sharing a buffer.. which is really hard combined. Tabbed dialogs deactivate, disposed, nauced etc. Wtih Avalonia there are 3 OSS choices and this one is in flux..

If we really wanted this Avalonia to replace the WPF of strides IDE ( that has docking and tabs and drag and drop) we would should consider to to pump money towards the gurus to do this.. like that studio did. I I spend 2 weeks + a freelancers 15 hours, on a getting Avalonia.Inside to show a monogame view in a single tab on the Dock git below, using a writable bitmap copy, we failed, I sponsored teh wieslawsoltes/Dock for 20 $ that took him 30 min.: but its really still buggy and difficult.

I do not know React either and there are two wasy of doign Avalonia and he prefers React. once you know it..it's ok

all around.. macs are great but unless they add touch i have to stay with a surface anyway. to do android touch UI dev. Is docking that important.. scripting? i think it is, else you have 2 IDEs. mabye as well just use the VScode .

This seems like a huge undertaking but i would like it..jsut to freshen the look of my WPF netcore 7 IDE at least.. im looking at just putting some in-game , UI for now.. Also im starting to use voice, NLS and AI more , and generative design so im going to wait this out. I do need scripting...

I basically make my own UI on the game itself its so simple. But for editging i would want Avalonia + Dock wiht shared graphcis buffers, tabs, and multiple views maybe.

https://github.com/wieslawsoltes/Dock

https://github.com/AvaloniaUI/Avalonia/tree/master/samples/GpuInterop

breadnone commented 1 year ago

Chipping in while the cake still hot, considering exposing some the bits and bobs of editors APIs, the goal here is to have a freedom easy to access editor apis to extend OR make our own custom editor native to the engine.

Coming from Unity, I can't stop scratching my head in terms of custom editor in Stride. Just my 2 cents.

sandsalamand commented 1 year ago

Would it be possible to do this piecemeal? I.e., render Avalonia views on top of WPF, with some barebones interop for a docking system so that they don't overlap?

If this was possible, I think it would offer some massive gains. People could write plugins in Avalonia, and the rest of the engine could be slowly converted, one docked window at a time.

ParadiseFallen commented 1 year ago

@sandsalamand not sure about partial translation. its diffrent FRAMEWORKS not LIBS. so they have diff init and usage at some places. we need to find a corner cases of usage. ie game scene renderer and others.

JochnGst commented 9 months ago

Avalonia offers with XPF a Framework to port WPF Applications directly or with minimal adjustments. It would be worth a try to ask them if they would sponsor a licence for the Stide project.

Kryptos-FR commented 9 months ago

@JochnGst we have started the effort to migrate to Avalonia. XPF would only be a short term solution, while rewriting using Avalonia lets use rethink the architecture to, for instance, designing a better plugin architecture.