Closed ekolis closed 3 years ago
Idea: use Avalonia.
Advantages: Very powerful, similar to WPF.
Disadvantages: no designer
Idea: use Xamarin.
Advantages: in addition to all desktop operating systems (I think), Xamarin can run on Android and iOS.
Disadvantages: not 100% sure it supports Linux; no designer support except for Android/iOS
Idea: use GTK#
Advantages: easy to learn, it's just like WinForms but different
Disadvantages: just as ugly as WinForms
Idea: use Unity
Advantages: VERY powerful, supports 3D graphics
Disadvantages: difficult to learn, perhaps?
Idea: use Tao.OpenGL
Advantages: it's OpenGL, everyone knows that
Disadvantages: lack of UI elements such as buttons
There are also Eto.Forms, which draws to WinForms or WPF on Windows, GTK# on Linux, and MonoMac on OSX: http://picoe.ca/2012/09/11/introducing-eto-forms-a-cross-platform-ui-for-net/
Or, if going the route of no framework GUI, like Tao, there is also SFML.Net, which has the advantage of being simple and easy to learn, can handle OpenGL, but also offers graphics package to draw 2D graphics much easier than via OpenGL, and input and audio handling.
Wait, Avalonia has a designer now? OK, I'm sold! Even if it's just a preview of your form and not a drag-and-drop designer, that's good enough for me! And they're adding mobile support too? That's awesome!
On second thought, maybe we should go with Xamarin, because that platform is being absorbed into .NET as MAUI (Multiplatform App UI).
https://devblogs.microsoft.com/dotnet/introducing-net-multi-platform-app-ui/
While I'm all for rolling down to new Maui, it doesn't seem to have Linux support declared anywhere; just Windows, macOS, iOS, and Android.
Hmm. I saw a chart somewhere which listed Linux as "community", whatever that means... I guess Microsoft will rely on the open source community to port MAUI to Linux?
Xamarin appears to (temporarily) be a no-go, unless we can figure out a solution to the .NET version hell issue described in #13. (I say temporarily because .NET 5 should solve that issue.)
I wonder if we could convert FrEee into a web app, perhaps a PWA? But I'm not sure how that would work regarding custom mods and shipsets, and especially scripts, since you could always insert a "delete the game host's hard drive" function into a custom script!
I've spent a bit of time taking a look through the WebForms project, hoping that I could start an AvaloniaUI project that replicates the basics to check how it works - but unfortunately, there's plenty of code in there, a bit more than I've anticipated, and I don't really have anything to show for it right now. I would probably need to separate some of the code from the WinForms project to a separate intermediate layer, to reuse it and only do graphical stuff in Avalonia, and now that I came up with this idea, I should have something to show in a few days. :)
Another thing I did was look for info on MAUI - but it seems that .NET 6 was postponed due to the madness that was 2020 (it was supposed to be available in preview at the end of 2020, but there is no word on it as far as I can tell), so that would need to wait even longer.
Running FrEee as a web app would probably require even more rewriting, but it does seem to be possible with some work - maybe using server-side Blazor and locally-running both server and a client (possibly via Electron). It would probably force better separation of concerns between interface and backend, too.
I'm also working on a smaller project on the side where I'm using SFML.Net for graphics, but it isn't really all that good of a fit here, I think - FrEee is really GUI-heavy, and the actual galaxy/battle screens are rather simple.
Oh, that sounds really cool! I'd love if you could do that! I've tried looking into Avalonia myself in the past, but it just doesn't look all that promising - sure, you can run it on nearly any platform, but the UI designer support was terrible to nonexistent last I checked, and FrEee is a rather UI heavy game! Has this situation improved?
Separating out the actual views from the view models, so to speak, would definitely be helpful. As would getting rid of any references to WinForms in anything but the actual WinForms GUI! I think there's some System.Drawing.Point
objects being used to store sector locations in the game core, for instance... 😛
MAUI? Isn't that unsupported on Linux? And it's based on Xamarin, right? I wonder what the advantage would be of using MAUI over Xamarin itself...
Yeah, I was thinking of Blazor for a web version of FrEee; naturally something like PBW would automatically be built in since the game server is already a web server! I'm not familiar with Electron; that's for running web apps as if they were desktop apps, right? What advantages does it have over a PWA, which is already supported by Blazor out of the box?
My main concern with making FrEee a web app, though, is as I mentioned the difficulty of supporting mods. Custom shipsets and plain SE4 style data files would be fine, since you could just upload them to the server and everyone can see them and use them in-game. But scripts are definitely going to be problematic, and formulas in data files will be iffy. It's one thing to say "game hosts need to be careful when installing mods, so they install mods only from trusted sources and don't wreck their file systems by installing malware". But when these scripts are being executed on a server, and anyone can upload their own mods... that's too much risk. Formulas might be doable if we invent a domain specific language or use a preexisting formula parsing library. Event/intel scripts and the like though - I really don't want to go the way of Aaron and invent a domain specific language that flexible! The only alternatives I can think of is to require game hosts to host their own web servers (thus placing the responsibility for vetting mods back on them individually, rather than on whoever runs the central server, the downside being not everyone who wants to host a game knows how to operate a web server), or adding some sort of community vetting protocol where the server admin or some trusted group of people can decide which mods to allow (the downside being now you can't playtest your brand new mod without waiting for it to be approved or hosting your own server)...
Maybe a way to make the web app thing work would be to build a web server into the host app, so all you have to do is run it and forward a port, rather than setting up hosting for an HTTP server to put the host app on. Or go a step further and set up a meta server that the host app connects to, so you don't have to even forward any ports, and we can also have global logins and the like. Then the actual game logic would run on the host app (so individual game hosts would be responsible for the content of mods that they run), but you'd still be able to play online without having to set up your own web server to host a game.
Huh, I've never really considered the designer story in Avalonia, because I'm typically writing the GUIs by hand, even in WPF/WebForms (I've never had a chance to work with WinForms, really). To be honest, I didn't do much in this space, and most of what I did was in web tech, so JS/HTML/CSS stuff, which has very short turnaround between writing and seeing the change in action, so maybe that's why? Anyway, there seems to be some support for the designer in Avalonia now: http://avaloniaui.net/docs/quickstart/vs-designer . No idea how good this is, really...
MAUI is still marked as "community" for Linux support, and I'm not sure what this will entail (my guess is that MS will make it run on Ubuntu and leave any potential changes to get it going on different distros to the community, but my cursory search didn't turn out any details). Maybe we will find out more when the previews hit.
I don't really have much to offer as far as reworking FrEee as a PWA goes... But Battle for Wesnoth for example has a server with add-ons, which are probably vetted at least somewhat before getting actually published, but it also offers a way to install mods without using it (by dropping a folder with mod into a game folder), so that might be viable route - still possible to e.g. test your own mods without uploading them, but also mostly safe for people if they go with mods from the server.
Still, that seems like a really big architectural change... Maybe it would be worth thinking about Unity if you are willing to commit to something like that? It seems to support 2D reasonably well, is very good in cross-platform development (including Linux, mobile platforms, and even Web), and seems to be compatible with modding too, as well as offering multiplayer support. Still a big project, but at least the engine part would be taken care of, which is quite a large part of writing a game after all. :)
Hmm, I'll have to give Avalonia another try, then. It's been a while and I seem to recall the designer being really buggy or not wanting to open or something like that?
That is one nice thing about web apps, that you can just make a change and refresh the page without having to stop the app, restart it, and click through all the screens to get to where you were before.
I'm really hesitant to jump to Unity. It just looks so big and powerful and overbearing and I feel like it would be overkill for this kind of project, not to mention a huge learning curve. Plus I get the feeling that it inflicts some rather bizarre requirements on games that use it, like using public fields instead of properties for everything, and getting stuck with an old version of .NET... I'm not sure what you're talking about by the "engine part"; what sort of "engine part" might a 4X game require that could be provided by Unity? Maybe a nice combat sim, that's about it... Or am I missing something?
Another possibility is Godot; apparently someone is making a Stars! clone in it, so it must be good for UI-heavy games!
Uno looks interesting too; it's XAML-based and supports all major desktop and mobile operating systems - and browsers!
Godot does seem like a nice choice if you want to go the game-engine route, possibly better than Unity, as it does seem better suited for 2D games in general...
The "engine part" I was thinking about was in the sense of graphical display, the machinery required to get the game going on the different platforms, stuff like that; not really any actual game mechanics. While this is generally already in place in the current version, it could be beneficial to get this "for free" when moving to another solution, instead of rewriting this code in e.g. web-based technology. Of course, Godot would provide the same benefits. :)
OK, Avalonia seems to be working pretty well. I'm gonna close this issue for now.
Godot mockup of GUI:
What do you want to see? A modern, cross platform UI that's not Windows Forms.
How would it help players? Who doesn't love a modern, cross platform UI?
Alternatives See discussion
Screenshots and mockups N/A
Things to consider We should maintain the existing WinForms GUI for hard core old school players who never moved on from Windows 95.