Classic Battlefield Modding Wikia
Advertisement

Battleffield Pathmapping Part 1-D[]

Making Pathmaps[]

PM1 banner.png


Open your favorite image editor and create a new image, your software should give you a window for you set the new image's properties. So far we know that we want an 8-bit Greyscale image, but what size should the Pathmap be ? 

Pathmaps will always use the Worldsize as their resolution. 

Kursk is a 1024 Worldsize level, and in case you didn't notice, the Pathmaps we looked at were 1024 x 1024 pixels

Even in non-standard sized maps the Pathmaps are based on the Worldsize. Eg: A 256 height map with a 512 Worldsize, instead of the “standard” 1024. The Pathmaps size will still be set by the Worldsize and should be 512 x 512 pixels

But we still don't know how big our Pathmaps should be !   Since we are making our Pathmaps for Aberdeen, so we will need to know the worldsize of this level.

  • Browse to the folder where Aberdeen is extracted, and in the Init Folder you will find Terrain.con.
PM1 terrain con.png


  • Open this file up and look for the line. 
GeometryTemplate.worldSize 1024

Bingo, there is the Worldsize plain as day, and will set our new Pathmap image to 1024 x 1024 pixels.

  • Change the appropriate settings for our new Pathmap, and if possible set the Background or Paper Color to Pure Black (Index 0)

  Photoshop 


PM1 PS convert.png

Correl Paint 

PM1 Correl convert.png

  Paint Shop Pro 

PM1 PSP convert.png


  • If your new image is anything other Pure Black, use a Bucket fill or a BIG brush and ensure the whole image is totally and utterly Pure Black.

So after all that, if you don't have an image like this, you have done something wrong.

PM1_all_black

PM1 all black.png


Now we are going to start generating a few files, so in wherever you like to have your “working” files, make a new Folder (or tree) and we shall save the Pathmap in there, away from our Levels folders.

To start with if you are using Photoshop, it needs to be noted that Photoshop can be a pain at times, it has its little quirks and has a habit of asking questions about settings that we couldn't give a flying frell about. One quirk is easily worked around.

  • whenever saving a 8bit .RAW from Photoshop choose from the File menu, Save As ...

[PM1 save as

PM1 save as.png


We will start by saving the Pathmap for the Cars, ensure the filename is Car4Level0Map8bit.raw, and the Format is set to .RAW

Be aware of another Photoshop quirk that may add “copy” in the filename to Save. Keep your eyes on it just in case.

Photoshop will then bug you ...

  • Header: 0 is fine.


PM1_options

PM1 options.png

And again, Photoshop will bug you, Printer settings we could not care less about

  •  just hit Ok.


PM1_PS_confirmation

PM1 PS confirmation.png


Paint Shop Pro is also capable of saving directly to 8bit .RAW

PM1_PSP_save_box

PM1 PSP save box.png


  • Now use the Save As ... again, and save the same image as Infantry1Level0Map8bit.raw and another Saved As ... Tank0Level0Map8bit.raw

PM1_8bit_files

PM1 8bit files.png


Your Photo Editor does not support RAW Format? Flyrawgui comes to the rescue again!   If your Image Editor  cannot save directly to .RAW, you can save your Pathmap as a 8bit .BMP (Windows Bitmap) and use FlyRawGui to convert the 8bit .BMPs to 8bit .RAWs.

  • First save your new Pathmap Image as Car4Level0Map.bmp.

If your software has a Colour Depth setting in the Save dialog, make sure it is set to 8 Bit Greyscale. Also make sure the image is saved Uncompressed if the option is available. 


Pm1_save_options

PM1 options.png


  • Then use the Save As ... option, and save the same image as Infantry1Level0Map8bit.raw and another Saved As ... Tank0Level0Map8bit.raw
PM1 saves 8bit.png


  • Now, start FlyRawGui and select Convert BMP to RAW.   

The following link offers step by step for converting RAW to BMP.  Just choose the BMP to RAW button:


Convert RAW to BMP - FlyRAWGUI

  • Convert all three pathmaps for the Car, infantry, and tank:
Car4Level0Map8bit.bmp

Infantry1Level0Map8bit.bmp

Tank0Level0Map8bit.bmp

You should have something like this:

Pm1 repeat conversion.png

Note:  If using Phtoshop, you may see .ACT files. These are Photoshop Colour Table files, but for our purposes it is just luggage we have to work around. You can keep deleting them if you like, but you may get sick of doing so.  You can just ignore them for now.  From here onwards you may find it handy to sort the files in a Window by Type as i have above, this groups the files together according to Filetype and may make it easier to find the file you want when things start getting crowded.

Packing Pathmaps[]

We now have three 8bit Pathmaps, one for each unit class, but before they are usable by Battlefield we need to pack them in the same format as Dice has used. Again, its Rexman's tools to the rescue.

  • Browse to your Ai_Tools folder and open the 8bit folder.


Pm1 packing PM.png


This is where the Ai Pathmap Packer resides, and much like the Pathmap Previewer requires several steps to do its job. Thankfully it can all be done with just a double-click of _pack.bat

There is a two things we need to do, so the Pathmap packer is ready for use. 

  • First, Edit _pack.bat and change the line,
set AIOUTDIR=..\

to

set AIOUTDIR=Pathfinding
  • Then save and close the file. You now need to make a new folder of the same name.


Pm1 save2.png

Now when you double-click _pack.bat, 8bit .RAW Pathmaps that are in the same folder, will be converted to Dice's RAW Format and all the files that are required will be created in the Pathfinding folder we just created. Try it now, there are some sample Pathmaps already here.

  • Double-Click _pack.bat and a Command Prompt window will appear briefly, now browse into the Pathfinding folder.


PM1 extracted files.png

Well this is good, we have 15 files again and seems our little test was successful.

  • Delete these test files and lets repeat the process with the new Pathmaps we have created.
  • Browse to your “working” folder, and Copy the three 8bit .RAW pathmaps your saved earlier.


PM1 selected files.png
  • Next, back to the Ai packer's Folder and Paste our Pathmaps here, and overwrite the existing files.


PM1 overwrite.png


Double-Click _pack.bat again, and then browse into the Pathfinding folder.

Pm1_pack_again.png

Pm1 pack again.png

If all has gone well, we have 15 files again. Notice the files are quite small, this is due to the Pathmaps being totally Black, and as your Pathmaps increase in detail and complexity the filesize will also increase.

Now that we have our new Pathmaps converted to the type of files required by Battlefield, we could quite happily use these in a level. They will not do their job properly, since they are all Black and do not actually “Path out” any objects at all, but they will allow the Coop mode to start. This can be useful in getting a basic Ai package up and running as quickly as possible, just ignore all the Bots headbutting walls. 

Full Black pathmaps can also be useful in testing. If your Bots are not moving at all, you can check your Pathmaps by temporarily replacing them with Black Pathmaps, and if the Bots suddenly start moving, you now know that your Pathmaps are suspect. If the Bots still do not move, you can at least remove bad pathmaps from the list of possible problems. 

Credits:

Arc D'Wraith – Author

Coralon – Feedback & Additional Material

Muzzi – Additional Material

White Thunder – Title Banner

Special Thanks to the toolmakers, for without your work modding Battlefield would be a joke.

Resources:

Bf1942 Modder's Wiki

bf42.com Editing Forums

Original Battlefield Maps

Tools Used:

Battlefield 1942

Corel Photo-Paint 8

Ed42

FlyRawGui

Notepad

NVDXT.exe

Rexman's Ai Tools

RFA Extractor

TGA Merge

TGA Splitter

Open Office

undxt.exe

Advertisement