PROFEX stands for Profile Externalization, a system that translates character profile data into an editable XML format. This allows circumventing some of the restrictions imposed by the PROEDIT program interface.
JA2 Wildfire came packaged with the original game's source code, and also included some important tools such as PROEDIT - a program that allows editing character profiles. For years it has allowed us to edit attributes, character traits, and many other details about every named character in the game.
PROEDIT reads and writes a file called PROF.DAT. This file contains all character data in binary format. When a new campaign is started, this data is loaded into memory and serves as the basis for merc growth and character behavior.
Unfortunately, while JA2 1.13 grew better and more complex over the years, our only way of changing character details was through PROEDIT which has never been updated. It is impossible to edit PROF.DAT by hand (ok, you can do it with a hex editor, but what a mess!), so even if systems were developed for more freedom with characters, we were always limited to what PROEDIT could and could not do.
The need for externalized profiles Edit
Externalizing PROF.DAT has been a hot topic for several years. Several attempts were made, and one attempt reportedly even went very far before someone's hard-drive crashed and the project crashed with it. The discussion, of course, never died, because the limits of PROEDIT are still a problem.
New Inventory externalization Edit
Probably the first step towards making PROEDIT obsolete came during the creation of the New Inventory system. We needed a way to have characters come pre-equipped with load-bearing equipment to avoid the game crashing. However, PROEDIT (which was designed for JA2 Unfinished Business) could not cope with the high item numbers required (you could only equip characters with items of index numbers 0 to 320 or so... Load-bearing items had numbers near 1000).
To avoid complicating things in the future, ChrisL decided to write a new system that reads XML data for what mercs were carrying by default, circumventing PROF.DAT in that respect. So now, if you want to change your merc's starting gear, you can open MercStartingGear.XML in notepad and add whatever items you want.
This demonstrated a way in which players could still use PROEDIT to change character data, but had a second system at their disposal to override one of PROEDIT's functions with an easy-to-use XML.
PROFEX Alpha Edit
A year later, I decided to use the same technique to externalize everything else that PROEDIT had to offer. Thus, PROFEX was born.
What can PROFEX do? Edit
PROFEX allows editing most of a character's data by hand. This includes attributes, traits, facial coordinates, how tolerant the character is with the player, bodytype and clothes, and pretty much everything else that PROEDIT has to offer.
What can PROFEX do that PROEDIT can't? Edit
The uses of PROFEX are limited, as it is still a very young system. However, by now it already allows you to set unconventional values, where PROEDIT's user interface limited you to whatever values were deemed "acceptable" by the system. Granted - the game doesn't really support values outside of PROEDIT's hardcoded limits, but I expect that now that those limits are broken, coders may take advantage of this when they go off improving and enhancing some in-game features.
PROFEX does allow two things that PROEDIT simply could not do:
- Switch character portraits at will. Using a single value, you can decide which character gets which face. The screenshot seen on this article shows two characters having Barry Unger's face - this was done by changing a single number. Again, the uses for this are limited at the moment, but they may give modders a much easier time when altering the character list in the future.
- Edit merc opinions of each other. This is perhaps PROFEX's strongest point. Opinions influence the way that characters work together, mostly be affecting their morale and their performance when training each other. This was NOT editable in PROEDIT (you could only see the values, but not change them). PROFEX has a completely separate XML that contains all opinions and can be edited by hand.
What can PROEDIT do that PROFEX can't? Edit
As of the time of writing, PROFEX can be used instead of PROEDIT without losing any functionality. All values that are relevant to the game can be changed in PROFEX, so PROEDIT really isn't necessary anymore unless you find it difficult to work with XMLs.
However, PROEDIT did give us the ability to edit some attributes like "Hated nationality" and "Sexism", which while sounding really cool actually have no effect in the game whatsoever. Therefore, these values were not included in PROFEX because it's pointless to change them.
In the future, if these values were ever hooked up and became useable, it would be very simple for coders to include those values in the PROFEX XML files. Until then, they'll remain excluded.
But I liked PROEDIT! It was simple to use! Edit
The best part about PROFEX is that it is an optional system. You can tell the program whether you want it to read from PROF.DAT or from the XML by changing an INI setting.
Additionally, PROFEX has the ability to convert PROF.DAT into XML format whenever you wish, so you can edit your characters in PROEDIT with comfort, then convert to XML, and continue editing in notepad. Unfortunately, the opposite is not possible (converting XML into PROF.DAT).
In the future Edit
At the moment I have only vague plans to improve PROFEX, as the values that have not yet been externalized are somewhat obscure, mostly related to NPCs. Of course, now that PROFEX code is available, future coders could take advantage of the system to make characters even more moddable than before. Imagination is the only limit now, rather than a clunky 8-year-old interface.
INI Settings Edit
PROFEX has two INI settings in JA2_Options.INI.
|Effect||Decides whether character profile data is read from XML or from PROF.DAT.|
|JA2 Default Setting||FALSE||Profile data is read from PROF.DAT. Use PROEDIT to change character details.|
|HAM Recommended Setting||TRUE||
Profile data is read from MercProfiles.XML, and mercs' opinions about each other are read from MercOpinions.XML. The data in PROF.DAT becomes irrelevant. You can edit these XMLs by hand, in notepad.
Profile data is only read when starting a new campaign. After that, data is written/read directly from your savegames. If you want to switch between PROF.DAT and the XMLs, please do so before starting a new game.
|Effect||Decides whether character profile data is written to XML when the game is started.|
|JA2 Default Setting||FALSE||No effect.|
|HAM Recommended Setting||TRUE||
When the game is run, right after the SIRTECH logo, the program will write all profile data into XML files.
This will create two files in \Data\TableData directory: MercProfiles out.XML, and MercOpinions out.XML.
You can use this to convert PROF.DAT into XML format.
The only real reason to do this is to convert from Binary PROF.DAT data into XML format. For instance, if you want to use PROEDIT but also want to tweak some values by hand.
When you do this, make sure that READ_PROFILE_DATA_FROM_XML is set to FALSE! Otherwise, you'll be reading from XML and writing to XML, achieving nothing.