Closed maximilien-noal closed 8 months ago
I was also thinking about transition to .NET Core/MAUI.
But few issues are preventing me to do just that:
I'm doing this step by step, and sure enough there will come a time when the gap will be almost non existent, but for now these are real problems preventing me to migrate to .NET Core.
For now Mono .NET allows for such cross platform interoperability.
For the UI side of things, I'm sure everything can be replaced with AvaloniaUI. Unless you use MDI (Multi Document Interface), which is not present.
There is a mid-step than I see: Still using WinForms, but the latest .NET 8 introduces binding APIs. Alas, I don't know how this would impact users of Mono.
WinForms code, and furthermore code-behind code (The partial class MainForm.cs file not generated by the VS Designer) tend to mix business logic with UI logic and form spagetthi code.
The UI side of things seems simple enough to be fixed very quickly, before it becomes a problem. WinForms is very problematic with this, very quickly (10 years of experience dealing with it).
WinForms in .NET 8 introduces binding APIs that enables the usage of the MVVM pattern, which makes things easier to maintain in the long run, and separate UI logic from business logic.
(I've done a ton of WinForms / WPF / AvaloniaUI, and a ton of .NET work, as you can see)
These are good news indeed :)
For now OpenCiv1 depends on one simple WinForm (MainForm.cs) which hooks:
There are a few buttons, Pause/Run button, and Hide/Display screen 1-n
You can see details in MainForm.cs (it's generated by VS Designer!) it has a little bit of code enough to interface with underlying code nothing more.
If you can perhaps contribute in alternative MainForm.cs code that would be great, as all other things in code should work also in .Net Core. I'm sorry, but for now I really don't have time (already late with a few projects) to invest in learning new .NET Core things. For now, I have done one medium complexity .NET Core WebApp (Revigo) which works great, it's a little different than ASP.NET, but overall the experience has been very positive.
Perhaps there are a few NULL object references, but these can be resolved with time (as .NET Core is compatible with NULL object references).
I'm sure there are many people who will be happier with .NET Core version.
However, I plan to port code later on to JavaScript, as that would give us true Multiplatform capabilities, Multiplayer, real Hall of fame, game Save sharing, etc.
Of course, everyone will be able to run their own private server ;) for offline playing, etc.
Thank you for this detailed answer.
Actually, the very first contribution would be to move to SDK-style .csproj files. This does not imply by itself a move from .NET Framework.
However, I plan to port code later on to JavaScript, as that would give us true Multiplatform capabilities, Multiplayer, real Hall of fame, game Save sharing, etc.
I'd use Blazor for that, but it's just because I really dislike Javascript, and keeping the same C# codebase would save time and efforts. Blazor uses C# seamlessly on the server side and on the client side. AvaloniaUI can do it too, with WASM, but Blazor is more documented. Blazor still can use JS modules if needed.
I completely overlooked Blazer ;) Thanks for pointing me the right direction will look at it later.
I specifically meant to upgrade to .NET Core/MAUI if possible. Don't know if that supports all events that I need for conversion.
...and join the discord channel - there are so few reversing people out there :(
Did a conversion of a project to a newer format (SDK-style .csproj files).
...and join the discord channel - there are so few reversing people out there :(
The invite link expired...
Here is a new one https://discord.com/invite/bXtzpqPj
I will send a PR today for net core.
I tried today on Linux Ubuntu and MacOS:
It works!!!
I would suggest that everyone who wants to participate in testing OpenCiv1 before release to do so ;)
Very good! I actually suggest you show these two screenshots in the readme section.
wow just tried OSX and was straightforward:
$ cd OpenCiv1/src
$ dotnet run
Is there a way to increase the window size?
By default, there should be.
No, not yet :( The game is built for 320x200 and I increased it to 640x400 by doubling pixel size. Later on, when I translate more code then it will be possible. Well I could scale the image further, but the game resolution will stay the same.
By default, there should be.
I fixed the size of the main window. But I could scale the image as user changes the window size...
No, not yet :( The game is built for 320x200 and I increased it to 640x400 by doubling pixel size. Later on, when I translate more code then it will be possible. Well I could scale the image further, but the game resolution will stay the same.
You can put a viewbox as a parent to the Image control. It will scale it properly at any size.
No, not yet :( The game is built for 320x200 and I increased it to 640x400 by doubling pixel size. Later on, when I translate more code then it will be possible. Well I could scale the image further, but the game resolution will stay the same.
You can put a viewbox as a parent to the Image control. It will scale it properly at any size.
Yes, perhaps that is what I should do ;)
Wow, so easy, and it works instantly ;) I committed the changes.
Amazing, now full screen mode works! This will make play testing the game easier.
I'm going to close this, as project was successfully migrated to .NET 8 and Avalonia UI
Hi !
Using the latest .NET would make this cross platform and enable more contributions from people who do not use Windows.
I'm curious, what would be the main issues preventing that, and would you accept such a PR ?