Skip to content
Rey edited this page Nov 27, 2024 · 37 revisions

Instructions for project compilation

Introduction

This instruction explains how to compile a working project.

Pre-requirements

  • Microsoft Windows OS: XP or higher (we did not test 95, 98, Me, 2000, but they would probably work as well)
  • Delphi (version 2009 or higher)
  • GIT client (TortoiseGit, GitHub for Windows or any other of your choice)
  • OpenGL 1.5 compliant GPU
  • Original "Knights and Merchants: The Peasants Rebellion" installed
  • Latest KaM Remake installed
  • Lazarus (32bit, version 2.0.6 or higher) (needed for Linux dedicated server)

Optional (can be ignored or skipped with conditional switches):

  • madExcept installed
  • OpenAL drivers installed (you already should have it, if sound in the Remake works for you)

Walkthrough

  1. Clone the project onto your PC using Git client:
    • Right-click in a folder where you want the project to be (e.g. "C:\My Documents\") and select from drop-down menu "Git Clone"
    • Specify path to our repository, "https://github.com/reyandme/kam_remake" and destination folder (e.g. "C:\My Documents\kam_remake\"). Git will do its job in couple of minutes.
    • After cloning: right click and choose "Show more options -> TortoiseGIT -> Submodule update". This should update external dependencies. Some might fail, ignore until it turns out you need them.
    • From now on paths in this guide will be written as relative, so e.g. ".\Maps" means "C:\My Documents\kam_remake\Maps\"
  2. Copy resource files from your "Knights and Merchants: The Peasants Rebellion" installation.
    • You need ".\data" folder, copy whole of it into project folder. When asked - replace all of the existing files/folders.
  3. Copy resources from your "KaM Remake" installation.
    • Copy all the folders from your "KaM Remake" installation. When asked - replace any of the existing files/folders.
    • You will need to revert any downgraded files (do the git > Revert)
  4. You won't have our private network authentication unit, so open ".\KaM Remake.inc" file with Notepad and place a dot like so "{.$DEFINE USESECUREAUTH}" to disable it.
    • This will make Delphi skip all the code within USESECUREAUTH clauses.
    • This authentication unit makes it harder for someone to join a multiplayer game using an unofficial client that they compiled themselves.
    • If you somehow have our private network authentication unit (or you wrote your own) then you can skip this step.
  5. If you don't have madExcept installed (it's free for non-commercial use), then open ".\KaM Remake.inc" file with Notepad and place a dot like so "{.$DEFINE USE_MAD_EXCEPT}" to disable it.
    • This will make Delphi skip all the code within USE_MAD_EXCEPT clauses.
    • If you have madExcept installed - skip this step.
    • If you want to install it check official website
  6. If you have access to the private repo with sprites: Use RXXPacker util to generate RXX and RXA files. This will convert sprites to the format that we use in the Remake.
    • Copy all the *.rx files from ".\data\gfx\res\" to ".\SpriteResource\" folder.
    • Launch the Delphi/Lazarus and open ".\Utils\RXXPacker\RXXPacker.dpr" project.
    • Compile and launch the project.
    • Check the paths are correct relative to RXXPacker.exe (typically "....\SpriteResource" for RX, "....\SpriteInterp\Output" for interpolated and "....\data\Sprites" for destination)
    • Ensure all 6 available items are selected, RXX and RXA checked, then press "Pack selected".
    • The program will work for 5-10 min, displaying progress on the right.
  7. If you don't have VirtualTreeView installed, then open ".\KaM Remake.inc" file with Notepad and place a dot like so "{.$DEFINE USE_VIRTUAL_TREEVIEW}".
    • This will make Delphi skip all the code within USE_VIRTUAL_TREEVIEW clauses.
    • If you have VirtualTreeView installed - skip this step.
    • If you want to install it check official website and their github repo
  8. Now you can open ".\KaMProjectGroup.groupproj" (if you have Delphi XE+) project and compile the project and/or its utility tools. Or ".\KaM Remake.dpr" if you have older Delphi version.
    If you open ".\KaM Remake.groupproj" there will be 2 projects with the name KaM_Remake.exe. Second in the list used for not full project compilation (faster version) and should be used with caution to avoid unexpected results due to not full recompilation of the sources.
    So make sure you select first KaM_Remake.exe project in the projects list on the very first compilation (just double click on it).

Project compilation on Lazarus details

⚠️ Warning
At this moment, the Remake cannot be built on Lazarus.
  • Download Lazarus version 2.0.6 32-bit or higher with FPC (free pascal compiler) 3.2.0 or higher. Latest Lazarus version could be found at Lazarus project repository
  • Start lazarus. Open menu Package -> Online package manager. Choose BGRABitmap and install it. After package it will be unzipped and installed. Choose 'Rebuild lazarus' on request.
  • Now you can open KaM_Remake.lpi and compile project
Clone this wiki locally