This document outlines the directory structure of the unpacked RFA files from
BF 1942, files found in them, and the properties used in the various .con and
.inc scripting files. A few relevant MDT programs and their results are presented
along the way.
To understand how to modify the game, you need to examine the .con and .inc
files that have been made by DICE and others. Step one is to unpack the relevant
RFA files in the area C:\Program Files\EA GAMES\Battlefield 1942\Mods.
This is where the original game and expansion pack files are stored, along
with any other total conversion mods such as Desert Combat or Eve of Destruction.
In each subdirectory, such as bf1942, is the Archives directory,
where all *.rfa files are stored. Each RFA file is a collection of data files
for the game, something like a ZIP file.
Here are what the various RFA files in the Archives directory contain:
Ai.rfa - Artificial Intelligence ('bot) related .con files.
AiMeshes.rfa - .rs and .sm object files.
Animations.rfa - .ske, .skn, .baf files for all the animations.
Font.rfa - Font files.
bf1942\Game.rfa - Global information about how the game plays, what damages
what, etc.
bf1942\levels\Level.rfa - The various levels (battles) in the game:
Berlin.rfa, Guadalcanal.rfa, etc.
Menu.rfa - GUI elements for the menus and HUD displays.
Objects.rfa - Defines the different types of objects used in the game.
Shaders.rfa - Special effects shader .vso and .pso files.
Sound.rfa - The .wav files for all the sounds in the game.
StandardMesh.rfa - .rs and .sm mesh files for vehicles, buildings, etc.
Texture.rfa - .dds textures for vehicles, buildings, etc (not terrain,
that's in Level.rfa).
TreeMesh.rfa - .tm tree meshes and .dds textures for billboards of trees
(for far away).
There are a number of additional RFAs with a "_00#.rfa" suffix that are updates
of these original files, bringing in newer
versions. For example, in the bf1942\Archives\bf1942\levels directory,
where the original battles are stored, in addition to the file Berlin.rfa are
the update files Berlin_001.rfa and berlin_003.rfa. You can, in
fact, use this mechanism to make mini-mods of the program; you simply create
your own update RFA file with the files you want to change and put it in the
proper directory. However, such updates will work only in single-player games,
as anti-cheat checking in multiplayer will rightfully flag such additions as
non-standard. Still, this mechanism can be useful for testing small additions
without having to repack the entire RFA file.
To unpack an RFA, use the MDT's winRFA.exe program, at C:\Program Files\EA
GAMES\Battlefield 1942\Mod Development Toolkit\Tools\RFA Tools\winRFA.exe and
open up the .rfa file you wish to extract. If you wish to unpack many RFAs,
you might prefer using \Mod Development Toolkit\Tools\RFA Tools\Console\rfaUnpack.exe program,
which runs from the command line. If you want to unpack all the RFAs in the
basic BF1942 game and its two expansion packs, use the unpack_all.bat file
in the CON
Analysis program package. This file simply runs rfaUnpack.exe,
which it assumes is in the directory c:\bin\, and puts the files in
the directory c:\temp\bf1942extract. Edit this file and replace these
paths with whatever you need.
A listing of all files found in the original game and the two expansion packs'
RFA is available in the bf1942files.txt file in the Battlefield
Reports archive.
File types in RFA files
Most files inside an RFA file have a suffix such as .con or .dds to identify
them. What follows is a brief overview of the various file types, ordered by
their suffix.
.con - Text files which define object properties. Edit with a text
editor.
.baf - Animation file.
.dif - Font file.
.dds - DXTC compressed image/texture files. You can read DDS files
with the free Irfanview viewer, use
the Photoshop
plugin, or get decompression code at NVIDIA's
website.
.inc - Simply another type of .con file. The most important one
is CommonSoldierData.inc, which defines soldier information.
.lsb - LightScape Technologies binary file. Sets up the real-time
shadows cast on players/vehicles while running around a map.
.pal - Color palette file for 256 color image files. Objectlightmaps/Palette.pal determines
the color of the indexed color .tga lightmaps for buildings. Readable by
Paint Shop Pro, and Photoshop (in indexed color mode).
.pso - Pixel shader. Only occurrence: shaders\Tree\Billboard.pso
.raw - There are different types of this kind of file:
heightmap - 16 bit heightmap terrain image file, for the height of
the terrain. Edit with Photoshop or other image editor.
materialMap - 8 bit image file, for painting material (damage types
and materialtypes) numbers to terrain. Edit with Photoshop or other
image editor.
AI pathfinding - 1 bit compressed and segmented image file that is
used in determining where AI bots can go.
.rcm - Environment map text file; specifies 6 textures of cube map.
Used in level/textures; found in Level.rfa.
.rs - Associated with the .sm standard mesh file. Contains details
what textures to use for different parts of the mesh and how they should
be rendered (e.g. transparency and lighting).
.sfk - SoundForge peak file.
.ske - Skeleton animation file.
.skn - Skin file.
.sm - StandardMesh file, containing vehicle mesh, and collision
and shadow meshes.
.ssc - Sound script file, a text file. The SSC_Editor.exe program
in the Tools directory of the MDT is useful for editing these.
.tga - Targa image/texture files. Very common image format, read/write
with the free IrfanView or most any
image viewer or editor.
.tm - Tree mesh file.
.vso - Vertex shader for Shaders.rfa.
.wav - Microsoft sound file, pointed to by .ssc files.
(none) - "Meme" menu files for Menu.rfa.
RFA CON File Structures
Including the contents of the two expansion packs, there are well over 4000 .con
(and 7 .inc) files in the game Battlefield 1942. These text files are what define
the various objects, victory conditions,
battlefields, and much else in the game.
There are many facets of making a mod, such as creating new maps, new skins
and skeletons for new objects, new sounds, or other new content for menus,
etc. A key element is editing the .con files so that the game uses these new
elements. As such, we will give a brief overview of the directory structure
of the three major RFA file types containing .con files: Objects.rfa, Game.rfa,
and the battle level .rfa files. We'll then give an overview of the types and
contents of .con files.
Objects.rfa
This file defines the various objects (soldiers, vehicles, weapons, buildings,
etc) and their behaviors. Directories are in bold, a directory's typical file
contents is listed on the same line:
Buildings - different building types, some by locale
(for Air and Sea) Common: Geometries.con, Sea only:
Objects.con, Weapons.con
AichiVal, Defgun, Enterprise, etc.: Geometries.con,
Network.con, Objects.con, Physics.con, Weapons.con (sometimes
not all of these)
(some have) Ai: Objects.con
Sounds: various .ssc files
(Sea vehicles only) High, Low, Mid:
various .ssc files
Level.rfa
These are in the Bf1942\levels subdirectory of the game, and define the
battles themselves, e.g. Battle_of_the_Bulge.rfa. There are often more
than one RFA file with similar names, e.g. Battleaxe.rfa, Battleaxe_000.rfa, Battleaxe_002.rfa.
The "_00*.rfa" files are later additions, i.e. they include new files which replace
the older files in the main Battleaxe.rfa file. Here is the directory
structure for a typical level (El_Alamein, in this case). Directories are shown
in bold:
common: AmericanNames.con, BritishNames.con, FrenchNames.con, GermanNames.con,
ItalianNames.con, JapaneseNames.con, Russiannames.con - names for the AI
bots.
damage_system: aa_guns.con, airplanes.con, AT.con, bar.con, etc.
- damage factors for weapons shooting at various types of armor.
Init: Menu.con - miscellaneous global values like cross-hair size,
chat colors, etc.
CON File Types
Of the over 4000 .con files in the game, these have 248 different names. Many
of the different names can be grouped together into similar types of .con files,
e.g. there are many different damage files in Bf1942/Game/damage_system.
Also, many .con files have the same name, e.g. Objects.con (1065 of these),
but with different purposes depending on their location in the directory tree.
That said, there are a few different broad categories these files fall into:
object definition, level (battle) creation, artificial intelligence (bot) actions,
and user settable. What follows is an overview of some of the most important
files relevant to each category.
Object Related - for defining types of objects, e.g. a type of tank,
vs. placing a specific tank in a battle.
Objects.con - defines the properties of an object (vehicle, weapon, building,
flag, soldier, etc.).
Weapons.con - a vehicle's weapon, linked to by a Objects.con file.
Geometries.con - defines geometry, and linked to by a Objects.con file.
Physics.con - sets the physics of airplanes and ships.
Network.con - for every object that moves or is controlled, one of these
is needed for multiplayer to work. Linked to by a Objects.con file.
CommonSoldierData.inc - data about the soldier.
Effects.con - for setting up effects when objects interact (e.g. ricochets).
Level Creation Related - having to do with how battles work. Some are
specific to a level, others are files that affect all battles.
Init.con - defines global settings for a level (a battle).
Conquest.con - defines how the game plays; description includes Coop, CTF,
ObjectiveMode, SinglePlayer, and TDM.
ControlPointTemplates.con - specifies information about each control point
itself (e.g. radius, flag).
ControlPoints.con - sets the locations of the control point flags.
ObjectSpawnTemplates.con - sets the respawn times for various spawn point
types for vehicles.
ObjectSpawns.con - sets where the various vehicles and weapons appear.
SoldierSpawnTemplates.con - sets characteristics for various types of soldier
spawn points.
SoldierSpawns.con - sets where the various types of soldier spawn points
are located.
SpawnPointManagerSettings.con - defines the actual spawn point indicators
that appear on the map (the icons you select to choose your spawn location).
Terrain.con - set world size, texture path, water height, and some rendering
information.
Artificial Intelligence Related - these determine the behavior of the
bots.
Ai.con - global info the the AI 'bot system.
AIbehaviours.con - bot behavior.
AiDefault.con - basic global AI settings.
AIpathfinding.con - info having to do with AI 'bots finding their way to
flags, etc.
Conditions.con - for the AI 'bots, for setting when they have enough to
attack.
StrategicAreas.con - sets strategic areas for the AI 'bots to attack and
defend.
Strategies.con - coordinates goals and aggressiveness of AI 'bots.
Bots.con, Skirmish.con - pulls in the AI bots' names for singleplayer.
InitPositions.con - the initial positions and classes of the AI Bots.
ScoreManagerSettings.con, ScoreManagerSettingsTDM.con, and ScoreManagerSettingsCTF.con
- how much AI cares about attack, etc.
User Settable - these are files not in an RFA file, and are settable
by the player. Many are profile files for joystick control, etc. One worth
mentioning is:
AliasedCommands.con - defines shortcuts for console commands.
CON File Contents
Most .con (and .inc) files consist mainly of settings
for class properties, e.g.
In this example, the class ObjectTemplate has a number of properties,
set one after the other. Note that capitalization is unimportant; "objecttemplate.cullradiusscale" is
the same as "ObjectTemplate.CullRadiusScale" as far as the program is concerned.
In most cases physical values are in MKS
(meters/kilograms/seconds) units.
These files can all be edited by a simple text editor.
Every .con file consists of class property definitions and keywords. These
keywords are used for various purposes.
Alias - defines a shortcut for a longer console command. BeginRem - begins a comment, like the C language's "/*". Echo - used in addbot.con addunspawnedbot.con aidefault.con soldier2.con
spawnbot.con spawnsoldier.con EndRem - ends a comment, like the C language's "*/". If/Else/Endif - this is commonly used in "if v_arg1 == host", which
checks if the computer is hosting the game or is joining the game. Include - a way to include an .inc file, essentially like the C language's "#include". Rem - a comment line, like the C++ language's "//". Run - a way to include a .con file, essentially, like the C++ language's "#include". Var - variables, used in the AI system for assigning attributes to a
bot.
CON Analysis Program
There are over 1000 class properties that can be set. This document is an overview
of the overall structure of the file system, so we will not detail each of these
here. Other documents deal with what the various classes and properties do. One
of the best ways to create a new object is to start with a similar existing object
and modify it. Even if undocumented, many of the properties can be determined
by examination and experimentation.
I have made a tool that will give you some sense of what a .con file property
is about, if you cannot find any relevant documentation about it. The results
of running this analysis on all the standard BF942 files and the two expansion
packs is available in the bf1942conreport.txt file in the Battlefield
Reports archive.
The perl script conanalysis.pl script in the CON
Analysis program package runs through all the .con and .inc files in
a directory and its subdirectories and analyzes the keywords and properties
found in each.
A ".pl" file is a Perl script, a text file that is run as a program when running
Perl. Perl is a nice language for various system and analysis tasks, as the
Perl language is ideal for performing system calls and text manipulation. In
Perl you simply write programs in a text editor and immediately run them from
a command line; there's no compile text or intermediate files to worry about.
To use Perl, you first need to install a Perl distribution, if you do not have
one. ActiveState's
Perl distribution is free and high-quality.
To run the conanalysis.pl script, you need to do a few things:
Extract the conanalysis.pl file from conanalysis.zip to
some directory, say C:\perlprogs.
Open up a command prompt window. Click "Start | Run..." and type "cmd.exe".
In the command window go to the topmost directory where the RFA files have
been unpacked. The program will examine all .con and .inc files found in
this directory and all subdirectories.
You're now ready to run the perl
script. To analyze a set of files, type:
The file myconreport.txt contains the analysis. Note that this analysis
can be done on any modification of the game, not just basic BF 1942 files. Doing
this can be useful for getting a sense of what the designers did to their various
weapons, etc.
which will then analyze only these particular .con files.
Analysis Output
The output from this program is in three parts. In the first part, all of the
values used for each property are shown in alphabetical order, by class. For
example:
The "1:" means that the first argument for this property, the "2:" means the
second argument, etc. So for setSpeedDev the first argument ranges from
0.6 to 2.3, the second argument from 0.2 to 0.5, etc. The "x/y/z" notation means
that the argument has a wide range of 3 values, separated by "/".
In the second section of the analysis, the names of files where each property
is found are listed, e.g.:
So fireOnce is found in both Objects.con and Weapons.con files.
The values in parentheses are the subdirectories (up to two levels deep) in which
these files can be found. For example, fireingForce is actually found
in 25 different .con files, but these
files are all somewhere in or below the objects/Vehicles directory.
Finally, each different con file is listed, alphabetically, along with what
properties are found inside it. Each property is categorized as always being
present in the .con file named (and so is likely to be required), or is optional.
Here is an example:
File ai.con (31 occurrences)
Required tokens for file
------------------------
Used once and only once in each file:
ai.init
ai.saiEnable
ai.saiMapXDimension
ai.saiMapYDimension
aiSettings.setWorldMapSize
Always used multiple times in each file:
if
Optional tokens for file
------------------------
Sometimes used once in each file:
ai.addSAIStrategy
ai.botStatisticUpdateSpeed
ai.showBotStats
...
This concludes the overview, and I hope it's been useful. One last thing: a handy
tool to use to search through .con files is Microsoft's Visual C++ 6.0
IDE. Using "Find in Files..." is an excellent quick way to find properties in
the .con files and see how they are used.