Contributing to ENIGMA => Developing ENIGMA => Topic started by: Goombert on January 17, 2015, 12:41:35 pm

Title: MinGW 64
Post by: Goombert on January 17, 2015, 12:41:35 pm
Ok so I decided to see what it would take to finally support 64bit in ENIGMA.

The first thing was getting JDI and the Compiler to build with MinGW64

Edit: Josh approves as of this commit.

Edit: Josh advised me to use the fixed size types for the overload, so now the compiler builds with C++11 support too for both 32bit and 64bit GCC

I should not have wrote those straight to master but they may need reverted, anyway...

64bit Java/JNA can only load 64bit dll's and 32bit Java/JNA can only load 32bit dll's. This means that the users Java installation with ENIGMA thanks to the plugin and using ENIGMA the way we do will have to match the architecture of that the user not only has but also intends to target.

So if you have 64bit Java, with any ENIGMA release you will only be able to make 64bit games. And if you have 32bit Java you can only build and use the 32bit version of ENIGMA. But you could install both 32bit and 64bit ENIGMA in parallel and Java in parallel to be able to build for both architectures if you have a 64bit OS.

One possible alternative is to remove the requirement of JNA and compileEGMf all together replacing it entirely with the CLI allowing you to build both 32bit and 64bit applications with either a 32bit or 64bit Java installation. We could then use a MinGW that supports dual target though the exception support would be pretty grotesque, just because that's the state of current dual target MinGW compilers. Another way of accomplishing the same thing is to build compileEGMf for the supported Java architectures which would still require a dual target MinGW.

1) Do we want both a 32 bit and 64 bit ENIGMA portable, or just a very large single ENIGMA portable? If the former you would have to download both portables in order to build for both architectures.
2) Do we want to be able to build 32 bit games when we have a 64 bit Java installed to run LGM?
3) This is tied to the first question, but do you want proper gcc exception support or not? Because if we go with dual target either 64bit exception support is bad or we maintain two separate releases. If not we could include both mingw32 and mingw64 instead of a dual target mingw64, and that may or may not mean we have two separate portables.

Addressing this problem would fix several issues.
1) 64bit Java would be supported to run ENIGMA
2) 64bit compilation support would be added.

For the record Qt Framework also makes you install separately, as does Java and .NET and a lot of other programs.

Note: The good news is also that JNA supports both 32bit and 64bit so there's no need to distribute two versions of it.
Title: Re: MinGW 64
Post by: Darkstar2 on January 17, 2015, 01:40:49 pm
So you mean our actual compiled game would be 64bit native and only work on a 64bit OS right?

Considering the majority of games out there now are still 32bit, and most modern games at higher res are GPU intensive, would there be any real benefit to compile to a 64bit executable rather than 32bit where it comes to ENIGMA ? Given the type of games people create with these tools would there be any noticeable speed difference?
Title: Re: MinGW 64
Post by: Goombert on January 17, 2015, 01:49:56 pm
Darkstar2 that gets into 32bit vs 64bit, and I don't want to derail his topic too much but primarily 64bit apps can handle threads better and 32bit apps are limited by most operating systems to something like only 1GB of RAM usage. So yes 64bit does mean better performance for games. And I believe 64bit apps should still work on 32bit, it just means they may be kinda buggy, you can run 64bit Firefox on i686 but it won't really give you any performance boost.

The real reason for addressing this is so that users can use either 64bit or 32bit Java, I don't like telling people to have to install both of them in parallel, they should be able to use the Java installation they already have. LateralGM would also work better with the plugin in 64bit mode because it can be allotted more RAM.
Title: Re: MinGW 64
Post by: egofree on January 17, 2015, 02:25:29 pm
I think we should support only 64 bits version and drop 32 bits. Most of the OS are 64 bits now, and anyway LateralGM doesn't work correctly on Windows XP 32 bits. I did some tests last year on a virtual machine and it didn't work.
Title: Re: MinGW 64
Post by: Goombert on January 17, 2015, 02:44:26 pm
Windows 10 is still supporting 32bit though egofree, there's no hurt in supporting things even if not everyone needs them, especially when it's little effort. Right now I've included the compileEGMf fixes for MinGW64 above and Josh approves. So now the additional/include additional/lib folders need recompiled on Mingw64, I don't have any time right now or I would. Once that's done they just need included in a separate Portable ZIP with MinGW64 (SEH exception, Win32 threads; and x86_64 architecture) and we have a 64bit Portable ZIP.
Title: Re: MinGW 64
Post by: The 11th plague of Egypt on January 17, 2015, 03:53:00 pm
Thank you for the effort.

By the way, there's also the option of using TDM-GCC.
It's probably the easiest way to get both 32bits and 64bits compilers to live together on Windows.
It uses Mingw64 inside and it comes bundled with many IDEs (e.g. CodeBlocks).

Title: Re: MinGW 64
Post by: Darkstar2 on January 17, 2015, 08:42:22 pm
So Robert with 64bit support to ENIGMA soon, this could mean big games with bigger RAM access, instead of the 2GB limit right ?  I can't wait to do some comparative testing though I believe that in most cases most people won't notice a difference in speed, because the 32bit version is faster than most people need for the current games people make. it would be nice for a project that would push limits where 64bit can shine.
Title: Re: MinGW 64
Post by: time-killer-games on January 18, 2015, 12:20:13 pm
GameMaker:Studio doesnt support 64 bit as like most game engines. This is nice to have. I know this topic is about windows, just wanted to say its also awsome enigma supports 64 bit linux but GMS games wont even run on that.
Title: Re: MinGW 64
Post by: TheExDeus on January 18, 2015, 02:48:15 pm
I think having two releases is the best option, and it's the most popular. Allowing people to compile to both from LGM's IDE would be magnificent, but as you already pointed out, it's hard to do. I have used TDM-GCC though and it does allow you to compile both 32bit and 64bit from the same installation, so it might be an option.
Title: Re: MinGW 64
Post by: Goombert on January 18, 2015, 05:45:57 pm
First, I'd like to point out that TDM GCC is garbage Harri, though it does support dual target, at this point I am pretty sure we will not go with dual target though it will be possible if somebody really wants to build 32bit games. The first objective here is to just get 64bit support working then we can work out the other details. But I think another change my come first. The Portable ZIP was designed with the Mingw32 from the official installer of the MinGW 64 project by fundies/cheeseboy from http://sourceforge.net/projects/mingw-w64/

I tested again to see if installing i686 (32 bit) would work with ENIGMA using COMMONPROGRAMFILES/mingw-w64\x86_64-4.9.2-win32-seh-rt_v3-rev1/ and it worked because these installers make sure the path does not contain spaces like the TDM GCC installer may do. This solution will still not work for the Windows SDK as that is a GNU Make problem. So the first step here may in fact be to remove mingw all together from the ZIP and go back to forcing you to install it. This will make smaller ZIP releases and allow me to release them more quickly. And I may decide to also make you install git if you optionally want it. This way you don't have to download our packaged versions each time you want to update, because really that is stupid.

It would just be nice for everyone to give me a yay or nay on this, I already know where Josh and I stand on removing mingw and git from the ZIP.

Edit: On a side note I have decided to create the following Wiki article that further explains the current state of using parallel Java installations with ENIGMA.
Title: Re: MinGW 64
Post by: TheExDeus on January 18, 2015, 06:48:47 pm
The only way I support removing mingw and git is if extremely easy and straightforward alternative is in place. Like maybe we need to make our own installer? Like a runner which handles auto-updates, dependencies (Java, Git, MinGW) and allows you to actually run the LGM. This is how UE4, Unity and GM:S (as far as I'm aware of) does it. Most game engines (and games) does that. That would be extra development effort though.
Title: Re: MinGW 64
Post by: Goombert on January 22, 2015, 11:12:03 pm
That's a possibility and yes it would be relatively straight forward Harri.

I think I will just recompile the libs for 64bit and get a 64bit Portable out first and then we can discuss restructuring the ZIP's.

On side a note I had to push another fix to make it build for Mingw32 again, so it builds for both now, it should work for both 32bit and 64bit GCC on Linux now as well. In addition the compiler now builds with C++11 support.
This was to fix the issues reported in the other topic.

Edit: Just a quick update here I managed to get the basic engine compiling with Mingw64.

Thanks to Rusky for making a 64bit zlib and me finding a 64bit FFI lib, the basic engine and graphics now build. What you see in the following screenshot is the first 64bit ENIGMA game built with Mingw64 with LateralGM running in a 64bit JVM and a 4GB memory capacity. It can build at least Project Mario with DirectSound so far.

Note: If you try setting -xmx to larger than 1GB in the regular Portable the OS will probably not allow LGM to launch, I've tried it myself.


There are only 3 things left to do, build a 64bit OpenAL, Box2D, and Bullet and we can release a 64bit Portable. OpenAL will be the bulk of the work because we have to rebuild vorbis and a bunch of other libs to support all the audio formats.