-
Notifications
You must be signed in to change notification settings - Fork 397
Compiling on Windows
In this this tutorial I will explain how you get otclient compiled and running on windows machines.
Download the 2013 installer from Miscrosoft Visual Studio website or download the 2013 installer from Mediafire
Download the latest OTClient sources. The directory in which you place the source files may not contain any spaces (e.g. "C:\OTClient" is good, however "C:\Program Files\OTClient" is not).
OTClient libraries. Or from Mediafire Extract the otclient libraries in the C directory
Download Boost Version 1.55.0 or you can download it from Mediafire then extract and place it in the otclient-msvc13-libs directory.
For now, those libraries are the same as the ones required when compiling with MinGW, although not all of it will be used or required.
Go to OTClient sources \vc12 and right click the sln file and select open with Mircosoft Visual Studio 2013.
At the top of the screen to the right of where it says Local Windows Debugger, make sure Release is selected as your solution configuration & to the right of that make sure Win32 is selected as your solution platform.
Right click the project select properties then go to VC++ Directories then select the Include Directories, select all the text in the box and replace with this.
C:\otclient-msvc13-libs\libogg-1.3.1\include;C:\otclient-msvc13-libs\libvorbis-1.3.3\include;C:\otclient-msvc13-libs\physfs-2.0.3\include;C:\otclient-msvc13-libs\OpenSSL-1.0.1e\include;C:\otclient-msvc13-libs\zlib-1.2.5\include;C:\otclient-msvc13-libs\OpenAL\include\AL;C:\otclient-msvc13-libs\glew-1.10.0\include;C:\otclient-msvc13-libs\LuaJIT-2.0.2\include;C:\otclient-msvc13-libs\boost_1_55_0\include;..\src;$(IncludePath)
Then select the Library Directories and select all the text in the box and replace that with this.
C:\otclient-msvc13-libs\libogg-1.3.1\lib;C:\otclient-msvc13-libs\libvorbis-1.3.3\lib;C:\otclient-msvc13-libs\physfs-2.0.3\lib;C:\otclient-msvc13-libs\OpenSSL-1.0.1e\lib\VC;C:\otclient-msvc13-libs\zlib-1.2.5\lib;C:\otclient-msvc13-libs\OpenAL\lib;C:\otclient-msvc13-libs\LuaJIT-2.0.2\lib;C:\otclient-msvc13-libs\glew-1.10.0\lib;C:\otclient-msvc13-libs\boost_1_55_0\lib;$(LibraryPath)
Let it load the additional libraries, when it says Ready in the left hand bottom corner of the screen. The project is ready to be compiled.
To compile go to Build in the main menu > Build Solution.
In the end you may see link warnings such as.
1>libvorbisfile_static.lib(vorbisfile.obj) : warning LNK4204: 'C:\OTClient\vc12\Release\vc120.pdb' is missing debugging information for referencing module; linking object as if no debug info
Its really nothing to be concerned with, as long as you see this message, you are good to go.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Once it has compiled, take the otclient.exe from the vc12\Release directory and place it in the root directory (root is the directory with init.lua) and unzip these dll's in the root directory as well. OtClient DLL's
Open the code of the project and script away!
Make sure to copy Tibia.dat and Tibia.spr inside /data/things/<version>/ folder before running the client
It is possible that you'll have problems with <unistd.h>, which is a library from MinGW. The easy turnaround for that is to create you'r own unistd.h. For that you'll need to download getopt.cpp and create an unistd.h file with the following code.
Change:
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
To:
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef signed __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
Finally, add the folder with getopt.cpp and your new unistd.h to Visual Studio in the same way you did with the 'OTClient Extra Libraries'.
It is possible that the only problem is the missing AL/, so change:
#include <al.h>
#include <alc.h>
To:
#include <AL/al.h>
#include <AL/alc.h>
There are several tools you need to compile the project, each of which is listed next to their link here:
- CMake 2.8.8 or greater
- CodeBlocks without MinGW, we use a newer version
- MinGW32 20120426 or greater
- otclient libraries for mingw32
- otclient source code
Make sure you install their latest versions, otherwise, things might not work. Note we will be using C:/MinGW as our the toolchain directory, you can change it to your liking but care for conflicts.
Note that GCC must be 4.6 or greater, any older GCC that you have already installed will not work because otclient needs C++11 features which are supported only by recent compilers. Run the downloaded MinGW32 installer and in the installation process make sure that you use the latest catalog when asked and check the installation of the C++ compiler. When finished your MinGW should be installed in C:/MinGW. Note it's safer to install the MSYS system and work with it.[citiation needed].
Run the CMake installer, should in the installation process you get asked if you want CMake to configure your PATH variable, say no, this will be manually set in the next steps.
Run the CodeBlocks installer, _Remember, do NOT install MinGW when it asks.
Extract the otclient-libs_mingw32-dwarf2.zip into *C:/MinGW/. This zip contains 3 folders lib, include and bin which will be merged into C:/MinGW/lib, C:/MinGW/include and C:/MinGW/bin.
Now that all needed tools is installed, you must configure the system PATH variable to make CMake find MinGW32 and the installed libraries, go to:
Control Panel->System->Advanced->Environment Variables
Check if the user variable PATH exists, if not, create one, then set it to:
C:\Program Files (x86)\CMake 2.8\bin;C:\MinGW\bin;C:\MinGW\lib;C:\MinGW\include
Make sure that the user variable PATH exists and refers to the CMake directory properly.
Download the latest OTClient sources. The directory in which you place the source files may not contain any spaces (e.g. "C:\OTClient" is good, however "C:\Program Files\OTClient" is not).
Run the CMake-gui.exe located in \Program Files\CMake 2.8\bin, and specify the directory in which you just placed the OTClient source code, and where you want the project files to be built. Press configure, select CodeBlocks - MinGW Makefiles as the generator, then generate the project files.
Open the said generated Codeblocks Project file (otclient.cbp) by CMake with CodeBlocks, and script away! To compile, you must first configure the folder of MinGW32, by going to Settings > Compiler And Debugger... > Toolchain Executables.
Make sure to copy Tibia.dat and Tibia.spr inside /data/things// folder before running the client
If your CodeBlocks (or CMake) complains it cannot find GCC or any working compiler, configure CodeBlock's compiler via settings there. Any other problem should be posted in otclient's otland forum or alternatively IRC (see README), don't spam! Ask, wait, try to solve it yourself until you get an answer, do NOT re-ask.
If you would like to enable the dx9 support layer for otclient you need to compile with -DOPENGLES=2.0. Now otclient.exe will ask for libEGL.dll and libGLESv2.dll which you can get here, place these dlls with the otclient.exe folder.