How to build Lix for a 32-bit Windows machine
=============================================

If you get stuck at any point, don't hesitate to contact me
(Simon N.) and ask me for help:

    Issues: https://github.com/SimonN/LixD/issues
    Forums: lemmingsforums.net, I'm Simon, we have boards for Lix
    IRC:    irc.quakenet.org #lix, I'm SimonN or SimonNa
    E-Mail: s.naarmann@gmail.com
    Web:    https://www.lixgame.com



Consider 64-bit
---------------

I encourage you to build the 64-bit version of Lix instead of 32-bit Lix!
Please see ./doc/build/win64.txt instead of this file, and continue there.

Since 2010, computers with 32-bit Windows are extremely rare. Most likely,
you and your fellow players all have 64-bit machines. 32-bit Lix is inferior:
D's garbage collector will often be confused by 32-bit pointers and thus will
hog memory that could be freed. On large maps, 32-bit Lix will even crash.

But in case 64-bit Lix has other problems for you, here are the 32-bit build
instructions as a backup.



Install D and dub
-----------------

Download DMD, the Digital Mars D compiler:

    https://dlang.org/download

During the installation, when asked:

* Add the programs to PATH. You want to call them from the command line later.
* You don't need to add anything to the start menu.
* You don't need 64-bit support.
* You don't need D1 support.

DMD already ships with dub, the D package manager.



Install Allegro 5 and enet
--------------------------

Locate your D installation directory, and look for the windows/ subdir.
It might be in one of these paths:

    C:/D/dmd2/windows/
    C:/"Program Files"/D/dmd2/windows/
    ~/.wine/drive_c/D/dmd2/windows/ (if you're cross-compiling on Linux)

Your D installation directory has subdirectories bin/ and lib32mscoff/.
If you like, make backups of these subdirectories, so you can retry if
something goes wrong.

I have prepared the DLLs for Allegro 5 and enet in a single archive. Download:

    https://www.lixgame.com/dow/lix-dlls-libs-dmd32.zip

Extract this into your D installation's windows/ directory, preserving the
archive's directory structure. This way, the DLLs should automatically land
in windows/bin/, and the *.lib files should land in windows/lib32mscoff/.



Get the Lix source
------------------

If you have git:

    git clone https://github.com/SimonN/LixD.git

Otherwise, download the source as a zip archive here:

    https://github.com/SimonN/LixD/archive/master.zip

Extract to a directory of your choice. You should have write permissions there.



Compile Lix
-----------

Open a command line window. Navigate to the Lix directory, then run:

    dub --compiler=dmd --arch=x86

It should build the game, finding and linking against the Allegro 5 libraries
in the progress.

If Lix starts and runs well, compile a release build for better performance:

    dub build -b release --compiler=dmd --arch=x86

This takes longer to build. In case of a crash, you won't get a good
crash report either. Non-fatal errors go to ./user/log.txt.



Add music
---------

Lix has music, but the music is not in version control. I encourage you to
add the music for the complete experience. Download:

    https://www.lixgame.com/dow/lix-music.zip

Extract this into Lix's directory, you'll get a subdirectory ./music/.



Appendix 1
----------

You may choose the D compiler LDC instead of DMD. LDC takes more time to build
Lix, but the resulting Lix executable will run with better performance.

Download and install the LDC multilib release.
Then download these library files for Allegro and enet:

    https://www.lixgame.com/dow/lix-dlls-libs-ldc32.zip

Extract this archive into your LDC installation directory (multilib),
thus adding its files into the existing directories bin/ and lib32/.

To build Lix, run:

    dub build -b release --compiler=ldc2 --arch=x86



Appendix 2
----------

To test whether the D compiler is set up, copy this into a file hello.d:

    import std.stdio;

    void main()
    {
        writeln("Hello World!");
    }

Open a command line shell. Depending on which D compiler you want to test
(DMD or LDC), run one of these two commands:

    dmd hello.d
    ldc2 hello.d

It should generate an executable file, hello.exe, and an intermediate object
file, hello.o, which you can safely delete.



Get help
--------

If you run into any kind of roadblock, don't be shy and ask:

    Issues: https://github.com/SimonN/LixD/issues
    Forums: lemmingsforums.net, I'm Simon, we have boards for Lix
    IRC:    irc.quakenet.org #lix, I'm SimonN or SimonNa
    E-Mail: s.naarmann@gmail.com
    Web:    https://www.lixgame.com
