Note in 2016: This is now too old (16-8 = 8 years!). You can glean some helpful things from this, but don't expect anything to work as described here. Sorry.
Note: This is now a bit old. I have updated the text & files as possible, but MSVC 2010 has a bit different menus and I don't have (now) access to computer with it. Keep telling me to fix this
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
I don't know if this works for 64bit OSes.
I omitted restarting system, you'll have to do so probably twice.
1 ) Download Microsoft Visual C++
- 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 ) From Dwachs'
post, download header
and unpack the zip. The .h
file goes to shared/include
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).
EDIT: The above will always work. Below depends on updated attachments. Thus if this does not work, use the above way.
You can save yourself the trouble with steps 17-18 and use the attached project files. They go to trunk/MSVC2k8/*.*
- in other words, in folder trunk
you should have a folder MSVC2k8
and in it some files. This is on purpose, so that you don't overwrite any files tracked by svn.
When they are outdated, post here and demand new.
EDIT: instead of attachment, link:http://vs.simutrans.com/misc_files/simu-MSVC2k8.zip
EDIT: Added pthreads. Corrected ftp link.
EDIT2: For r7808 onwards you need to set the "character set" in "properties->general" to "undefined" or "no set" and not Unicode (depending on your interface langauage).