How to build 64-bit Lix for Windows
===================================

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

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



Install LDC and dub
-------------------

Download the D compiler LDC, version 1.21.0 or newer; prefer the download that
ends in -windows-multilib.exe:

    https://github.com/ldc-developers/ldc/releases

The download that ends in -windows-multilib.7z will also work, it's an
alternative. LDC versions 1.25 and older will offer only the .7z.

I do not support LDC versions older than 1.21.0. If very new versions give you
errors when building Lix, tell me. On Win 7 or on Wine 6.4 and older, LDC 1.25
and 1.26 don't work due to linker problems; these LDC versions are still good
on Wine 6.7+, Win 8, or Win 10 are fine. If you want to use DMD instead of
LDC, see below at "Building with DMD".

* If you downloaded -windows-multilib.exe:

    Run it. This is an installer. The default choices are okay for Lix.
    The installer will add LDC's bin/ directory to your PATH variable
    automatically.

* If you downloaded -windows-multilib.7z:

    Extract this archive, e.g., with 7-Zip from

        https://www.7-zip.org/download.html

    ..., to a directory of your choice. We will refer to the extracted
    directory as the LDC directory. Add LDC's bin/ subdirectory to your
    Windows PATH variable; for instructions, see addtopath.txt in the same
    directory of this file, win64.txt.



Verify that LDC and dub work
----------------------------

Windows LDC already ships with a Windows version of dub, the D package manager.

To verify that both LDC and dub are installed properly:

    1. Open a command prompt anywhere.
    2. Run "dub" or "ldc2" without quotes.
    3. Check that both programs are found and output something different
        than "is not a recognized program or command".



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

I have prepared all necessary DLLs in a single archive tailored to the LDC
multilib release. Download this:

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

Extract this into your LDC directory. You will get new DLLs in bin/ and
new LIBs in lib64/. Proceed to the next section, "Get the Lix source".

If you use another release of LDC, especially the "-windows-x64.7z" release,
then the lib directory might be called differently than lib64/, e.g., just
lib/. Copy into your lib directory everything from my extracted lib64/.

If my DLLs or LIBs fail, or if you prefer another way to get the Allegro 5 and
enet DLLs and LIBs: You can build these libraries from source, or you can get
the Allegro DLLs and LIBs from its NuGet binary package:

    https://www.nuget.org/packages/Allegro

Click Download on the right. Unzip the downloaded file allegro*.nupkg, it
is a normal zip archive. Go to build/native/v141, and you'll see Allegro
.lib and .dll files for win32 (= 32-bit) and for x64 (= 64-bit).
You don't need any files with "debug" in their name. Copy the other DLLs to
LDC's bin/ dir. Copy the other LIBs to LDC's lib64/ dir or the respective dir
name for releases other than multilib. Match the filenames to what I provided
in my archive.



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

* If you have git:

    Clone Lix's repository:

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

* If you don't have git:

    Download Lix's source as a zip archive here:

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

    Extract to a directory of your choice. We will refer to the extracted
    directory as the Lix directory.



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

Doubleclick win-build.bat in the Lix directory to build the game.
If successful, you will get an executable ./bin/lix.exe, run it to start Lix.
If Lix runs, proceed to the next section, "Add music".

If you prefer the command line, try one of these commands:

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

The first command builds a debugging version that builds faster and produces
better error messages in case of a crash, but runs slower.

The second command is the same as the batch file win-build.bat. This builds
a release version that takes longer to build, but runs faster. Non-fatal
errors during play will be written 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 a more complete experience. To get the music, download:

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

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

You are done!



Building with DMD
-----------------

DMD is an alternative D compiler. It is possible to build a 64-bit version of
Lix with DMD instead of LDC as well, even though LDC is recommended for better
playing performance. DMD version 2.094.1 works, older versions might work
but aren't guaranteed to work, and newer versions should work; tell me if
a newer version doesn't build Lix.

To build Lix with DMD, adjust the following steps in above build instructions:

Getting compiler 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 extra 64-bit support (DMD works self-contained since 2.079)
* You don't need D1 support.

DMD already ships with dub, the D package manager.

If you only need to build Lix for 64-bit architecture:

    Download the Allegro 5 and enet DLLs and LIBs that I prepared:

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

    Extract this into your dmd2/windows/ directory. You will get new DLLs in
    bin/ and new LIBs in lib64/. Proceed to the next section, "Get the Lix
    source".

Otherwise, if you want to setup DMD to build Lix for both 32-bit _and_ 64-bit:

    Edit Windows's/Wine's PATH variable (for instructions, see addtopath.txt
    in the same directory of this file, win64.txt, but instead of adding LDC's
    directory, do the following): Append a semicolon to the PATH variable,
    then append the full path to DMD's windows\bin64 directory.

    Reason for this manual adding to PATH: DMD's installer adds only the
    32-bit directory to the PATH, but we want the separate 64-bit directory in
    the PATH, too, so that the DLLs will later be found when running Lix.

    Download the Allegro 5 and enet DLLs and LIBs that I prepared:

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

    Put the Allegro 64-bit DLLs and the enet 64-bit DLL into your D
    installation's dmd2/windows/bin64/ directory. Put the *.lib files into
    your D installation's dmd2/windows/lib64/ directory.

Get the Lix source as described in the section "Get the Lix source" above.

Compile Lix: Use one of the following command lines, depending on what kind of
build you want. The release build (second command) takes longer but will
have better performance during play.

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



Get help
--------

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

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