Cyral / Bricklayer2

An Open Source, Fully Moddable and Customizable 2D Building Game.
https://www.pyratron.com/bricklayer
Other
7 stars 1 forks source link

Linux support: Docker, WINE, FNA #31

Open westurner opened 6 years ago

westurner commented 6 years ago

I'd like to run the Bricklayer server and client in free and open source Linux Docker containers:

AFAIU, there are two ways to run a C# app with Linux:

FNA

Dockerizing a .NET Core app:

GUI apps with Docker:

westurner commented 6 years ago

IDK much C# (though I did know C++ many years ago, and write mostly in Python now). Will these work with .NET Core on other platforms? I found FNA (links above) by searching for Microsoft.Xna.Framework linux

$ grin --without-filename -N '^using ' | sort -u | pbcopy

using Bricklayer.Core.Client.Components;
using Bricklayer.Core.Client.Interface;
using Bricklayer.Core.Client.Interface.Controls;
using Bricklayer.Core.Client.Interface.Screens;
using Bricklayer.Core.Client.Interface.Windows;
using Bricklayer.Core.Client.Net;
using Bricklayer.Core.Client.World;
using Bricklayer.Core.Common;
using Bricklayer.Core.Common.Data;
using Bricklayer.Core.Common.Entity;
using Bricklayer.Core.Common.Net;
using Bricklayer.Core.Common.Net.Messages;
using Bricklayer.Core.Common.Properties;
using Bricklayer.Core.Common.World;
using Bricklayer.Core.Server.Components;
using Bricklayer.Core.Server.Net;
using Bricklayer.Core.Server.World;
using EventArgs = MonoForce.Controls.EventArgs;
using EventArgs = System.EventArgs;
using Level = Bricklayer.Core.Client.World.Level;
using Lidgren.Network;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonoForce.Controls;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Pyratron.Frameworks.Commands.Parser;
using static Bricklayer.Core.Common.World.BlockType;
using static Bricklayer.Core.Server.EventManager;
using static Microsoft.Xna.Framework.Matrix;
using static Microsoft.Xna.Framework.Vector2;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.Common;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Channels;
using System.Security;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
westurner commented 6 years ago
PoroCYon commented 6 years ago

First of all, you shouldn't really use .NET Core for Linux, as it requires itself to compile, so you have to download MS blobs. Please use Mono instead. (Wine is out of the question, really, and it uses Mono internally anyway.)

FNA is a drop-in replacement for XNA, so that should just work, except that assets have to be rebuilt. This shouldn't be a problem if you're trying to run the server.

About the Lidgren build: just define the __CONSTRAINED__ symbol as they say, and make sure Mono is up-to-date. Even Cyral himself commented in the first thread:

Compiling with CONSTRAINED fixes this error on mono for me.

The rest of the dependencies should work on any platform.

If you want to run it in docker, make sure it has the Mono runtime, then set up the environment as usual and run mono <binary.exe>. (Also, why would you want to run X11 stuff in a Docker container? If you want proper isolation for those, use eg. FireJail instead.)


FWIW, you might want to set these environment variables if things break:

FNA_KEYBOARD_USE_SCANCODES=1
FNA_OPENGL_DISABLE_LATESWAPTEAR=1
FNA_OPENGL_FORCE_CORE_PROFILE=1
FNA_GRAPHICS_FORCE_GLDEVICE=ModernGLDevice
westurner commented 6 years ago

Thanks!

On Monday, February 26, 2018, PoroCYon notifications@github.com wrote:

First of all, you shouldn't really use .NET Core for Linux, as it requires itself to compile, so you have to download MS blobs. Please use Mono instead. (Wine is out of the question, really, and it uses Mono internally anyway.)

Would a Makefile would be appropriate for a C# project? Or is there something more cross-platform?

FNA is a drop-in replacement for XNA, so that should just work, except that assets have to be rebuilt. This shouldn't be a problem if you're trying to run the server.

About the Lidgren build: just define the CONSTRAINED symbol as they say, and make sure Mono is up-to-date. Even Cyral himself commented in the first thread:

Compiling with CONSTRAINED fixes this error on mono for me.

The rest of the dependencies should work on any platform.

If you want to run it in docker, make sure it has the Mono runtime, then set up the environment as usual and run mono . (Also, why would you want to run X11 stuff in a Docker container? If you want proper isolation for those, use eg. FireJail instead.)

To isolate the app dependencies from the host OS.


FWIW, you might want to set these environment variables if things break:

FNA_KEYBOARD_USE_SCANCODES=1 FNA_OPENGL_DISABLE_LATESWAPTEAR=1 FNA_OPENGL_FORCE_CORE_PROFILE=1 FNA_GRAPHICS_FORCE_GLDEVICE=ModernGLDevice

Thanks again!

Cyral commented 6 years ago

This project is pretty much abandoned and if we ever continue with it we will most likely be using Typescript and WebGL to make it browser based. IIRC The server does work on Mono (although it has been years since I ran it) but the game would need to be ported to FNA or MonoGame. Neoforce controls is a beast and might not run on other platforms so easily since it does some stuff with 7zip to load the assets (Or maybe to export them, again its been a long time)

westurner commented 6 years ago

Got it.

React-VR looks pretty cool: https://facebook.github.io/react-vr/

AFAIU, only Chromium/Chrome have yet implemented WebUSB and WebBluetooth:

On Monday, February 26, 2018, Cyral notifications@github.com wrote:

This project is pretty much abandoned and if we ever continue with it we will most likely be using Typescript and WebGL to make it browser based. IIRC The server does work on Mono (although it has been years since I ran it) but the game would need to be ported to FNA or MonoGame. Neoforce controls is a beast and might not run on other platforms so easily since it does some stuff with 7zip to load the assets (Or maybe to export them, again its been a long time)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Pyratron/Bricklayer/issues/31#issuecomment-368648960, or mute the thread https://github.com/notifications/unsubscribe-auth/AADGy0uDzUmNTnfCNSOB7MMIpps8p51_ks5tYxu0gaJpZM4STnYL .