Lemmings Forums

NeoLemmix => Bugs & Suggestions => Closed => Topic started by: namida on July 18, 2015, 09:52:12 AM

Title: 2.00 Aim for cross-platform?
Post by: namida on July 18, 2015, 09:52:12 AM
Final decision: Due to difficulties in compiling a Linux version that works of even just a small test app, I do not plan to proceed with cross-platform. Sorry.

So, in doing the V2.00n mostly-rewritten code, I'm wondering whether people feel it's worthwhile aiming for cross-platform? I will stress that this won't be a matter of "every system in existance" - I don't at all plan to target Android, or homebrew-capable consoles, for example. I have my doubts about even going for Mac, for the simple reason that I will most likely never own a Mac myself and thus will be unable to test. However, Linux is a realistic possibility; I now have a secondary PC, which runs Ubuntu, so I am able to test a Linux version. If I switch over to Lazarus - something I'd quite like to do regardless, if possible - then it shouldn't be too difficult to also create and support a Linux version.

On the other hand, the benefits of such aren't too huge, since WINE exists.

How many of you's use Linux, and if so, do you think that a native Linux version of NeoLemmix would be a good thing to aim for? I will stress that the Windows version will always remain the primary version.


(If there's much benefit to be had, a native 64-bit Windows version is also a possibility, though I don't see much need for this as the 32-bit version runs fine on 64-bit Windows.)
Title: Re: 2.00 Aim for cross-platform?
Post by: IchoTolot on July 18, 2015, 10:31:56 AM
Well Lemmini ran (a bit surprisingly) on the mac of my old school friend, so maybe NeoLemmix also runs on a mac. I could try it out the next time I meet him and report the results.

I am using Windows 7, but Linux compability would be nice, because I am thinking to get a Linux laptop for programming (well and for a little bit of lemmings in breaks :P)
Title: Re: 2.00 Aim for cross-platform?
Post by: namida on July 18, 2015, 11:16:46 AM
Lemmini runs through Java, which is cross-platform by design. Other than by rewriting NeoLemmix in Java (which I don't intend to do), it can't be ported the same way. Lazarus, on the other hand, is the same language as NeoLemmix already uses, just a slightly different dialect, and porting any parts I don't rewrite should not be a very complicated task. However, I believe WINE exists for Mac, which could enable running it.

While I could theoretically compile a Mac version (I think) once it's on Lazarus, I'd have no way of testing it, thus at most it'd be available-but-not-officially-supported.
Title: Re: 2.00 Aim for cross-platform?
Post by: 607 on July 18, 2015, 03:51:58 PM
Hm, I do use linux, but I still don't really see much need for this. I think most people with Linux will either have Windows as well or will have enough knowledge of the system to emulate it (emulate is probably the wrong word, looking at what WINE stands for, but I don't know how I should call it).
Title: Re: 2.00 Aim for cross-platform?
Post by: GigaLem on July 19, 2015, 03:38:48 AM
might as well go for it since there could be people who want to create levels for lemmings and needs the respective os to do so :thumbsup:
Title: Re: 2.00 Aim for cross-platform?
Post by: namida on July 19, 2015, 11:59:51 AM
So, based on some quick tests and Google research, it seems like cross-compiling from Windows to Linux is a hell of an ordeal to set up. From what I hear though, the reverse isn't so bad, so the option is there of developing on my Linux machine. Or I could just compile the Windows version on Windows, and the Linux version on Linux... this does rely on the assumption that I'll always have two PCs though (or a dual-boot setup).
Title: Re: 2.00 Aim for cross-platform?
Post by: mobius on July 19, 2015, 08:16:58 PM
I also have an Ubuntu PC which I only ever use when this one breaks down. It would be nice I guess but I personally don't care too much.

Can anyone verify how well it runs on wine? Last time I checked (which was a long time ago) what I needed to run [some audio editing programs] ran surprisingly well on wine, compared to the last time I tried years before that. I'd assume they improved.
Title: Re: 2.00 Aim for cross-platform?
Post by: namida on July 19, 2015, 08:41:03 PM
I haven't tried recently; I could try it on my alternate PC, but given that it's a fairly weak netbook (the whole reason I put Linux on there - Win7 doens't run very well on it, and I don't want to use XP), I don't think it would be a great indicator. I also have my old laptop around, if I can get it to stay turned on for more than 10 minutes I can try chucking Linux on that. For the record, when I tried regular Lemmix on WINE ages ago, there were occasional sound-related issues but music, graphics and gameplay were all fine. At that time, Lemmix used a different audio library for sound than it did for music; NeoLemmix now uses the same one for both (a very close relative of the one it formerly used for music) so will probably have no issues in that regard either.

I believe Simon primarily uses Linux, and he's played at least some NeoLemmix stuff, so he can probably give you a good idea of how well it works.
Title: Re: 2.00 Aim for cross-platform?
Post by: Simon on July 19, 2015, 09:25:14 PM
I'm running a 9-year-old laptop (2006/07) with Debian 6 (released 2011) with mostly security patches, a somewhat outdated Wine, but recent video drivers.

I'm experiencing slowdowns with many lems out. Fast-forward doesn't increase the speed anymore around 20 or 40 lems out. Skipping 10 seconds is fast, so the slowdown comes from the graphics.

I haven't built levels in the editor much, neither on old Lemmix, or Neolemmix.

Starcraft 1 in Wine (1998, DirectX 5) slows down with several units on-screen. It's too slow for a LAN game. It ran normally fast under Windows. Badly configured Wine could be a reason, or suboptimally configured video drivers.

Graphicsgale (pixel art image editor) is slow while scrolling. I use this more often than other programs in Wine.

A native version of Neolemmix might run noticeably faster.

-- Simon
Title: Re: 2.00 Aim for cross-platform?
Post by: namida on August 10, 2015, 02:15:55 PM
After looking some more into this, it appears that if I want to create a Linux version, I'll have to use a different graphics library in place of Graphics32. This should be feasible, but that does raise the question of exactly which one to use...
Title: Re: 2.00 Aim for cross-platform?
Post by: geoo on August 10, 2015, 02:44:12 PM
Obviously a native Linux version would be cool, but I'm not sure if it's really worth the effort of porting it to a different graphics library. Depending on how well written and modular Lemmix is, this could be anything from a reasonable task to a nightmare.

For me, Lemmix runs decently under wine, and I assume the same applies to NeoLemmix unless you did some really weird stuff. So maybe your time is spent better implementing the new features well and getting the release out a bit earlier.
Title: Re: 2.00 Aim for cross-platform?
Post by: namida on August 10, 2015, 02:50:09 PM
It won't need to be "ported" as such, as that side of things is being rewritten anyway. More, it comes down to that I have to learn how to work with a different one; and find a suitable one for that matter. Graphics32 is ideal for pixel-based operations; the biggest downside is lack of support for hardware acceleration (all graphics are handled by the CPU).
Title: Re: 2.00 Aim for cross-platform?
Post by: geoo on August 10, 2015, 03:19:17 PM
SDL 1.2 (https://www.libsdl.org/languages.php) naturally springs to mind as a natural candidate, well tried and tested. Mindless has used it, NaOH, I've meddled around with it too and major titles from Valve have used it. SDL2 if you want to be modern.
Also handles sound and stuff.
Title: Re: 2.00 Aim for cross-platform?
Post by: ccexplore on August 10, 2015, 07:31:28 PM
You can architect it for cross-platform but without explicitly supporting multiple platforms by making sure to only use libraries that are cross-platform (eg. SDL as geoo suggested), then open-source it to let others with the ability and skill to build and test for the platforms that you don't/can't officially support yourself.  "Officially support" in this sense means the platforms you actually build, test and bug-fix the game for.

So for example, you can just focus building, testing and fixing bugs for, say, Windows.  Because the underlying code and architecture is cross-platform, most of the code updates will likely carry over to other platforms as well.  People using the opened source for other platforms can focus mostly on whatever extra tweaks are needed to get it to work in those platforms you aren't testing yourself.

All that being said, Windows is major enough of a platform that it seems you can find viable virtualization/emulation solutions for most other desktop OSes to deal with a Windows-only version, so like geoo said, maybe the effort is better spent elsewhere.
Title: Re: 2.00 Aim for cross-platform?
Post by: namida on August 15, 2015, 11:32:41 AM
From the looks of things, it appears that if I write a custom class to handle the behind-the-scenes image processing (which doesn't exactly need to be very complex for NeoLemmix; and has advantages in that I can easily expand these to handle things other than just a bitmap; eg. trigger areas), then the built-in Lazarus components may well be sufficient. In this case, no special library for graphics needs to be found.

And, BASS is already multi-platform, so audio library is already handled. :)

In regards to platforms I'm able to officially support (ie: have access to and can test on), it's just Windows and Linux; unless I also decide to do an Android port at some point (which is unlikely). It might also be possible for me to compile it for Mac, but I have no way of testing such a port.

Overall, it would appear there's some interest in a Linux version. Since developing such would also be good experience for me, and shouldn't entail too much extra difficulty, chances are good that such a port will exist.
Title: Re: 2.00 Aim for cross-platform?
Post by: namida on August 19, 2015, 08:24:33 AM
After some more looking into it, it looks like the above option might not be too viable, on account of that while the behind-the-scenes processing should be no problem, transferring the image onto the screen is likely to be extremely problematic with such a setup; at least using the default components. I've found a graphics class that, although lacking support for hardware acceleration, should be able to provide the functionality needed, while being cross platform (at least as far as Linux and Windows are concerned; I've heard it has problems with Mac).

I'll try and do some testing when I get a chance to see if it looks like the speed is acceptable, especially when dealing with high-resolution.
Title: Re: 2.00 Aim for cross-platform?
Post by: namida on August 20, 2015, 10:07:46 AM
Okay well; regardless of what I'm trying, I'm having no luck with compiling a Linux version, regardless of what libraries I use, and regardless of whether I try to cross-compile or compile it on Linux natively.

As such, I'm going to stick to Windows-only. Of course the option is there for me (or someone else) to port it later. I'll still use Lazarus for it, so it should (theoretically at least) be able to be compiled for Linux.

Sorry to anyone who had hoped for a Linux version. However, it should hopefully continue to work fine under WINE.
Title: Re: 2.00 Aim for cross-platform?
Post by: geoo on August 20, 2015, 08:53:17 PM
What kind of errors are you getting? Is it using some weird Delphi specific stuff that's not natively part of the Pascal language?

btw, I hadn't used (Neo)Lemmix much in Wine before, but now the fullscreen is working a bit erraticly, sometimes when testing the level, it just shows a small 640x480 (or so) section of what should be displayed, meaning I can't see most of the playfield. The preview screen is sometimes also windowed (but completely visible) and sometimes fullscreen. But usually with a restart or two of wine it happens to work fine at some point.

EDIT: Sorry, I didn't realize this was actually locked for whatever reason until Simon made me aware of it when he wanted to reply.
<SimonN> geoo: you wizard of admin rights, I wanted to reply to that topic too (cross-platform NL) and he locked it
Title: Re: 2.00 Aim for cross-platform?
Post by: namida on August 21, 2015, 02:31:49 AM
Basically; Lazarus is insisting that it can't find a certain file in the "uses" section, even though I've triple-checked that it's in the search path. The exact same setup compiles without any problems on Windows (this does mean that if I can get cross-compile to work, this could be an alternative option, but as I mentioned I've had no luck with that either). I might take another look and see if I can get it going at some point, but I'm kind of making it a low priority for now.

EDIT: At a quick glance, it seems the problem here *might* be caused by my unfamiliarity with Linux; in particular, not taking into account its case-sensitive nature with filenames. I'll check and see if this is really the issue...

EDIT: Indeed, adjusting for this got the code to compile! This does still leave a major issue in that the compiled code doesn't seem to actually work (it displays a blank window, and doesn't resize / go full screen as it should), but if I've at least got it to compile, then that's a start.

EDIT: Okay, I've got the resizing of the image display handled; the problem comes from that when an image is displayed on the window, the OnKeyDown event of the form applies under Windows, but of the image applies under Linux. Goes without saying that I have no idea why this happens; but simply making sure *both* handle the event properly solves this issue. For some reason though, it doesn't actually resize the window itself properly... and it still won't actually display the image under Linux. Through some other test code I inserted, I can confirm the problem comes from actually *loading* the image; not from displaying it.

EDIT: Tried modifying the code so that it uses a standard Lazarus class to load the image, before transferring it into the addon graphics package one. The result was the app (which I should mention - at this point, all it does is display a static image and resize it according to zoom / full screen) taking FOREVER to load. Once it loaded, the image display worked fine (still need to address the resize issue). I believe this is due to the standard class being known to perform very slow on Linux; but another weird thing happened here - the result was inverted colors when tested on Windows, yet correct color displays when testing on Linux.

All in all, it looks like indeed, cross-platform is going to be far too much of a hassle if I intend to use anything Delphi-like to do it. With this in mind, I go back to what I said before - NeoLemmix V2.00n is still going to be Windows-only. Given this, I'm considering just working with Delphi, as there's quite a few things that annoy me about Lazarus's interface... I would assume that should someone be willing to get around these issues, converting it to Lazarus would be the least difficult part, since Lazarus 99% automates that.