This is the main build procedure for Windows version.
Note that this build mode requires GCC for Windows (MinGW), since MSVC compiler cannot be used with Go.
For cross-compilation from Linux to Windows (including WSL), see this page.
See official docs.
To check that installation was successful, open cmd.exe
and write go version
.
It should print the version you installed.
- Install MSYS2.
- Run MSYS2 shell (search for
MSYS2 MSYS
shortcut in Start menu). - Update default packages:
pacman -Syu
. Confirm by typingY
, when asked. If it asks for a restart and closes after the update, reopen the shell and update again. - Install dependencies:
pacman -S --needed git base-devel mingw-w64-i686-toolchain mingw-w64-i686-SDL2 mingw-w64-i686-openal
(confirm by selection with Enter, then confirms installation with typingY
). - Add Go compiler to MSYS2
PATH
variable:echo 'export PATH="/c/Program Files/Go/bin/:$PATH"' >> ~/.bashrc
- Restart the shell again to apply
PATH
changes. - Check if Go compiler is detected:
go version
.
Download the latest source and extract it to some directory.
We will assume the project is unpacked to C:\Dev\opennox
for this guide. Prefer path without spaces and non-English characters.
- Install Git for Windows. Click "next" for all the steps - defaults are good already.
- Install TortoiseGit. When asked for a name and email, either fill it in, or skip by checking the box. It's only used when sending changes to the project.
- Create a directory for projects, let's say
C:\Dev\
. - Right click on empty space in the new folder, select "Git Clone...".
- Paste the project URL:
https://github.com/noxworld-dev/opennox.git
. - Check the "Branch" box, write
dev
to the field. - Click OK, wait for the project to download.
Run MINGW32 shell (search for MSYS2 MINGW32
or MSYS2 MinGW x86
shortcut in Start menu).
NOTE: This is a different shell shortcut, not the one used for updates!
Assuming OpenNox was downloaded into C:\Dev\opennox
:
cd /c/Dev/opennox/src
go run ./internal/noxbuild
You should see that the project dependencies are being downloaded and compiled.
During this process you way see a lot of scary warnings. Don't panic! This is normal.
Build may take a while, especially when building for the first time. Be patient.
If you hit issues, see troubleshooting section below.
Once finished, it should produce opennox.exe
, opennox-hd.exe
and opennox-server.exe
binaries in C:\Dev\opennox\src
.
Make sure you start the MSYS2 MINGW32
shell, not MSYS2 MSYS
(or any other).
- Go to MSYS2 installation directory (
C:\msys64
by default). - Open folder
mingw32\lib
. - Find files
libopenal.a
andlibopenal.dll.a
. - Make a copy of both files with a new names:
libopenal32.a
andlibopenal32.dll.a
. - Rebuild the project.
First, noxbuild
builds all binaries: legacy, HD and server.
You can set it to build only one of them. For example, for HD version only:
go run ./internal/noxbuild client-hd
For legacy only:
go run ./internal/noxbuild client
This should make it much faster, but it may still take a few minutes, unfortunately.
You also need a few DLLs for these binaries to work.
- Create new folder for OpenNox, let's say
C:\Games\OpenNox
. - Copy following binaries from
C:\Dev\opennox\src
:opennox.exe
opennox-hd.exe
opennox-server.exe
- Copy following DLLs from
C:\msys64\mingw32\bin
:libgcc_s_dw2-1.dll
libopenal-1.dll
libstdc++-6.dll
libwinpthread-1.dll
SDL2.dll
- Run
opennox.exe
oropennox-hd.exe
.- If it complains about more DDLs - copy them from MSYS.
- If it says that Nox directory not found - it works! Check this guide to set Nox game path.