Skip to content

Fun-o-Matic

Sections
Personal tools
You are here: Home » FoM Wiki » bfXML Map Info
Views

bfXML Map Info

last edited 3 years ago by woody

One fun feature of bfXML is the ability to plot information on battle maps--for example, plotting the locations where people were killed in the game. It's not at all obvious how the coordinate systems in BF1942 and BFV work, nor how to get copies of the map graphics from the game data files, so I thought I'd document it all here.

This information was compiled from serveral sources, most notably http://www.planetbattlefield.com/perfectionist. Another very useful resource is the Perl program makemap that reads game data files and produces a graphic map of a game level with icons showing the location of resources; a lot can be learned from looking at the code about how in-game coordinates work.

The BF coordinate system

  • Coordinates are expressed as X/Y/Z.
  • The map origin is in the lower left (SW) corner.
  • X coordinates increase going up (north).
  • Y coordinates are altitude.
  • Z coordinates increate going right (east).

How to Get Map Images

  • BF1942/BFV data files are aggregated together into compressed "Refractor Archive" (RFA) files ("Refractor" is the DICE name for the game engine). Extract the contents of the RFA file for the map you want (RFA Extractor is one tool that can do this).
  • From the expanded RFA, find the directory called Textures.
  • The file you want is called InGameMap.dds. This file contains a 512x512 pixel map which is used for the in-game mini-map display, in the DDS (DirectDraw Surface) DirectX file format.

To convert the DDS file to another format

  • Easiest way: use the Photoshop plugin dds.8bi to allow you to open DDS files from within Photoshop.
  • Another way: the makemap program has code to read DDS and then to write it out as PPM. Gimp can read PPM. (Look at using the makemap code to create a dds2jpeg utility; could we do one better and get the DDS data directly from the original RFA file?).

Map Parameters

  • Within the expanded RFA file, you need the files Init.con and Init/Terrain.con.
  • Init/Terrain.con has one line that specifies map scale, either:
          GeometryTemplate.WorldSize 2048
    

or:

      console.worldsize 2048

Possible values for scale are: 1024, 2048, and 4096.

  • This scale can be overridden however, by a line in 'Init.con':
          Game.SetActiveCombatArea 512 768 1280 1280
    

The first two values are X and Z offsets; the second two are X and Z scales (the scales will always be the same).

  • The offsets specify the X/Z coordinate of the origin at the lower left (southwest) corner of the map.
  • The scale parameters specify how many coordinate points exist on their respective scales; an X scale of 1024, and X offset of 0, for example, mean the X axis has coordinates running from 0 to 1023.

The file Init/Terrain.con contains this line:

   GeometryTemplate.yScale 0.6

Is this the altitude scale for the map?

Some sample scale data gleaned this way:

  Map        X-Offset Z-Offset X-Scale Z-Scale Y-Scale
  El Alamein   N/A      N/A     2048    2048    0.60
  Bocage       N/A      N/A     2048    2048    0.60
  Wake         N/A      N/A     2048    2048    0.60
  Berlin      1536     1536      512     512    0.60
  omaha_beach  N/A      N/A     2048    2048    0.35
  stalingrad   320       52      416     416    0.70
  dc_sea_rigs    0        0     2048    2048    1.00

 

Powered by Plone

This site conforms to the following standards: