Discovery Gaming Community
Understanding and Adding Infocards - Printable Version

+- Discovery Gaming Community (https://discoverygc.com/forums)
+-- Forum: Discovery Development (https://discoverygc.com/forums/forumdisplay.php?fid=7)
+--- Forum: Discovery Developers Forum (https://discoverygc.com/forums/forumdisplay.php?fid=183)
+---- Forum: Freelancer Modding Tutorials (https://discoverygc.com/forums/forumdisplay.php?fid=36)
+---- Thread: Understanding and Adding Infocards (/showthread.php?tid=204141)



Understanding and Adding Infocards - jammi - 07-25-2024

This is a brief guide on how to use FL-IE and update infocards in Freelancer.

1. Using Freelancer Infocard Importer/Exporter.
2. Understanding infocards and XML.
3. Implementing base and object infocards.
4. Implementing rumours on bases.


1. Using Freelancer Infocard Importer/Exporter.

First of all, you're going to need a copy of Freelancer Infocard Importer/Exporter. This can be used as both a viewer to search for particular keywords across game infocards, and also as
[Image: yeshixZ.png]
a tool for implementing or editing infocards.

NOTE: DO NOT MAKE CHANGES TO THE COPY OF THE GAME YOU CONNECT TO THE SERVER WITH. The file changes will be flagged by the anticheat and you'll cop a ban. Use a duplicate test build for any experimenting you want to do.

First close any copies of Freelancer you have running, then open FL-IE. Every time you open FL-IE, you must load the infocards you want to use. To do this, copy and paste the file path to Freelancer's root directory into the "Freelancer path" box. Once this is done, click "Load".

After this, FL-IE should provide a list of all the DLLs it has successfully loaded (or not), and how many infocards it has loaded. If any errors are reported and a DLL hasn't been loaded, this is likely because you have a copy of the game running, which is basically "locking" those files.

FL-IE will remember the last file path you used, so you won't need to manually re-enter the Freelancer directory each time you use it.

The next step will depend on whether you are an official Discovery developer, or simply working on your own project.
  1. Disco Devs: Look in the SERVICE folder of your copy of the development branch mod, there will be a file inside called infocards.txt -
    [Image: OE7tCJN.png]
    this is the input and output file FL-IE uses.
  2. Everyone else: Hit the "Export" button after you've loaded your infocards. Select an appropriate location and then name the output whatever you want - infocards.txt works fine though. This will take all of the encrypted infocards from the game DLLs and output them as plaintext you can read (and edit!).
Once you have your exported .txt file, you can make any necessary changes to it (see next section) and get ready to implement it into the game.

To do this, hit the "Import" button, and then select the .txt file you've been working on. FL-IE will present a before-and-after of all the infocards you have added or updated, and provide a confirmation of the number of unchanged, changed and entirely new infocards imported.

If this looks right, hit "Save". FL-IE will again provide a log of all of the DLLs it is updating, with a confirmation of "Done" when it is finished. Again, if there are any errors during this process, it is usually because an instance of the game is running. Congratulations, your revised text is now saved to the game! We'll cover how you make this text appear where you want it later on.

Finally, a basic but extremely useful feature can be found by clicking the Browse tab. This is the infocard viewer, allowing you to search all of the game's infocards using keywords. When you select an infocard, the top window on the right displays the raw text / XML, while the bottom window on the right displays the formatted end result.

2. Understanding infocards and XML.

An infocard is basically a section of text that is linked to a unique serial number, called an IDS reference. This number is then use by the game to decide what text is presented where.

There are two categories of infocard:
  • NAME: This type is used for object or NPC names, news articles and certain other kinds of text such as missions, rep bribes and infobribes. NAME cards do not use XML, and therefore cannot be formatted, other than adding line breaks.
  • INFOCARD: This type is used for rumours and base, ship or equipment descriptions. INFOCARDs must be properly formatted in valid XML. XML is a bit like HTML or BBcode (ish), in the way that it applies formatting to text through an opening and closing set of tags.
Disco Devs: Team members who need to regularly add infocards are assigned ranges of empty IDS numbers. This ensures we're not accidentally adding infocards using the same IDS ref, as these numbers must be unique. If you haven't been assigned a range yet, raise it in the Infocard or Story channels.

FL-IE reads infocards in a very simple way. Here is an example of both a NAME and INFOCARD for reference:

Code:
33939
NAME
Hellblazer-1

33940
INFOCARD
<?xml version="1.0" encoding="UTF-16"?><RDL><PUSH/><TEXT>The Hellblazers are a Molly support squadron from Mull. Due to the nature of their projects, they are forced to work in exclusion zones outside Molly installations. They have recently been assigned to Arranmore Base to assist with preparing defenses against an anticipated Bretonian invasion.</TEXT><PARA/><POP/></RDL>

Every infocard starts with its unique IDS reference number, then either NAME or INFOCARD, and finally the text itself. Infocard text must all be written on a single line - line breaks in-game are added through text formatting. Including an actual line break in this .txt file will ruin the output when you try to display the infocard in-game.

Formatting NAME text:
NAME text is very simple, being displayed as plaintext. This means you cannot format them with colours, italics, bold, etc. The only formatting that NAME cards can use is linebreaks, which are added by including \n in the text.

Formatting INFOCARD text:
All infocards must be written in valid XML. Some important tips to remember:
  • Borrow XML from other infocards that you know work. If you are creating rumours, using the formatting of an existing rumour is both safe and saves time.
  • Check your XML is valid and displays correctly. This can be done through tools such as the XML Validator, or importing your infocards using FL-IE and looking at them in the browser.
  • Don't forget to verify that your infocards work as intended in-game. The validator is extremely useful but not perfect.
There are some basic XML sections that you will be frequently using. These include:
  • Start [mandatory]: <?xml version="1.0" encoding="UTF-16"?><RDL><PUSH/><TEXT>
  • Line break (single): </TEXT><PARA/><TEXT>
  • Line break (double): </TEXT><PARA/><PARA/><TEXT>
  • End [mandatory]: </TEXT><PARA/><POP/></RDL>
  • % symbol: %%
  • & symbol: &amp;
  • > symbol: &gt;
  • < symbol: &lt;
Bolding, colours and italics are an enormous pain to apply, so I won't be covering them in this basic guide. If you do want to make use of them, I would recommend finding an existing example and examining the XML they use.

3. Implementing Base and Object Infocards.

Now we're going to look at how to assign text to an object in the actual game world. Where you have imported an edited infocards.txt using FL-IE, this means those infocards are now saved to the game's DLLs and associated with a unique IDS reference.

This guide will be focusing on how to update the infocard of an existing base or object, rather than how to create new entities from scratch. This is also going to focus on how to use the game's .ini files, rather than system modding tools like Freelancer Mod Studio, although that may be covered in a later tutorial on system modding.

Each system in the game has its own .ini file containing all of the bases, objects, zones, NPC encounters, etc inside that system. First, I would suggest opening up DarkStat. This is an incredibly powerful reference tool for all sorts of data in the game, however what we're mainly interested in right now are internal nicknames.

Every system and entity within a system has a unique internal nickname. Looking on DarkStat's Bases tab, find a station you are interested in. You will notice that on the right, there is a column for base nickname, and system nickname. For now, lets look at Waterloo Station in New London. This is br01_04_base, with New London itself being br01.

Next, in your experimental Freelancer build's main directory, navigate to: DATA\UNIVERSE\SYSTEMS

In the SYSTEMS folder, every system in the game has its own subfolder. Open the Br01 folder, then Br01.ini - this is New London's system file. Once it's open, hit CTRL+F and enter br01_04_base. This will give you the following entry:

Code:
[Object]
nickname = Br01_04
ids_name = 196661
pos = -18311.5, 0, 57186
rotate = -180, 85.7, 180
archetype = largestation1
ids_info = 65727
base = Br01_04_Base
dock_with = Br01_04_Base
reputation = co_ic_grp
behavior = NOTHING
voice = atc_leg_f01
space_costume = br_karina_head_gen, br_karina_body
difficulty_level = 7
loadout = space_station_co_01
pilot = pilot_solar_easiest

The parts that are currently of interest to us are IDS_name and IDS_info.

As you might expect, IDS_Name is the object's name. Use CTRL+F in your infocards.txt and look up 196661 - you will see that this says "Waterloo Station". Overwriting the infocards.txt entry for this IDS reference, importing it into FL-IE and then saving will change the name of the station in-game.

If you want to replace the IDS_name of a dockable base with a new number for some reason (or you are creating a new base), you must also edit another file.

Open: DATA\UNIVERSE\universe.ini

This file keeps track of which system dockable bases are located in, and makes their names appear properly in your contacts window. Having bases in the wrong system causes crashes, but for now all we're interested in is making sure the name is correct. Look up Waterloo's internal nickname again, and you will find the following entry:

Code:
[Base]
nickname = br01_04_base
system = br01
strid_name = 196661
file = universe\systems\br01\bases\br01_04_base.ini
BGCS_base_run_by = W02bF23

All we need to do here is make sure the strid_name matches the IDS_name assigned in the system file. If you're changing the number, make sure to change it in both places.

Next, the IDS_info value works slightly differently depending on whether the object is a dockable base or not. For dockable stations, the IDS_info data is the text that you can see using F9 before you dock with the base. Waterloo is a typical example, providing fluff information about the station class, amenities, crew, etc.

Code:
<?xml version="1.0" encoding="UTF-16"?><RDL><PUSH/><TEXT>CLASS: Zeus</TEXT><PARA/><TEXT>GRAVITY: Complete</TEXT><PARA/><TEXT>DOCKING: Yes</TEXT><PARA/><TEXT>AMENITIES: Yes</TEXT><PARA/><TEXT>CREW: 1090</TEXT><PARA/><POP/></RDL>

CLASS: Zeus
GRAVITY: Complete
DOCKING: Yes
AMENITIES: Yes
CREW: 1090

The rest of the infocard is hidden until you dock. Interestingly, you'll notice that there is no third infocard parameter in Waterloo's Object entry in the system file. So how does the game know where to find the rest of the base description?

For this, we need to look in another file: DATA\INTERFACE\InfocardMap.ini

InfocardMap creates linked pairs of infocards for dockable stations. If you use CTRL+F and search for 65727 (Waterloo's IDS_info value), you will find this:

Map = 65727, 65728

This is telling the game that when you dock on the object associated with IDS 65727, it must append IDS 65728 to the end of the station's description. If you are editing an existing station's infocard, you don't need to worry too much about this. If you are adding a brand-new station or changing a station's IDS_info number, you will need to add an InfocardMap entry too.

Objects that aren't dockable stations are much more straightforward - the full infocard is simply included under a single reference in IDS_info. Note that some kinds of Objects are not able to display infocards.

This depends on the Object's Archetype (Waterloo's is largestation1), which is defined in DATA\SOLAR\SolarArch.ini - this is really a system modding issue, so it will be covered in more detail in a later tutorial.

An extreme simplification is that only Archetypes with the Type of either MISSION_SATELLITE or STATION can have both IDS_names and IDS_infocards freely assigned. Other types either cannot display infocards at all, or make use of specific hardcoded infocards for their name, infocard or both.

4. Implementing Rumours on bases.