Mission Database: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Written Update Mission section.
Some updates for unpacked missions
 
(13 intermediate revisions by 4 users not shown)
Line 10: Line 10:
#* using names from the original Thief games
#* using names from the original Thief games
#* using assets from other games
#* using assets from other games
#* having content which is so bad that it is forbidden even on our forums (TODO: link to forum rules?)
#* having content which is so bad that it is forbidden even on our forums ([https://forums.thedarkmod.com/index.php?/topic/16117-forum-rules/ link to forum rules])


A very few missions are installed along with the game, like Saint Lucia or Training Mission.
A very few missions are installed along with the game, like Saint Lucia or Training Mission.
These official missions are considered to be part of the game, and are '''not''' included in the database.
These official missions are considered to be part of the game, and are '''not''' included in the database.


= SVN =
= SVN =
Line 22: Line 21:


Here is the SVN address:
Here is the SVN address:
:: https://svn.thedarkmod.com/project/missions/trunk
:: https://svn.thedarkmod.com/project/missions_unpacked/trunk/


'''But please don't rush to checkout the whole repo yet!'''
'''But please don't rush to checkout the whole repo yet!'''
Line 28: Line 27:
=== Checkout everything ===
=== Checkout everything ===


Yes, you can simply copy the link above to SVN Checkout and get single working copy with all the FMs. But keep in mind that you will have to download ~10 GB of data and the working copy will take ~20 GB of space. In most cases you don't need everything in order to work with the database.
Yes, you can simply copy the link above to SVN Checkout and get single working copy with all the FMs. But keep in mind that you will have to download ~35 GB of data and the working copy will take ~70 GB of space. In most cases you don't need everything in order to work with the database.


The typical reasons to checkout the whole repo are:
The typical reasons to checkout the whole repo are:
Line 49: Line 48:
You can checkout only this directory in order to work with FM, just put this checkout address:
You can checkout only this directory in order to work with FM, just put this checkout address:


:: https://svn.thedarkmod.com/project/missions/trunk/fms/qwerty
:: https://svn.thedarkmod.com/project/missions_unpacked/trunk/fms/qwerty


Or find the FM directory in Repo-browser, right-click and select Checkout.
Or find the FM directory in Repo-browser, right-click and select Checkout.


Detailed instructions in the rest of the article assume this approach.
Detailed instructions in the rest of the article assume this approach.


= Add New Mission =
= Add New Mission =
Line 73: Line 71:
Now that the directory has been created, you can checkout it: find the directory in Repo-browser, right-click it and Checkout.
Now that the directory has been created, you can checkout it: find the directory in Repo-browser, right-click it and Checkout.


The second step is to upload pk4 files.
The second step is to upload pk4 contents.
Copy all the pk4 files of FM into the working copy directory (i.e. checkout directory).
Create subdirectory named <tt>mission-name.pk4_dir</tt> under the mission checkout directory (replace mission-name with internal name).
Open the directory in Windows Explorer, right-click and select SVN commit.
Unpack all the pk4 files of FM pack into this subdirectory of the working copy directory (i.e. checkout directory).
Select all pk4 files with Shift, right-click and select Add.
Open the directory in Windows Explorer, right-click the parent folder and select SVN commit.
Select all files with Shift, right-click and select Add.
Also set checkboxes for these files.
Also set checkboxes for these files.
Write commit message in the text area above: it should start with internal name of FM in brackets.
Write commit message in the text area above: it should start with internal name of FM in brackets.
When everything is done, hit OK to do the actual commit.
When everything is done, hit OK to do the actual commit.


While the pk4 files are already in the repository, they are not yet visible in the database.
While the pk4 contents are already in the repository, they are not yet visible in the database.
A mission is only added when its directory contains <tt>fminfo.xml</tt> file, so now you need to add it.
A mission is only added when its directory contains <tt>fminfo.xml</tt> file, so now you need to add it.
You can take this file from another FM (find it in Repo-browser, right-click, Open with, select text editor), and adjust it for the FM being added.
You can take this file from another FM (find it in Repo-browser, right-click, Open with, select text editor), and adjust it for the FM being added.
Line 96: Line 95:
* '''localisationPack''' points to _l10n.pk4 file if it exists.
* '''localisationPack''' points to _l10n.pk4 file if it exists.


Note that XML cannot directly contains some characters, thus they must be escaped:
Note that XML cannot directly contain some characters, thus they must be escaped:
* Ampersand (<tt>&amp;amp;</tt>) quotes (<tt>&amp;quot;</tt> or <tt>&amp;apos;</tt>) and angle brackets (<tt>&amp;lt;</tt> or <tt>&amp;gt;</tt>): [https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents reference]
* Ampersand (<tt>&amp;amp;</tt>) quotes (<tt>&amp;quot;</tt> or <tt>&amp;apos;</tt>) and angle brackets (<tt>&amp;lt;</tt> or <tt>&amp;gt;</tt>): [https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents reference]
* Line break symbol can be inserted as <tt>&amp;#10;</tt> according to [https://stackoverflow.com/questions/2004386/how-to-save-newlines-in-xml-attribute reference]
* Line break symbol can be inserted as <tt>&amp;#10;</tt> according to [https://stackoverflow.com/questions/2004386/how-to-save-newlines-in-xml-attribute reference]
<br>Example:
<pre>
<fminfo>
  <mission title="Closemouthed Shadows" releaseDate="2012-01-15" size="2.3" version="2" internalName="closemouthed_shadows" type="single" author="LordSavage, Bikerdude">
    <description>Find Dougal's key, enter his place and kill him. Find the golden plate and key he stole from his neighbor. Get some loot including Lord Julian's Scepter.&amp;#13;&amp;#10;&amp;#13;&amp;#10;This is the original mission from 2008 (modified to run with TDM Version 1.07). Big thanks to b1k3rdude who has helped me to bring Closemouthed Shadows to TDM 1.07 (and improved some text and visuals).</description>
    <mainPack filename="closemouthed_shadows.pk4"/>
    <localisationPack filename="closemouthed_shadows_l10n.pk4"/>
  </mission>
</fminfo>
</pre>


When you have created <tt>fminfo.xml</tt> file, double-check that all properties are correct.
When you have created <tt>fminfo.xml</tt> file, double-check that all properties are correct.
Then use SVN to add and commit the file, just like you did with pk4 file.
Then use SVN to add and commit the file, just like you did with pk4 contents.


If you did something wrong (most likely), then you will see an error saying that "Commit blocked by pre-commit hook".
If you did something wrong (most likely), then you will see an error saying that "Commit blocked by pre-commit hook".
Line 110: Line 121:
As the last step, create subdirectory named <tt>screenshots</tt> in the working copy directory.
As the last step, create subdirectory named <tt>screenshots</tt> in the working copy directory.
Put screenshots in .jpg or .png format into the directory: they will be displayed in in-game mission downloader.
Put screenshots in .jpg or .png format into the directory: they will be displayed in in-game mission downloader.
Then add and commit all the screenshot files into the repository, same way as you did for pk4 and xml files.
Then add and commit all the screenshot files into the repository.
 


= Update Mission =
= Update Mission =
Line 118: Line 128:


First of all, make sure you have up-to-date working copy of the FM directory.
First of all, make sure you have up-to-date working copy of the FM directory.
If you already have working copy, do right-click and SVN Update in it in Windows Explorer.
<br>If you already have working copy, do right-click and SVN Update in it in Windows Explorer.
If you don't have it yet, then open Repo-browser, find the directory named by FM's internal name, right-click and select Checkout.
<br>If you don't have it yet, then open Repo-browser, find the directory named by FM's internal name, right-click and select Checkout.
If you don't know the internal name, you can learn it like this: install the FM in the game, then look what is written in the <tt>currentfm.txt</tt> file.
<br>If you don't know the internal name, you can learn it like this: install the FM in the game,  
Suppose internal name is "qwerty".
<br>then look what is written in the <tt>currentfm.txt</tt> file.  
<br><br>Suppose internal name is "qwerty".
<br><br>If you know the author didn't remove any files from the new version, just extract the contents of the new PK4 to the query.pk4_dir and overwrite the contents.
<br>Then browse the sub-folders for any un-versioned new items ( usually will have a question mark indicator ) and right-click them and select SVN Add
<br>Then update the version number in the FM XML file as well as the file size
<br>Make sure no files or folders have spaces or special characters in their names
<br>Navigate to the parent directory of the querty folder and right-click querty then choose commit
<br><br>If the mission author removed files or you are unsure, you will need to compare the existing copy to the new version prior to merging
<br>For Windows users the program WinMerge is a good tool, Linux users can use "diff -r folderA, folderB"
<br>Identify additions and removals then overwrite the contents of the query.pk4_dir then perform SVN Add and SVN Delete actions to all relevant items
<br>Then update the FM XML and commit as described above
 
= RabbitVCS Steps =
 
Since TortoiseSVN does not have a Linux version, a good alternative is RabbitVCS.
<br>You will need to install the shell integration script that is compatible with your GUI File Manager
<br>If none exist you will need to install a secondary GUI File manager that is compatible with RabbitVCS integration
 
Here is a quick summary of the Mission management process on RabbitVCS
 
1) Create a parent folder such as mission-name_new


There are two ways to update the FM:
2) Inside the folder create a sub-folder named after the pk4 name ( eg if the mission name is elixir.pk4 the folder is "elixir" )
# Minor update changes one or several lines in some file, e.g. in .map file or in .gui file. Such update is usually done when TDM engine is changed, FM gets broken, and merely a small spawnarg change is enough to return proper behavior. Usually such changes are done by TDM developers with approval of FM authors.
# Major update covers everything else. It happens when FM author sends a new version of pk4 file, with arbitrary changes in .map file, and probably some other changes.


When doing minor update, prefer editing existing pk4 archive instead of creating a new one from scratch.
3) Insider the sub-folder will be 3 things:
For instance, you can open the archive in 7-zip, extract only one file which you want to modify, change it in text editor, then add it back to the archive in 7-zip (overwriting the old version).
It is a '''bad''' idea to extract everything, do some changes, then create a brand new pk4 archive.


Regardless of how major the update is, keep in mind SVN storage specifics to avoid rapid growth of server storage requirements.
An fminfo.xml with details about the mission ( see attached example)
Unless full size of FM package is smaller than 100 MB, please run the diff optimization tool.
The tool is located in <tt>devel\pk4diff\bin</tt> in the assets SVN repo.
With Python 3 installed, copy its files to the FM directory and run there:


  python pk4diff.py --optimize qwerty.pk4
A folder named "screenshots"


The tool will check how much data is really changed inside the archive.
A folder named mission-name.pk4_dir which contains the unpacked data from the mission pack ( eg elixir.pk4_dir )
If the changes account for less than 10% of the full package size, then the tool will repack it to ensure that this update takes only a very little additional space on server.
See more details in [[#Storage Concerns]] section.


Now you need to edit <tt>fminfo.xml</tt> file:
4) Right click on the parent folder and perform an SVN "Import" and choose https://svn.thedarkmod.com/project/missions_unpacked/trunk/fms/  as the Repository where you are importing
# Increment the integer in "version" property by one. Otherwise in-game downloader won't know that the mission has been updated.
# Probably update "size" property if it has changed significantly.


After you have dealt both with pk4 storage concerns and with XML file update, it's time to commit the changes.
5) Visit the mission URL after the import has completed https://www.thedarkmod.com/missiondetails/?internalName=<mission-name> ( replace mission-name with whatever the pk4 name )
Open working copy directory in Windows Explorer, right-click and select SVN Commit.
You should see at least two files marked as modified with checkboxes set: <tt>qwerty.pk4</tt> and <tt>fminfo.xml</tt>.
Write commit message which describes the changes. Start commit message with FM internal name in brackets.
If the new version came from the author, write something like "New version: sent to me by XyMegaMapper yesterday".
If the update did not come from FM author, then all the changes must be described in full detail!
In case of minor update, it can be something like "In guis/mainmenu_custom_defs.gui, removed MM_BRIEFING_VIDEO_MATERIAL_K defines for K > 1".
Finally, click OK to commit the changes.


To update the mission it's best to delete the folder then create a new parent folder mission-name_update then perform an SVN checkout of https://svn.thedarkmod.com/project/missions_unpacked/trunk/fms/<mission-name>


= Storage Concerns =
Use "diff -r /path/to/checkout_dir/mission-name /path/to/extracted/new_pk4_folder/mission-name" in the console to identify changes


TODO
= References =
* Thread on developer subforum: https://forums.thedarkmod.com/index.php?/topic/20624-store-missions-archive-in-svn/
* Mission Database Management thread: https://forums.thedarkmod.com/index.php?/topic/11393-mission-archive-administration

Latest revision as of 18:41, 17 July 2024

All released missions are stored in FM database, which defines what is available in mission downloader in-game.


Requirements

In order for a mission to be included in the database, it must satisfy the following conditions:

  1. It has gone through beta-testing by several forum members who did not take part in its creation.
    • As a rare exceptional case, a mission can be rejected from the database if the majority of beta-testers come to conclusion that it is unplayable or its quality is way too low.
  2. Does not contain any questionable material, potential intellectual property infridgements. Including:
    • using names from the original Thief games
    • using assets from other games
    • having content which is so bad that it is forbidden even on our forums (link to forum rules)

A very few missions are installed along with the game, like Saint Lucia or Training Mission. These official missions are considered to be part of the game, and are not included in the database.

SVN

Starting from 2021, the FM database is stored in SVN repository (#5551). Only TDM team members have access to this SVN.

Here is the SVN address:

https://svn.thedarkmod.com/project/missions_unpacked/trunk/

But please don't rush to checkout the whole repo yet!

Checkout everything

Yes, you can simply copy the link above to SVN Checkout and get single working copy with all the FMs. But keep in mind that you will have to download ~35 GB of data and the working copy will take ~70 GB of space. In most cases you don't need everything in order to work with the database.

The typical reasons to checkout the whole repo are:

  • You want to run automated search or tests over all released FMs.
  • You are regular committer of the FM database, added a lot of new missions and updates, so the investment is worth it.
TortoiseSVN Repo-browser
Accountant 2 FM in SVN

Checkout as needed

Instead of checking out the whole repo, you can checkout only the few FMs you are going to modify. This is the recommended approach.

With this approach, you need the Repo-browser feature of TortoiseSVN. It allows to look through all the directories and files on remote SVN without checking it out first.

The directory structure of SVN is show on the picture. Most importantly, all information about FM with internal name "qwerty" is stored in fms/qwerty subdirectory of the repo. You can checkout only this directory in order to work with FM, just put this checkout address:

https://svn.thedarkmod.com/project/missions_unpacked/trunk/fms/qwerty

Or find the FM directory in Repo-browser, right-click and select Checkout.

Detailed instructions in the rest of the article assume this approach.

Add New Mission

Add FM directory in Repo-browser
Checkout FM
Commit changes in FM directory
Add new files in Commit dialog
Precommit hook failed due to wrong value of "type"

Before adding new FM, negotiate internal name with FM author. It must be different from names of all existing FMs, consist of only lowercase letters and digits, be rather short (aim for 10-20 letters). Among many words in the mission title, prefer rare words and proper nouns over common words when composing the internal name.

Open SVN in Repo-browser, find fms directory which contains all the FMs. Right-click on it and choose Add folder in the context menu. Then enter the internal name of FM as the name of the new directory and proceed with commit. Now that the directory has been created, you can checkout it: find the directory in Repo-browser, right-click it and Checkout.

The second step is to upload pk4 contents. Create subdirectory named mission-name.pk4_dir under the mission checkout directory (replace mission-name with internal name). Unpack all the pk4 files of FM pack into this subdirectory of the working copy directory (i.e. checkout directory). Open the directory in Windows Explorer, right-click the parent folder and select SVN commit. Select all files with Shift, right-click and select Add. Also set checkboxes for these files. Write commit message in the text area above: it should start with internal name of FM in brackets. When everything is done, hit OK to do the actual commit.

While the pk4 contents are already in the repository, they are not yet visible in the database. A mission is only added when its directory contains fminfo.xml file, so now you need to add it. You can take this file from another FM (find it in Repo-browser, right-click, Open with, select text editor), and adjust it for the FM being added. Here is explanation for some fields:

  • internalName defines name of the directory and pk4 file.
  • title is the name seen by players in-game.
  • author is one or several people who made the mission.
  • releaseDate shows when the very first version of the mission was added.
  • type is multi if mission contains several playable .map files (i.e. is campaign), and single otherwise.
  • size is size of the main pk4 file in megabytes displayed to users.
  • version is natural number used by in-game downloader to decide whether update is available or not. Starts with 1.
  • description contains text displayed in in-game downloader when player inspects mission details.
  • mainPack points to the main pk4 file of the mission. Note that the name of file is fully determined by internal name.
  • localisationPack points to _l10n.pk4 file if it exists.

Note that XML cannot directly contain some characters, thus they must be escaped:

  • Ampersand (&amp;) quotes (&quot; or &apos;) and angle brackets (&lt; or &gt;): reference
  • Line break symbol can be inserted as &#10; according to reference


Example:


<fminfo>
  <mission title="Closemouthed Shadows" releaseDate="2012-01-15" size="2.3" version="2" internalName="closemouthed_shadows" type="single" author="LordSavage, Bikerdude">
    <description>Find Dougal's key, enter his place and kill him. Find the golden plate and key he stole from his neighbor. Get some loot including Lord Julian's Scepter.&#13;&#10;&#13;&#10;This is the original mission from 2008 (modified to run with TDM Version 1.07). Big thanks to b1k3rdude who has helped me to bring Closemouthed Shadows to TDM 1.07 (and improved some text and visuals).</description>
    <mainPack filename="closemouthed_shadows.pk4"/>
    <localisationPack filename="closemouthed_shadows_l10n.pk4"/>
  </mission>
</fminfo>

When you have created fminfo.xml file, double-check that all properties are correct. Then use SVN to add and commit the file, just like you did with pk4 contents.

If you did something wrong (most likely), then you will see an error saying that "Commit blocked by pre-commit hook". A long stacktrace from Python script is included, and the meaningful message should be at the end of it. Typically, it is either XML validation error saying that something in fminfo.xml is wrong, or a message from some custom failed check. You need to fix the errors and try to commit again --- until you manage to commit successfully.

As the last step, create subdirectory named screenshots in the working copy directory. Put screenshots in .jpg or .png format into the directory: they will be displayed in in-game mission downloader. Then add and commit all the screenshot files into the repository.

Update Mission

This section covers the case if mission has already been released, but new version should be uploaded.

First of all, make sure you have up-to-date working copy of the FM directory.
If you already have working copy, do right-click and SVN Update in it in Windows Explorer.
If you don't have it yet, then open Repo-browser, find the directory named by FM's internal name, right-click and select Checkout.
If you don't know the internal name, you can learn it like this: install the FM in the game,
then look what is written in the currentfm.txt file.

Suppose internal name is "qwerty".

If you know the author didn't remove any files from the new version, just extract the contents of the new PK4 to the query.pk4_dir and overwrite the contents.
Then browse the sub-folders for any un-versioned new items ( usually will have a question mark indicator ) and right-click them and select SVN Add
Then update the version number in the FM XML file as well as the file size
Make sure no files or folders have spaces or special characters in their names
Navigate to the parent directory of the querty folder and right-click querty then choose commit

If the mission author removed files or you are unsure, you will need to compare the existing copy to the new version prior to merging
For Windows users the program WinMerge is a good tool, Linux users can use "diff -r folderA, folderB"
Identify additions and removals then overwrite the contents of the query.pk4_dir then perform SVN Add and SVN Delete actions to all relevant items
Then update the FM XML and commit as described above

RabbitVCS Steps

Since TortoiseSVN does not have a Linux version, a good alternative is RabbitVCS.
You will need to install the shell integration script that is compatible with your GUI File Manager
If none exist you will need to install a secondary GUI File manager that is compatible with RabbitVCS integration

Here is a quick summary of the Mission management process on RabbitVCS

1) Create a parent folder such as mission-name_new

2) Inside the folder create a sub-folder named after the pk4 name ( eg if the mission name is elixir.pk4 the folder is "elixir" )

3) Insider the sub-folder will be 3 things:

An fminfo.xml with details about the mission ( see attached example)

A folder named "screenshots"

A folder named mission-name.pk4_dir which contains the unpacked data from the mission pack ( eg elixir.pk4_dir )

4) Right click on the parent folder and perform an SVN "Import" and choose https://svn.thedarkmod.com/project/missions_unpacked/trunk/fms/ as the Repository where you are importing

5) Visit the mission URL after the import has completed https://www.thedarkmod.com/missiondetails/?internalName=<mission-name> ( replace mission-name with whatever the pk4 name )

To update the mission it's best to delete the folder then create a new parent folder mission-name_update then perform an SVN checkout of https://svn.thedarkmod.com/project/missions_unpacked/trunk/fms/<mission-name>

Use "diff -r /path/to/checkout_dir/mission-name /path/to/extracted/new_pk4_folder/mission-name" in the console to identify changes

References