|
step 1: pascal compiler + IDE
Go to Lazarus Homepage and download Lazarus.
As of the date of this guide (Oct 2010), the latest stable Lazarus build is quite old, so it's recommended to use one of the nightly builds. They can be found on the lazarus homepage under "Daily Snapshots" (direct link).
Which version you use is up to you, the snapshots are available for the different pascal compilers (fpc) 2.4.0 and 2.4.3 for 32bit-Windows and 64bit-Windows. In the tutorial we use the latest version "Lazarus + fpc 2.4.3", but fpc 2.4.0 was also tested and should be fine, too. We will use the win32 version for now.
We donwload and install it. You will need administrator rights to install it! As the installer of the daily snapshots don't automatically ask for administrator permissions, you better start the installation with administrator rights already. therefore click the file with the right mouse button and select "Run as administrator" if you don't have administrator rights already. For troubleshooting, see this forum.
On the page Select Components, we select every component (equivalently choose Full Installation).
step 2: svn
If you already have svn installed or know how to use it, you can skip this paragraph and head to the next step.
Go to TortoiseSVN Homepage and download it. According to your system, you can safely use the 64bit oder 32bit-version (direct link).
You again will need administrator rights to install TortoiseSVN and also need to reboot your system after installation. This is because TortoiseSVN needs some overlay icons to be correctly displayed in windows explorer like these examples. A nive description of the important overlay icons can be found here. In brief, the most important icons are the green checkmark, that means that the file on your computer matches the file on the svn host server. The red exclamation mark means that the file stored on your computer is modified, which means it differs from the one on the server. The blue question mark means, that the file on your computer is not (yet) stored in the svn host server. All of those icons are displayed above the existing icons of your file. It appears as a circle on the bottom left.
step 3: get the latest source code
The Knights and Merchants Remake-Project is hosted on google code, here!. On the page Source, it says how to checkout the code. Forget about the command line tool for the moment, we only need to remember the URL http://castlesand.googlecode.com/svn/.
Now go to the folder of your choice where you want to download the latest version of the Remake to. Create a new folder, in this example it is called kam. Right-click on it and select SVN check-out.
In the appearing dialog, you need to enter the URL in the first line, http://castlesand.googlecode.com/svn/. Then click OK and see how the files are being downloaded to your PC.
Wait until the process has finished, it then says something like Done in revision xxxx, where xxxx is the current revision (version) of the code. You can safely click OK now, you're already done and the code is saved locally on your computer. You will notice the green checkmark on your kam-folder and on all item inside the folder. It will look something like this. Enjoy the view once, because as soon as we load the project into lazarus, many files will be added or changed.
step 4: start lazarus
We are now ready to start lazarus. On the first run, it will look similar like this, with the five windows overlapping each other.
- Main windows: here the familiar menus like File and Edit can be found
- Source editor: this is the editor window, where the pascal source code files can be edited
- Messages: will become important when we compile
- Object Inspector: can be used to change properties of the form elements
- Form-Window: how the form of the program looks like
On the startup, lazarus will have build a new project, so you will see some lines in the Source Editor in a file called "Unit1" and an empty Form-Window. Ignore them all and directly go to open our kam-project. Press Ctrl+O oder File-Open and a) browse to your recently filled kam-folder, b) select that you only wish to see project files and c) select the KaM-Remake.lpi, the project file of Knights and Merchants Remake.
Lazarus will ask you wheter you want to open the project or the file as a XML file. Choose Open project. The changes made to the automatically generated prject1 can be safely discarded. Choose no to not save them.
Now you have loaded the project. You will notice that the Source Editor now shows many files and the Form window shows something, too.
We are now very close to our aim of compiling it - but the most important step is missing: the actual compiling. Now the moment of truth appears. We either hit Ctrl+F9 or click in the Main Window on Run-Build and curiously look at the message window. But first, it will ask you a question about the LCL. Click Ignore for the moment, and the compiler will start and fill the Messages-window.
It is not unlikely that the code doesn't compile, for example the revision 1107 we are using in this tutorial gives us the following error. In the Messages-window, the compiler tells us where the problems appears, first the file name, then in brackets the line number and the position. Then it provides us the actual error message, in the previos case it is Error: method identifier expected. If you are a programer, you can now start an fix this bug. If you are not familiar with programing, just go to the Knights and Merchants Forums and tell the programers about the bug. Alternatively, if you have a google account, you can go to google code and submit a New issue to the bug tracker.
You know that the code compiles without error (for this tutorial, we used revision 1039 which builds in Lazarus and fpc 2.4.3 without changing the code), when the message Project "KaM_Remake" successfully built appears at the bottom of the Messages-window. If this is the case, you are happy, because everything went fine and you just compiled KaM Remake on your own!
Now it is time to look for the exe file the compiler has generated. If the compilation was successful, inside your kam-folder you will find the freshly built exe-file. Don't be scared that this file my be some 10 Megabytes large, this is because the compiler with the standard settings builds the exe-file with all debugging-information needed. If you set the compiler to build a release exe-file, it will be much smaller.
This exe-file can now copied to your installation of Knights and Merchants Remake, replacing the existing exe file. You can now start KaM with the latest version available and with the good feeling of running your self-compiled program.
Now let's all praise the makes of KaM-Remake, it's an awesome piece of software they're creating! Thank you very much.
|