This documentation is for MSVC express 2012. Since MS has the nice habit to break stuff more and more with each revision, it will probably not work with newer versions with fiddling around.
It is quite easy - I almost feel sorry to spare you from recompiling dependencies with GCC and such jokes. Well, real hackers don't have to follow
1 ) Download Microsoft Visual C++ express
- for free,
2 ) install it.
3 ) Download precompiled libraries for OpenTTD
- follow link with highest number, then download the zip file with binary data; its name might include win
and should not contain source
4 ) Unpack this zip file somewhere - as an example, C:\example\ottd_libs
. Inside this folder you should have a bunch of folders, namely win32
5 ) Download this http://www.simutrans-forum.de/forum/index.php?page=Attachment&attachmentID=22880&h=80d291ab255fe9584ba174c40bd7dfb9b596ac25
zip with the compiled bz2lib for MSVC or use the 7z file from below. The .h
files goes to shared/include
in the OpenTTD case) to win32/library
6 ) Get the pthreads library for Win32
. From the folders select the one with highest prebuilt-dll-x-y-z-release
number. You should know now where the lib and h files go ...Important:
You need the DLL. Put it where your pak folders are!
7 ) Start MSVC and in menu, go to options (tools->options
), a window opens with another set of choices to the left, you want to change directories (projects and solutions->VC++ Directories
8 ) the dropdown menu in the top-right corner (it says Executable files
at first) - set it to include files
and add to list folder shared/include
from the downloaded archive - example, C:\example\shared\include
9 ) Do the same with library files
- add there win32/library
- example C:\example\win32\library
Now you're set up for compiling - but don't have the sources!
10) Install Tortoise SVN
(it integrates into Explorer).
11) Create new folder - eg. simutrans_src
12) Click on it with right mouse button - choose SVN Checkout
. A window pops up.
13) URL is svn://servers.simutrans.org/simutrans
- Leave the other options be, they're all correct.
15) If asked for password, enter user anon
and leave password empty.
(Alternatively you can use the command line svn - that is not material for this guide as it's aimed for click-and-go solution)
And now - Christamaaaaas!
17) In the folder downloaded from svn (maybe simutrans_src
) go to simutrans\trunk
- you can see the lot of source files.
18) Open file simutrans.vcproj
19) It is from older version, you have to go through wizard for project file update. Again no need to change any settings.
20) Once this is completed, to the left should appear some stuff (Solution Simutrans
blah blah). In menu, choose Build->build solution
22) Simutrans executable appears in folder debug
(inside the folder with sources is folder Debug
If you want to run simutrans from MSVC for debugging, you need to change the project properties -> debug
THe command line needs to start with -use_workdir
and the working directory should point to the simutrans folder than contains your pak-folders (and the DLL).
Hopefully this can replace the old instruction by VC (Thanks!) and does work again.