OVERVIEW OF THE BATTLEFIELD: 1942 GAME STRUCTURE

Updated: October 11th 2003

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
    • Africa, Common, Italy, Pacific
      • afr_house1_ste, Afrhouse, etc: Geometries.con, Objects.con
        • (occurs sometimes) Ai: Objects.con

  • Common: Geometries.con, Objects.con
    • Sounds: BazookaProjectile.ssc, other .ssc files

  • Effects
    • e_AichiValDamage, e_BarbWire, etc: Effects.con
      • (occurs sometimes) Sounds: e_BarbWire.ssc or other corresponding sound file
    • Common: Geometries.con, Objects.con, Effects.con
      • Sounds: debris.ssc, other .ssc

  • HandWeapons
    • Common: Geometries.con, Network.con, Objects.con, Weapons.con
    • Bar1918, Bazooka, etc.: Geometries.con, Objects.con
      • (for all but binoculars and riflebulletclip_m1) AI: Weapons.con
      • (for all but binoculars and riflebulletclip_m1) Sounds: bar1918.ssc, High.ssc, Low.ssc, Medium.ssc (44 KHz, 11 KHz, 22 KHz sounds)

  • Items - soldier kits (weapons), and flags
    • Common: Geometries.con, Objects.con
    • Flag: Geometries.con, Network.con, Objects.con
      • Sounds: flag.ssc, HighMed.ssc
    • BaseKit: Geometries.con, Network.con, Objects.con
      • Ai: Objects.con
    • BritKit, GerKit, GerKitDesert, JapKit, RussKit, USKit
      • AntiTank, Assault, Common, Engineer, Medic, Scout: Geometries.con, Objects.con

  • MOVE_FILES - many different static objects
    • AfriCarpet1_m1, Sandbag_I, Wreck_Corsair2_M1, etc.: Geometries.con, Objects.con
      • (some have) Ai: Objects.con

  • Soldiers - mostly
    • BritishSoldier, GermanDesertSoldier, GermanSoldier, JapaneseSoldier, RussianSoldier, USSoldier: Geometries.con, Objects.con
    • Common: CommonSoldierData.inc, Geometries.con, Network.con, Objects.con
      • Ai: Objects.con
      • Parachute: Geometries.con, Objects.con
      • Sounds: MaterialToSound.con, SoldierSound.inc, SoldierCharge.ssc, many more .ssc
        • High, Low, Medium: SoldierClimbLadder.ssc, more .ssc

  • Stationary_Weapons - machineguns
    • Common: Geometries.con, Objects.con
    • Browning, Mg42, etc: Geometries.con, Network.con, Objects.con
      • AI: Weapons.con
      • Sounds: Browning.ssc, High.ssc, Low.ssc, Medium.ssc

  • Vegetation
    • Common
      • Afri_bush7_M1, FERNBIG_M1, etc.: Geometries.con, Objects.con
      • Afri_Sandstorm: Objects.con
        • Sounds: Afri_Sandstorm.ssc, Afri_Sandstorm_HighMed.ssc
      • Palmhigh, Palmshort: Geometries.con, Objects.con
        • AI: Objects.con

  • Vehicles - despite the name, this includes all weapons you can get into (e.g. defgun, flak) except machineguns, which are above in Stationary_Weapons.
    • Common: Geometries.con, Network.con, Physics.con, Weapons.con
      • Sounds: EngineMap.ssc, Projectile.ssc, TorpedEngine[High|Low|Med].ssc
    • Air, Land, Sea
      • (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:

  • AI: Conditions.con, Prerequisites.con, StrategicAreas.con, Strategies.con
  • Conquest, Ctf, ObjectiveMode, TDM: ControlPoints.con, ControlPointTemplates.con, ObjectSpawns.con, ObjectSpawnTemplates.con, SoldierSpawns.con, SoldierSpawnTemplates.con, SpawnPointManagerSettings.con
  • GameTypes: Conquest.con, Coop.con, Ctf.con, ObjectiveMode.con, TDM.con
  • Init:
    • SkyAndSun.con - sun lens flare effects
    • Terrain.con - scale of terrain, etc.
  • Menu: Briefing.dds, Init.con, thumbnail.dds
  • ObjectLightmaps:
    • bunker1_M1_1348-45-1393.tga, etc. - the lightmap shadows to be glued onto parts of these buildings
    • Palette.pal - determines the color of the indexed color .tga lightmaps for buildings.
  • Pathfinding: Car.raw, Infantery.raw, Tank.raw - used by AI for guiding the bots on the map
  • SinglePlayer: Bots.con, ControlPoints.con, ControlPointTemplates.con, InitPositions.con, ObjectSpawns.con, ObjectSpawnTemplates.con, Skirmish.con, SoldierSpawns.con, SoldierSpawnTemplates.con, SpawnPointManagerSettings.con
  • Sounds: Environment.con, Environment.ssc, lake.con, lake.ssc
  • Textures:
    • detail.dds: a detail texture, blended with Tx0#x0#.dds to give it richness.
    • env_Elala_0[1-6].dds: cubic environment map.
    • ENVMAP_G_.rcm: text file that specifies the 6 textures (line above) making up the env map.
    • InGameMap.dds - the 512x512 image used for the overhead map and minimap.
    • TerrainPalette.pal - palette of colors for light maps (sandy for El Alamein)
    • Tx0#x0#.dds - a texture tile of the map, part of a grid of these.

Game.rfa

This contains files that contain global settings for all the battles, unpacked to the directory BF1942\Game. Subdirectories are at the end in bold.
  • AIbehaviours.con - bot behavior.
  • AiDefault.con - basic global AI settings.
  • CTF.ssc - sounds for capture the flag games (flag stolen/recovered/etc).
  • CampaignMapList.con - list of basic levels.
  • GamePlay.ssc - messages like "we've lost contact with an outpost".
  • GlobalSpawnGroups.con - spawns for ships.
  • Heartbeats.ssc - heartbeat sound script.
  • Init.con - runs other setup files, sets major and minor victory conditions.
  • MaterialManagerSettings.con - defines the damage modifier for all objects vs. each armor.
  • MaterialManagerdefine.con - defines the base material damage value for each weapon.
  • ScoreManagerSettings.con - determines the AI values in a Conquest battle.
  • ScoreManagerSettingsCTF.con - determines the AI values in a CTF battle.
  • ScoreManagerSettingsTDM.con - determines the AI values in a TDM battle.
  • Startup.con, StartupFrench.con - what movies play when the game is started.
  • AI: Conditions.con, Prerequisites.con, Radio.con, Strategies.con - more AI related files.
  • collision_Armor: HeavyArmor.con, LightArmor.con, NoArmor.con, PlaneArmor.con - damage factors for computing vehicle collisions.
  • 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.
  rem *** Yamato ***
  ObjectTemplate.create PlayerControlObject Yamato
  ObjectTemplate.aiTemplate YamatoAI
  ObjectTemplate.setNetworkableInfo YamatoBodyInfo
  ObjectTemplate.saveInSeparateFile 1
  objectTemplate.cullRadiusScale 5
  ObjectTemplate.hasMobilePhysics 1
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:
    perl c:\perlprogs\conanalysis.pl > myconreport.txt
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.

You can also pick a specific directory:

    perl c:\perlprogs\conanalysis.pl c:\bf1942extract\objects\HandWeapons > hwreport.txt
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:
  ObjectTemplate.setSpawnRotation 1: x/y/z
  ObjectTemplate.setSpeedDev 1: 0.6 0.8 1.1 1.5 1.8 2.2 2.25 2.3
                             2: 0.2 0.4 0.5
                             3: 0.1 0.2 0.4 0.5
                             4: 0.1
  ObjectTemplate.setStartOnEffects 1: 0 1
  ObjectTemplate.setStrength 1: 0 00 14 15 16 17.5 18 19 20 24 25 28 30 36 4
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.:

  ObjectTemplate.fireingForce       weapons.con (objects/Vehicles)
  ObjectTemplate.fireOnce           objects.con weapons.con (objects/Vehicles objects/HandWeapons Bf1942/Levels)
  ObjectTemplate.flagTemplate       objects.con (objects/Items)
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.