GithubHelp home page GithubHelp logo

MonoGame about endlessclient HOT 17 CLOSED

dgadelha avatar dgadelha commented on September 24, 2024
MonoGame

from endlessclient.

Comments (17)

ethanmoffat avatar ethanmoffat commented on September 24, 2024

I've considered converting to MonoGame for exactly that reason. However, I rely on a couple of Win32 calls via p/invoke (for the HDD serial, GFX loading, and logging functions at the very least) that wouldn't be able to port over.

Unless you know of a way that I could make those p/invoke calls from MonoGame on alternate platforms?

from endlessclient.

dgadelha avatar dgadelha commented on September 24, 2024

You could try using a Unique ID for Device, instead of HDD ID, and there's no native function to Load GFX? Logging is pretty easy, just use some filesystem class.

from endlessclient.

ethanmoffat avatar ethanmoffat commented on September 24, 2024

Yeah take a look at GFXLoader.cs - that's my primary concern since it's kind of important to have graphics :)

Regarding HDD ID, I'm not super concerned about replacing it for some platform independence.

For logging, I use native calls for getting Process/Thread IDs. Those could also probably be converted or removed pretty easily, I don't think they're super important.

from endlessclient.

dgadelha avatar dgadelha commented on September 24, 2024

http://www.mono-project.com/docs/advanced/pinvoke/
http://www.gamedev.net/topic/640849-port-xna-to-ios-step-by-step-using-monogame/?view=findpost&p=5047730

from endlessclient.

ethanmoffat avatar ethanmoffat commented on September 24, 2024

That's all well and good, but the GFX are stored as compiled resources that are Windows specific. There are no cross-platform libraries (again that I know of) that provide implementations of the Windows LoadLibrary, LoadImage, FreeLibrary, and DeleteObject that are in use by GFXLoader.

from endlessclient.

dgadelha avatar dgadelha commented on September 24, 2024

LoadLibrary + FreeLibrary => http://dimitry-i.blogspot.com.br/2013/01/mononet-how-to-dynamically-load-native.html
For LoadImage, what's about Porting from Wine (open-source) or ReactOS
And looks like Mono's GdiPlus supports DeleteObject

from endlessclient.

ethanmoffat avatar ethanmoffat commented on September 24, 2024

Interesting. I'll look into this when I get more time and try setting up a Linux VM with monogame. I didn't know there were open implementations of those functions

from endlessclient.

ethanmoffat avatar ethanmoffat commented on September 24, 2024

I'm running into a lot of issues while porting the code base to monogame (running in an Ubuntu 15.04 VM). I may consider porting to monogame on Windows first and then getting it running on Linux separately.

This issue will remain open but is very low priority (cross-platform compatibility is not the primary focus of this project).

from endlessclient.

dgadelha avatar dgadelha commented on September 24, 2024

You really should try on Windows first. The ".exe" that is generated on Windows (via Mono), works on Linux too hehe

from endlessclient.

dgadelha avatar dgadelha commented on September 24, 2024

MonoGame:
After killing a NPC, the NPC fades in and out in front of the player, even after walking O.O

from endlessclient.

ethanmoffat avatar ethanmoffat commented on September 24, 2024

Yeah I thought it was kind of funny :)

Not sure why that happens yet though. I'm working on getting the development environment set up and working on my Ubuntu 15.04 VM, then I'll focus on any bugs that have come into play.

from endlessclient.

dgadelha avatar dgadelha commented on September 24, 2024

Any updates?

from endlessclient.

ethanmoffat avatar ethanmoffat commented on September 24, 2024

Haven't had a chance to work on it recently - I'm hoping to make some time tonight or Saturday.

I'm running up against a content generation issue on Ubuntu. So I may put that on hold until I can get a dedicated Ubuntu machine (running a VM right now)

from endlessclient.

ethanmoffat avatar ethanmoffat commented on September 24, 2024

I've been investigating getting this built on Ubuntu 15.04. As expected, there are a few problems I've come across, mostly related to dependencies on the Windows API via P/Invoke:

  1. GFX Files are Win32 PE Files. There is no native / built-in way to load images from these files on Linux - P/Invoke is used to load them on Windows, which works in mono because Kernel32.dll exists on Windows regardless of how the C# executable is built. GFX images would have to be extracted from the original files, or a custom PE loader would have to be written. This would either break support for the existing client (option a) or be extremely difficult (option b).
  2. XNAControls uses a Win32 Keyboard hook (via P/Invoke) for input processing in text boxes. I haven't investigated very much, but using the native XNA/Monogame support would be less natural as far as typing is concerned, although very possible when compared with the GFX file problems.
  3. Background music uses a System.Windows.Media.MediaPlayer object to play the MIDI files, which is basically a Windows Media Player instance. This is obviously not on Linux. Background music isn't essential to the game, but it is definitely nice to have. I don't know a good replacement for this yet, playing MIDI files is not supported in XNA.
  4. SpriteFonts aren't building correctly. I'm sure I'm just doing something wrong with the project setup, but for whatever reason the content builds the PNG images just fine and throws a vague error for the fonts.
  5. Other P/Invoke functions - I think there are other P/Invoke functions used that would have to be replaced with different functionality on non-windows platforms. One example is the hard drive ID; things like this would be trivial to replace but more investigation is needed.

Fortunately I took out support of GDI drawing (System.Drawing.Graphics) in XNAControls and replaced it with native XNA stuff (SpriteBatch.DrawString), so this removes a lot of uncertainly. However, item 1 on the above list is a big enough problem that I don't think a cross-platform client is feasible without some serious work.

Edit: I'm closing this issue since it isn't possible to feasibly implement cross-platform support at this time. I'll keep working on it though and see if I can resolve the issues mentioned above, since this would be a really cool thing to have.

from endlessclient.

ethanmoffat avatar ethanmoffat commented on September 24, 2024

Stay tuned for Ubuntu support, I've written an open-source cross-platform PE loader (here) that should work on Ubuntu and doesn't rely on the P/Invoke functions LoadLibrary/LoadImage/etc.

Assuming I can replace all the windows-specific P/Invoke function calls, there should be a working Linux build in the near future!

from endlessclient.

dgadelha avatar dgadelha commented on September 24, 2024

Looks good, keep up!

from endlessclient.

ethanmoffat avatar ethanmoffat commented on September 24, 2024

Finally got this working in Ubuntu! See PR #81

Sample:
https://cdn.discordapp.com/attachments/666280326938755072/669796361318694921/unknown.png

from endlessclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.