Post 20 Jun 2014, 09:38 by Lewin
As Krom says, our code is currently designed only for 32 bit. There are many places in the code where we assume that Integer, Cardinal, Boolean, object pointers, etc. are all 4 bytes (or at least the same size on every PC running the game). The first task would be to change EVERY usage of those types, which is obviously a massive task and very disruptive to any ongoing work. The best way to go about it would be to define our own versions of the types we need, so we can fix them as 4 bytes. For example:
type KInteger = LongInt; KCardinal = LongWord;
(K for KaM) Then everywhere we use Integer and Cardinal where size matters (especially where it will eventually be use in IO like save files, networking, scripting, etc.) then replace it with the "K" versions. This means the size of those types is only defined in one place rather than scattered everywhere in the code. Intger and Cardinal are the only "native" types in Delphi which will be different on 32/64 machines. Byte, Word, etc. will be the same on both 32 and 64 bit.
NOTE: This is just an idea, not a plan. Please don't do this without discussing it with both Krom and I because obviously we need to fully agree with such a massive change (and if you do it without asking we won't merge your changes). It will probably also introduce a lot of bugs so it might be best to do it after the next release (we don't like to do any structural changes when we're close to a new release, because of unexpected bugs).
On the other hand, a 32 bit Linux port should be fairly straight forward. I've successfully compiled the game on Linux several times by commenting out stuff that doesn't work for Linux yet (for example the sound library, taskbar flashing, etc.). You can use compiler directives to have separate code for Linux/Windows, which we've already done in some places.
If you are serious about making a port then I suggest you make a 32 bit Linux port first (which should not be hard, a lot of the work is already done), then later make our code 64 bit compatible (which is a massive task). Any patches you submit for a 32 bit Linux port should be fairly easy to merge and unlikely to cause bugs in the Windows version (since you will mostly be working within {$IFDEF UNIX} compiler directives). But if you want to do any big changes, it's best to ask us first.