ProjectCompilation - reyandme/kam_remake GitHub Wiki

Instructions for project compilation

Introduction

This instruction explains how to compile a working project.

Pre-requirements

  • Microsoft Windows
  • 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

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

  • madExcept installed
  • Lazarus (32bit, version 2.0.6 or higher) (needed if you need to compile Linux dedicated server)
  • OpenAL drivers installed (you already should have it, if sound in the KaM 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, 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 KaM 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).
  9. If you have rights to commit to the repository directly, make sure to enable Hook Script:
    • Open TortoiseGit settings (down below in right-click menu in projects folder)
    • Navigate to Hook Scripts
    • Press [Add..] to configure the new script
    • "Enable" checkbox should be set
    • "Hook type" should be "Start Commit Hook"
    • "Run for this repository" checkbox should be set
    • "Commandline to execute" should be "bat\update_revision_precommit.bat"
    • "Wait for the script to finish" checkbox should be set
    • "Hide the script while running" checkbox should be set
    • Confirm and apply the changes. Close the form
    • When doing a commit for the first time now you will be asked to confirm the script run. Set the checkbox to not get asked about it again and "Run" 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
⚠️ **GitHub.com Fallback** ⚠️