Pyrdacor / freeserf.net

Settlers 1 clone written in C#
GNU General Public License v3.0
139 stars 9 forks source link

linux port and AI #7

Closed njskalski closed 4 years ago

njskalski commented 5 years ago

Hi,

I like your project. I am thinking about porting it to Linux. But I have a question:

Imagine I wanted to make two different AIs play until one of them wins. Would your architecture support such game? I think: speed up the clock, let them play headless and later just look what they were up to? Does your architecture support such scenario?

Pyrdacor commented 5 years ago

Hi,

glad you like it. And porting it to Linux is great as it was also a goal of mine for the future.

The game mode "AI vs AI" is already there. You can let up to 4 AI players play against each other and watch them. With the key "j" you can switch between them (e.g. to see their settings in the game menus).

I added different views to the game. The default is "LocalPlayer". In "AI vs AI" the view is "LocalSpectator". A local spectator can watch everything but can't change settings or do game-specific actions. There are more views like "Server", "Client", "RemoveSpectator" and so on.

So yes your scenario is already possible.

The only thing you can't do as of now is to record a game and watch it later from the beginning. This may be implemented in the future maybe.

Pyrdacor commented 5 years ago

One question. How do you plan to port it? In my opinion the core game logic and renderer should work on Linux already with Mono. My hope is that the only thing that is necessary is the main application with window creation and so on.

And sound support is not there yet for Linux.

I thought about porting the "play midi" part of Timidity++ to C# to get a cross-plattform OS-independent MIDI player with better sound. But as the sound engine is exchangeable a Linux specific sound system would be okay for now as well.

njskalski commented 5 years ago

Thanks for the advice! I am going on vacation this month, so my activity will be limited. But yeah, some weekend I will try to get it working on Linux. I loved this game as a kid. I was in the gamedev industry and I even played with soundsystem of a major engine for several platforms, so I should be able to write it. Though immediate reflex is to translate midi to *.ogg, that was a standard approach back in 2013-2014.

As for the AI all I am interested in is to do save's I can later look at, so I can tell if this heuristics is better or worse in particular scenario. Or whether it's aggressive/pacifist enough. So spectator and multiplayer sounds enough already. I see here and in freeserf.net community efforts to introduce proper AI enemy, and I'd love to see different approaches clash.

njskalski commented 5 years ago

So I spent an hour or two trying to build your freeserf.net with both mono and vscode, but I am so much unfamiliar with C# ecosystem that I was not able to even get a run. There are two ways we can approach it: we can either book an hour-two session via hangouts or any other telco with screen sharing, or you could just install ubuntu/xubuntu to virtualbox and try yourself. I think the amount of C# knowledge required is slightly bigger than amount of linux specific knowledge needed, but I am happy to offer my part if you fancy. I will be back to home in April, I guess session as early as first week of it could work for me. I'm in Swiss/continental EU timezone.

Pyrdacor commented 5 years ago

I will try to build it on ubuntu by myself first. Hopefully I have the time for it in the next couple of weeks. If I get stuck I will ask you for help. I had some experience in developing with C++/g++/ubuntu back in 2008~2011 but not with C#/mono yet. But I'll give it a shot.

njskalski commented 5 years ago

Thanks, it's much appreciated. Here's what I think if you succeed: I would like to build a simple docker image that would host a simple website and allow run games headless with AI competing. Input: AI configuration (remote or upload program) output: full map screenshots every 10 minutes (and stock data) to the end of the game (time compression) or reasonable deadline. One could experiment with their AI home or on any cloud they like.

I am not an AI guy, but I did some deployments with docker. I can help with evaluation. Need to ask about permission at work (and see if I can handle workload and side project), but that's a dream I wanted to share.

And I would love to play Serf City against a battle tested AI.

njskalski commented 5 years ago

Hi, tried building today and got

/home/andrzej/r/freeserf.net/Freeserf.Core/UI/Viewport.cs(40,40): Error CS7036: There is no argument given that corresponds to the required formal parameter 'roadEndsThere' of 'Interface.BuildRoadSegment(Direction, bool)' (CS7036) (Freeserf.Core)

which looks legit.

What was the last working version?

Btw, did you think about "travis ci"? I guess it's free for opensource.

Pyrdacor commented 5 years ago

Hi, sorry I didn't have much time recently. I can't reproduce your error. Generally there are no compilation errors after a commit. Maybe it's about default arguments and your compiler doesn't allow or recognize it? At the given source code location I can't find anything about the mentioned called.

The easiest thing to resolve it would be to pull the most recent version which should compile without error.

I will add travis ci soon.

Pyrdacor commented 5 years ago

Ok I set up travis ci and appveyor and now try to make it running correctly.

I am sorry there indeed was the error you mentioned. Unfortunately I had a temporary change to Viewport.cs to log mouse coordinates which I didn't want to commit. So I didn't see that I also added the fix for the missing parameter only to my local version. Now it should be fixed in the repo.

Pyrdacor commented 5 years ago

Appveyor and Travis are now running successfully and the linux build passes successfully as well. Yay! :)

The build status is now also visible inside the readme.

njskalski commented 5 years ago

Thank you! Great news :)

njskalski commented 5 years ago

yep, it compiles, but I don't know how to produce a standalone binary.

Pyrdacor commented 5 years ago

I use Costura.Fody but I don't know if it works on Linux. Have a look here: https://github.com/Fody/Costura

Pyrdacor commented 5 years ago

I have now added automatic release deploying for Windows and Linux for tagged commits. It worked with appveyor for Windows very well but now appveyor seems to have a problem with github webhooks. So I have to wait till they have fixed the issue. I will also try to deploy a linux version automatically with travis.

Pyrdacor commented 5 years ago

Finally I made it work. There is a release for v1.9.20 now. You can download a zip file for Windows or a tar.gz for Linux. You can also find the download links inside the readme on the repo main page.

The linux archive contains a standalone assembly so the Costura.Fody nuget package seems to work automatically when building with travis ci. I also included the changelog text file in the release archives which will be added automatically during the build processes.

As I don't have a linux distribution by my hands at the moment, it would be great if you could test if the application runs on linux.

njskalski commented 5 years ago

https://pastebin.com/rG625Fss

This is much harder than just calling msbuild. I tried myself yesterday for almost two hours. I tried with mkbundle, but it requires passing paths to all dependencies in commandline.

I tried this: https://www.mono-project.com/docs/tools+libraries/tools/mkbundle/ , and furthest I achieved was

»ʚ mkbundle --simple --deps Freeserf.net/bin/Release/Freeserf.net.exe -o freeserf --machine-config /etc/mono/4.5/machine.config --config Freeserf.net/App.config -L Freeserf.Core/bin/Release/netstandard2.0/ -L /usr/lib/mono/4.5 -L /home/andrzej/.nuget/packages/netstandard.library/2.0.2/build/netstandard2.0/ref/ -L /home/andrzej/.nuget/packages/system.reflection.emit.lightweight/4.3.0/lib/netcore50 ERROR: Unable to load assembly System.Reflection.Emit.ILGeneration' referenced by/home/andrzej/r/freeserf.net/Freeserf.Core/bin/Release/netstandard2.0/Freeserf.Core.dll'

etc... so the way was: get name it complains about (here "System.Reflection.Emit.ILGeneration"), go

locate | grep nuget and add -L

so it's a dependency hell. I tried googling "how to get nuget produce all these paths for me" or "just copy everything to one dir" or "install everything to GAC" (that's still a thing, right?). Using ~/.config/NuGet/NuGet.Config as "machine-config" fails.

That was the moment I told you I don't know how to produce standalone binary :).

Anyway, I haven't used C# since 2.0, and Windows since XP, and I was not able to find a decent online sources.

(I also tried "dotnet publish" from snap, not mono, and failed as well).

My professional instinct is to "find some C# app packaged for Linux, read it's travis config and copy from there", but I don't know many C# apps.

Pyrdacor commented 5 years ago

Did you call nuget restore?

njskalski commented 5 years ago

yes I did. If you add a mkbuild to your travis build, it will let you know the errors.

Pyrdacor commented 5 years ago

So I spend the whole day to figure it out. Therefore I added a netcore version for the main app. It is the project called FreeserfNet. It doesn't depend on .NET framework anymore. You can build it with dotnet build or use dotnet publish -c Release -r linux-x64 --self-contained true -o <output_dir>. In the latter case you will get an executable and all its dependencies inside one folder. If you set --self-contained to false, the dependencies are not copied

The problem now is that the renderer uses OpenTK. And despite there is a netstandard version of it, the netcore support is only planned for v4.0 which is not finished yet. Therefore the app won't run with netcore on linux unfortunately. Maybe it will be possible with .NET framework but I don't have time to check today.

Also for linux the following libs must be present. So to avoid some reference exceptions you may have to use:

sudo apt install libgbm1

If this is not enough, try:

sudo apt install libgbm-dev
sudo apt install libegl1-mesa-dev
sudo apt install libc6-dev
njskalski commented 5 years ago

Thank you for your efforts. I will dedicate an hour or two this weekend and see what I can come up with. My idea is to try to automate discovery and linking process of mk bundle with python. I really want to see this working on Linux.

njskalski commented 5 years ago

I will also explore your ideas, maybe I can come up with a way to push it.

njskalski commented 5 years ago

Check this out:

»ʚ mkbundle Freeserf.net/bin/Release/Freeserf.net.exe --deps -o freeserf.net -L /usr/lib/mono/4.6.1-api -L Freeserf.Core/release -L /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib -L Freeserf.Renderer.OpenTK/release -L packages/OpenTK.GLControl.3.0.1/lib/net20/ -L Freeserf.Network/release/

temp.c: In function ‘init_default_mono_api_struct’: temp.c:249:33: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] mono_api.mono_jit_set_aot_mode = mono_jit_set_aot_mode; ^ temp.c:250:38: error: ‘mono_aot_register_module’ undeclared (first use in this function); did you mean ‘mono_jit_set_aot_mode’? mono_api.mono_aot_register_module = mono_aot_register_module; ^~~~~~~~ mono_jit_set_aot_mode temp.c:250:38: note: each undeclared identifier is reported only once for each function it appears in temp.c: In function ‘install_dll_config_files’: temp.c:266:66: warning: pointer targets in passing argument 2 of ‘mono_api.mono_register_config_for_assembly’ differ in signedness [-Wpointer-sign] mono_api.mono_register_config_for_assembly ("Freeserf.net.exe", assembly_config_Freeserf_net_exe); ^~~~~~~~ temp.c:266:66: note: expected ‘const char ’ but argument is of type ‘const unsigned char ’ At top level: temp.c:244:1: warning: ‘init_default_mono_api_struct’ defined but not used [-Wunused-function] init_default_mono_api_struct () ^~~~~~~~ temp.c:225:1: warning: ‘validate_api_struct’ defined but not used [-Wunused-function] validate_api_struct () ^~~~~~~ ERROR: [Fail] 256

njskalski commented 5 years ago

»ʚ mkbundle --simple Freeserf.net/bin/Release/Freeserf.net.exe --deps -o freeserf.net -L /usr/lib/mono/4.6.1-api -L Freeserf.Core/release -L /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib -L Freeserf.Renderer.OpenTK/release -L packages/OpenTK.GLControl.3.0.1/lib/net20/ -L Freeserf.Network/release/ --machine-config /etc/mono/4.5/machine.config --config /etc/mono/4.5/machine.config Using runtime: /usr/bin/mono Assembly: /home/andrzej/r/freeserf.net/Freeserf.net/bin/Release/Freeserf.net.exe Config: /home/andrzej/r/freeserf.net/Freeserf.net/bin/Release/Freeserf.net.exe.config Assembly: /usr/lib/mono/4.6.1-api/mscorlib.dll Assembly: /usr/lib/mono/4.6.1-api/System.Windows.Forms.dll Assembly: /usr/lib/mono/4.6.1-api/System.dll Assembly: /usr/lib/mono/4.6.1-api/System.Configuration.dll Assembly: /usr/lib/mono/4.6.1-api/System.Xml.dll Assembly: /usr/lib/mono/4.6.1-api/Accessibility.dll Assembly: /usr/lib/mono/4.6.1-api/System.Drawing.dll Assembly: /home/andrzej/r/freeserf.net/Freeserf.Core/release/Freeserf.Core.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/netstandard.dll Assembly: /usr/lib/mono/4.6.1-api/System.Core.dll Assembly: /usr/lib/mono/4.6.1-api/System.Data.dll Assembly: /usr/lib/mono/4.6.1-api/System.EnterpriseServices.dll Assembly: /usr/lib/mono/4.6.1-api/System.Transactions.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.Data.Common.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.Diagnostics.StackTrace.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.Diagnostics.Tracing.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.Globalization.Extensions.dll Assembly: /usr/lib/mono/4.6.1-api/System.IO.Compression.dll Assembly: /usr/lib/mono/4.6.1-api/System.IO.Compression.FileSystem.dll Assembly: /usr/lib/mono/4.6.1-api/System.ComponentModel.Composition.dll Assembly: /usr/lib/mono/4.6.1-api/System.Net.Http.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.Net.Sockets.dll Assembly: /usr/lib/mono/4.6.1-api/System.Numerics.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.ValueTuple.dll Assembly: /usr/lib/mono/4.6.1-api/System.Runtime.InteropServices.RuntimeInformation.dll Assembly: /usr/lib/mono/4.6.1-api/System.Runtime.Serialization.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.Runtime.Serialization.Xml.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.Runtime.Serialization.Primitives.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.Security.Cryptography.Algorithms.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.Security.SecureString.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.Threading.Overlapped.dll Assembly: /usr/lib/mono/4.6.1-api/System.Web.dll Assembly: /usr/lib/mono/4.6.1-api/System.Web.ApplicationServices.dll Assembly: /usr/lib/mono/4.6.1-api/System.ComponentModel.DataAnnotations.dll Assembly: /usr/lib/mono/4.6.1-api/System.Web.Services.dll Assembly: /usr/lib/mono/4.6.1-api/System.Xml.Linq.dll Assembly: /usr/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/net461/lib/System.Xml.XPath.XDocument.dll Assembly: /home/andrzej/r/freeserf.net/Freeserf.Core/release/System.Reflection.Emit.Lightweight.dll Assembly: /home/andrzej/r/freeserf.net/Freeserf.Core/release/System.Reflection.Emit.ILGeneration.dll Assembly: /usr/lib/mono/4.6.1-api/Microsoft.CSharp.dll Assembly: /home/andrzej/r/freeserf.net/Freeserf.Renderer.OpenTK/release/Freeserf.Renderer.OpenTK.dll Assembly: /home/andrzej/r/freeserf.net/Freeserf.Renderer.OpenTK/release/OpenTK.dll Assembly: /home/andrzej/r/freeserf.net/packages/OpenTK.GLControl.3.0.1/lib/net20/OpenTK.GLControl.dll Assembly: /home/andrzej/r/freeserf.net/Freeserf.Network/release/Freeserf.Network.dll Assembly: /usr/lib/mono/4.6.1-api/I18N.West.dll Assembly: /usr/lib/mono/4.6.1-api/I18N.dll systemconfig: /etc/mono/4.5/machine.config machineconfig: /etc/mono/4.5/machine.config Generated freeserf.net [15:53:10] andrzej@mars /home/andrzej/r/freeserf.net (e: 0, t: 339) »ʚ ls appveyor.yml Freeserf.Core/ Freeserf.net/ Freeserf.net.sln FreeserfPatcher/ images/ packages/ temp.c temp.s changelog.txt freeserf.net* FreeserfNet/ Freeserf.Network/ Freeserf.Renderer.OpenTK/ LICENSE README.md temp.o updates/ [15:53:11] andrzej@mars /home/andrzej/r/freeserf.net (e: 0, t: 13) »ʚ ./freeserf.net The file /usr/lib/mscorlib.dll is an invalid CIL image

njskalski commented 5 years ago

check PR 64, I'm so close!

njskalski commented 5 years ago

got to the point when app crashes on loading data file. there's another funny bug about finding "path to executable". Tried like 50 approaches, all return working directory not directory of binary. I personally blame mkbundle for doing some magic chroot or something.

njskalski commented 5 years ago

can you tell me what exactly version of Serf City / Settlers you have tested against? I downloaded 2 different ones and even after going around some path composition errors I have a crash in loading assets.

Pyrdacor commented 5 years ago

Hm I don't know exactly the version but I tested with several data files (including english and german versions). But only DOS data files work at the moment. Not amiga data files.

What is the exact error message? Is there something inside the log file? You can also alter the log level with the command line option d. For example: $ Freeserf.net.exe -d 0

Log levels are:

0: Verbose
1: Debug
2: Info
3: Warn
4: Error

Default is Error (4).

Maybe the path is the problem. There is a piece of code which was added for testing on Windows with Visual Studio. This code may cause problems if the exe path ends with "Debug" or "Release". If this is the problem just copy the binary to a folder with a different name or remove/change the code inside the static constructor of the Program class of the main executable project.

Pyrdacor commented 5 years ago

I merged your pull request and moved the v1.9.20 tag to the HEAD so that a release is deployed. I published the release so that it contains the current state. I will test it in a VM with ubuntu in the next days.

Thanks for your efforts. :)

Pyrdacor commented 5 years ago

Ok I finally got some time to test it on linux. I found a few bugs regarding paths and shader versions and now finally it is running on linux. Yay! I triggered a new release deployment. The current v1.9.20 release should run on linux. Fullscreen handling and cursor positions do not seem perfect on linux yet but it is at least playable.

njskalski commented 5 years ago

Wonderful! I was just thinking: maybe if you could get the .sln file contain the "run configuration" either with Visual Studio Code or Rider (Jetbrains C# Ide) I could join debugging. I worked in gamedev professionally, I can probably come up with some picking algorithm.

njskalski commented 5 years ago

or mono. I just tried working with VS Code and I cant get it working with mono framework, so it complains about .NETFramework not being available in dotnet core package (only mono version is).

Pyrdacor commented 5 years ago

Couldn't make it work on Ubuntu 18.04 yet, mainly because I can not install or find msbuild (the one travis uses).

Maybe we should focus on the netcore project FreeserfNet, which runs with netcore and is therefore cross platform. It can be compiled already with vscode and it is running on Windows as well. But OpenTK seems to have problems. Maybe you could try to make the project work on Linux. This would also allow us to compile to native binaries and we won't need mono at all.

Pyrdacor commented 5 years ago

The problem with the project Freeserf.net is, that it uses NET framework, which is not cross platform. Mono is the implementation of it for Linux, but the project is a MSBuild project. Mono created xbuild to handle such projects and then used msbuild later. So to compile and run the project you need mono and the msbuild of mono. But since everything is netcore based nowadays, there is not much to find about setting up the correct msbuild environment in Ubuntu. And the new msbuild seems to use netcore as well. Everything is going towards netcore. This would be ok, if OpenTKs linux renderer would work correctly with the netcore/netstandard version.

I see 3 approaches:

You won't be able to compile the project with dotnet as it does not support mono nor netframework. And vscode is mainly working with dotnet. You could try to install msbuild and adjust the build configuration to use msbuild instead of dotnet. But don't use dotnet msbuild. You need the one from mono which supports netframework. Travis does it somehow so it must be possible.

njskalski commented 5 years ago

Ok, it works in current version! I am impressed. So here's what I can help with: 1) I worked in gamedev as graphics programmer. I can write a renderer AND mouse handling (picking algorithm via color picking). 2) I can do sound. 3) I want time compression.

What's your suggestion?

As for graphics: what do you think about 1) SkiaSharp 2) SFML.net 3) Veldrid? I used SFML for c++ 10 years ago, it was considerably better than SDL at that time. With Skia I had bad experience recently (super hard to build for iPad) but maybe if it's packaged - who knows? Veldrid tutorial looks simple, and it's very close to APIs I know from gamedev, thought looks like a little overkill to me. But then I need to optimize time of writing code.

Pyrdacor commented 5 years ago

I also worked with SFML and C++ years ago and kinda liked it. I also used SkiaSharp before. It was good but then I had some issues and switched to OpenTK. Haven't looked into Veldrid yet. Yeah most of the stuff out there is overkill for simple 2D rendering. Basically the GL call mappings would be enough for the renderer. I would prefer tiny robust libs which only provide basic GL calls. The current renderer implements most of the stuff itself.

The bigger question mark for me regarding Linux is a valuable midi and wave player without the need of huge audio apis. Maybe you could focus on this.

As I said, OpenTK 4.0 is currently developed and will hopefully be finished soon. It will fix all rendering issues on Linux if things go well.

njskalski commented 5 years ago

Sound it is. I will consult with you when I have some first ideas. How about time compression?

As for rendering, two small things that would be great are: image stretching and either multisampling or streching with bilinear filling algorithm. At this point the animation is not smooth, as if some frames were missing (especially visible on water). I am not sure how it was in original (youtube videos can be automatically postprocessed).

What do you think?

Pyrdacor commented 5 years ago

I tried to implement the graphics as close as the original and most of the logic how to render is taken from the freeserf base code. Filtering/stretching doesn't look nice with the original graphics.

What do you mean by time compression? Change game speed?

njskalski commented 5 years ago

yes. I need to speed up game for two reasons. For improved gameplay and for training AI :D

Pyrdacor commented 5 years ago

You can already change the speed with + and -

njskalski commented 5 years ago

Great! Could you please try to build with Rider? I cannot get around this:

`/usr/bin/mono --debug --debugger-agent=transport=dt_socket,server=y,suspend=y,address=127.0.0.1:55555,setpgid=y /home/andrzej/r/cs/freeserf.net/Freeserf.net/bin/Debug/Freeserf.net.exe

Unhandled Exception: System.TypeLoadException: Could not load type of field 'Freeserf.FreeserfForm:gameView' (0) due to: Could not load file or assembly 'Freeserf.Renderer.OpenTK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type of field 'Freeserf.FreeserfForm:gameView' (0) due to: Could not load file or assembly 'Freeserf.Renderer.OpenTK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

Process finished with exit code 1.

`

Pyrdacor commented 5 years ago

I am working on a small project which is able to create an OpenGL window on Linux and Windows and then just use a library on top which provides the OpenGL bindings. At the moment I use OpenTK for rendering which is still not easy to use with netcore. But I only use its bindings and nothing else of this large library. So I will use the small lib instead which is cross platform. But it will take some days/weeks to finish as my time is very limited these days.

I will inform you if it is ready. Then we can try to build and run on Linux again.

Pyrdacor commented 4 years ago

I decided to switch to Silk.net as it supports netcore and seem to work good enough for the project. I managed to create a working game for Ubuntu 64bit. Please check here: https://github.com/Pyrdacor/freeserf.net/releases/download/v1.9.27-linuxfix/Freeserf.net-Linux.tar.gz

The mouse input isn't working yet I guess. Maybe you could fix this in a PR if you have time. Because my debugging skills on Linux are very bad. I guess it's caused by the click/double-click timer interaction.

njskalski commented 4 years ago

That’s a good idea, I can help. I’ll look at it in January, thanks for reaching out. I actually even already pulled the repo and tried building the other day but encountered some issue.

On Fri, 20 Dec 2019 at 10:05 Pyrdacor notifications@github.com wrote:

I decided to switch to Silk.net as it supports netcore and seem to work good enough for the project. I managed to create a working game for Ubuntu 64bit. Please check here: https://github.com/Pyrdacor/freeserf.net/releases/download/v1.9.27-linuxfix/Freeserf.net-Linux.tar.gz

The mouse input isn't working yet I guess. Maybe you could fix this in a PR if you have time. Because my debugging skills on Linux are very bad. I guess it's caused by the click/double-click timer interaction.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/Pyrdacor/freeserf.net/issues/7?email_source=notifications&email_token=AAKL7Z2PYNYNXDX2DHXCT7LQZSDEVA5CNFSM4G3DME32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHMLDBY#issuecomment-567849351, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKL7Z6JGYUSXALURU5FZTTQZSDEVANCNFSM4G3DME3Q .

-- Kind Regards Andrzej J Skalski

Pyrdacor commented 4 years ago

I managed to get input working. Now have some crashes of the new renderer to fix. They seem to be caused by multi-threading issues. But for the first time the game is theoretically playable on Ubuntu.

Pyrdacor commented 4 years ago

I did some improvements. Would be nice if you could do some testing on Ubuntu. My plan is to release version 2.0 in the near future with Linux support and multiplayer. So the branch 2.0 is important for testing.

njskalski commented 4 years ago

Hi, Ill do it. I am on vacation in January with limited access to internet, but Ill give it some time as soon as possible.

njskalski commented 4 years ago

Hi,

so I played with it a little bit, got around two easy-fixes: https://github.com/Pyrdacor/freeserf.net/pull/78/files

and got: `/usr/share/dotnet/dotnet /home/andrzej/r/cs/freeserf.net/FreeserfNet/bin/LinuxDebug/FreeserfNet.dll Error: Symbol could not be loaded: /usr/lib/x86_64-linux-gnu/libglfw.so.3: undefined symbol: glfwSetWindowMaximizeCallback. Symbol name: glfwSetWindowMaximizeCallback

Process finished with exit code 0.`

which is weird, because it seems to be a GLFW method not found.

`andrzej@hog ~> apt search libglfw Sorting... Done Full Text Search... Done libglfw3/bionic,now 3.2.1-1 amd64 [installed,automatic] portable library for OpenGL, window and input (x11 libraries)

libglfw3-dev/bionic,now 3.2.1-1 amd64 [installed] portable library for OpenGL, window and input (development files)

libglfw3-doc/bionic,bionic 3.2.1-1 all portable library for OpenGL, window and input (documentation)

libglfw3-wayland/bionic 3.2.1-1 amd64 portable library for OpenGL, window and input (wayland libraries) `

I tried manually installing 3.3.1 building from source or installing from higher ubuntu version but got tired and stopped.

Pyrdacor commented 4 years ago

Did it work with 3.3.0.1 which was used before your changes? Does freeserf find the lib at all? Maybe it works if you put the so file next to the assembly?

njskalski commented 4 years ago

ok, manual update to 3.3.1 fixes the problem: `andrzej@hog ~/Downloads> apt search libglfw Sorting... Done Full Text Search... Done libglfw3/now 3.3-1 amd64 [installed,local] portable library for OpenGL, window and input (x11 libraries)

libglfw3-dev/now 3.3-1 amd64 [installed,local] portable library for OpenGL, window and input (development files)

libglfw3-doc/bionic,bionic 3.2.1-1 all portable library for OpenGL, window and input (documentation)

libglfw3-wayland/bionic 3.2.1-1 amd64 portable library for OpenGL, window and input (wayland libraries) `, now it breaks somewhere else :

` /usr/share/dotnet/dotnet /home/andrzej/r/cs/freeserf.net/FreeserfNet/bin/LinuxRelease/FreeserfNet.dll Error: [Config] Failed to open config file '/home/andrzej/.local/share/freeserf/user.cfg'. Error: [Application] Load: Could not find a part of the path '/usr/share/dotnet/assets/ui_font.png'.

Process finished with exit code 0. `

I use JetBrains Rider to build and run.

Pyrdacor commented 4 years ago

Great. Maybe we just wait till it is accessible through nuget then. On February the 28th Silk.net will publish preview4 which will have a few important updates for us too.