Forum

Please or Register to create posts and topics.

Porting DFLW Terrains to BHD

Porting DFLW Terrains to BHD

First off you will need a few tools to get you going
FwO Raven's PFF Extractor Utility
BHD Mod Tools
Photoshop

Lets get started

Open the FwO Raven's PFF Extractor, point it to you DFLW Directory, look for the Dflw.pff file.
Now you should see a list of files packed into the .pff. On the bottom left side is a drop down box, click it and scroll down to TRN, click on it and the files will reload showing only the Terrain files.
Ok pick a terrain G5.TRN, right click Extract to Desktop.
Open the file with an editor or notepad if you don’t have one and you will see.

terrain_name     "g5"
terrain_creator  "John Brophy"
;terrain values
color_map         g5_c
elev_map          g5_d
detail_map        g5_m
detail_texture    g5_det
detail_tilerate   200
water_height      0             ;default, if zero will take from mission

We will need 2 files from the above information.
You will need to get the g5_c.tga and the g5_d.pcx from the Terrain.pff

Open g5_d.pcx with your paint editor (Photoshop) and save it as g5_d.raw file
So now we had g5_c.tga and 5g_d.raw these are the only 2 files we will need to keep for this section.

Alpha Channel

While you have your Paint program open, open the g5.tga and the g5_d.raw images. Add an Alpha Channel to g5.tga now click on the g5.raw image, select the image (drag curser from corner to corner) then copy the image (Ctrl+C). Go back to g5.tga, click on Alpha Channel, select image (drag curser from corner to corner) then paste (Ctrl+V) save as g5.tga in 32bit

On your Desktop create 2 folders Terrain and Tools. Put the g5_c.tga into Terrain folder and g5_d.raw into the Tools folder
Extract your BHD Mods Tools to your Desktop, go through it and copy the TrnGen.exe into your Tools folder. Also copy the Sample.tpj from Sample folder and paste it in to the Tools folder.

In the Tools folder we now have
Tools/TrnGen.exe
Tools/g5_d.raw
Tools/Sample.tpj

Rename the Sample.tpj to g5.tpj then open it in your editor.

terrainname	"Sample"
creator		"Novalogic"
path		"your path here\"              ;be sure to have a backwards slash at the end of path
depthmap		"sample_d.raw"
output		"sample"
lock_topleft		0	0
lock_topright		0	0
lock_bottomleft		0	0
lock_bottomright		0	0

Change to below

terrainname	"g5"
creator		"Novalogic port by 2DNED"
path		"C:\Users\Phillbert\Desktop\Tools\"              ;be sure to have a backwards slash at the end of path
depthmap		"g5_d.raw"
output		"g5"

lock_topleft		0	0
lock_topright		0	0
lock_bottomleft		0	0
lock_bottomright		0	0

Save and Close the g5.tpj
*Note you will have to change the path to suit yourself

Open TrnGem.exe, click on File> Open and then click on the g5.tpj file then click on Build> Begin Build. The process will take a few minutes until it says Build Complete at bottom, close program.
You will now have 688 files in your Tools folder, you need to fish out the TrnGen.exe, g5_d.raw, g5.tpj and most important g5.cpt. The rest of the files are rubbish and can be deleted.

Add the g5.cpt to your Terrain folder so now you have
Terrain/g5.cpt
Terrain/g5_c.tga

Now to the terrain file, I don’t like the one in the BHD Mod Tools so we will grab one from the BHD .pff. Open FwO Raven's PFF Extractor and point it to your BHD Directory, look for resource.pff, select TRN in the drop down box. We will extract DVD1.TRN to your Desktop.
Rename the file to g5.TRN then open it in your editor

 

terrain_name     ""
terrain_creator  "Chris Tamburrino"

;terrain values

water_height      0            ;default, if zero will take from mission


polytrn_colormap    dvd1_c.tga
polytrn_detailmap   det_grav.tga
polytrn_polydata    dvd1.cpt
polytrn_tilestrip   trntile1.tga
polytrn_charmap     dvd1_m.pcx
polytrn_foliagemap  dvd1_f.pcx

polytrn_detaildensity		160
polytrn_sectorcount             8                   ; width of sectors
polytrn_wrapx			0                   ; do we wrap on X?
polytrn_wrapy			0                   ; do we wrap on Y?

polytrn_origin			-4	-4           ; move terrain origin by this amount (X,Y)  
     
polytrn_sectors			1	2	1	1	2	1	2	1 ; width here must match above
polytrn_sectors			1	2	1	1	2	1	2	1
polytrn_sectors			1	2	1	1	2	1	2	1
polytrn_sectors			1	2	1	1	2	1	2	1
polytrn_sectors			1	2	1	2	2	1	2	1
polytrn_sectors			1	2	2	2	3	2	2	1
polytrn_sectors			1	2	2	2	4	1	2	1
polytrn_sectors			1	2	2	2	1	1	2	1

You will need to change the code to below

terrain_name     "g5"
terrain_creator  "Chris Tamburrino"
;terrain values
water_height      0            ;default, if zero will take from mission
polytrn_colormap    g5_c.tga
polytrn_detailmap   det_grav.tga
polytrn_polydata    g5.cpt
polytrn_tilestrip   trntile1.tga
polytrn_charmap     dvd1_m.pcx
polytrn_foliagemap  dvd1_f.pcx
polytrn_detaildensity		160
polytrn_sectorcount             8                  ; width of sectors
polytrn_wrapx			1                   ; do we wrap on X?
polytrn_wrapy			1                   ; do we wrap on Y?

polytrn_origin			-4	-4          ; move terrain origin by this amount (X,Y)  

polytrn_sectors			1	3	1	3	1	3	1	3 ; width here must match above
polytrn_sectors			2	4	2	4	2	4	2	4
polytrn_sectors			1	3	1	3	1	3	1	3
polytrn_sectors			2	4	2	4	2	4	2	4
polytrn_sectors			1	3	1	3	1	3	1	3
polytrn_sectors			2	4	2	4	2	4	2	4
polytrn_sectors			1	3	1	3	1	3	1	3

Once you have finished editing the g5.TRN save and close it.
Move the g5.TRN file in to the Terrain folder.
Now you essentially have your terrain converted ready for use.

You might noticed a few things, one being the terrain is too bright and in some cases the mountains are tall and steep sides.

Terrain to Bright
In your .trn file we had polytrn_detailmap det_grav.tga
You need to use the FwO Raven's PFF Extractor to find det_grav.tga and extract it from the Resource.pff in BHD. Next we need to rename it from det_grav.tga to g5_detail.tga

Open g5_detail in your Paint program and change the contrast so it is a little darker, save and put it in to your Terrain folder.

Go to your Terrain folder and open the g5.TRN file in your editor/notepad and change det_grav.tga to g5_detail.tga, save and close
Copy the 4 Terrain folder files in to your BHD Directory.
Now you need to add the /d command for the game to read the files from the game directory.

Add a space then /d to the end of your BHD Shortcut
"C:\Program Files (x86)\NovaLogic\Delta Force Black Hawk Down\dfbhd.exe" /d

Terrain to Steep/Jagged
Open the g5.raw files in you Paint program and play with Contrast to make it a bit darker and this will flatten the mountains. You will have to use the TrnGen.exe again to make a new g5.cpt file