Expanding a Map From Scale 2 to 4

Information and tutorials related to modding BF2.
Post Reply
J.F.Leusch69
Retired PR Developer
Posts: 2988
Joined: 2008-04-23 16:37

Expanding a Map From Scale 2 to 4

Post by J.F.Leusch69 »

hello,

[R-CON]Wilkinson requested this tutorial so here it comes:

1.Introduction
2.Getting started (here you most likly have to read )
3."The right Map"
4.Editing the Heightmap
5.Editing the Codefiles


1.Introduction:

This tutorial is about expanding a map from scale 2 to scale 4. i will do it with "Daqing Oilfields" which is a 1024x2 =>2x2km map. it should be also possible to do it with a 512x2 => 1x1km map, but i will expand now Daqing Oilfields" to a 1024x4 => 4x4km map.

This way of doing it you can keep a your statics, ambiente objects, sounds, overgrowth etc...

But there is one problem: if you expand your map its pretty much work (as far as i know) to keep your color + light + detailmaps. so make a back up of your map before you do anything to them!!!


2.Getting started:

Make sure you have read those tutorials:

https://www.realitymod.com/forum/f189-m ... dding.html

and this:

How To Make A Scale 4 Map - Official BF Editor Forums

Now you should have a working pr_edit mod and know that you always have to edit your terrain.con to make your 1024x4 => 4x4km map working ingame. ( :lol: if you havent understand that you really need to read the 2 tutorials above!)


3."The right Map"

I will do it with Daqing Oilfields, but what is the perfect map for you? As i said earlier you should take a 1024x2 => 2x2 km map (size of Ramiel, Qwai). if your unsure about this, just take a look in the "Heightdata.con" located in the server.zip of your map or if you already extract your map or if its a custom map than it should be just in the *mapname* folder. Open it with notepad and read the first few lines of code:

This is my code from Daqing Oilfields

Code: Select all

heightmapcluster.create HeighmapCluster
heightmapcluster.setClusterSize 3
heightmapcluster.setHeightmapSize [color=Red]2048[/color]

rem --- primary ---
heightmapcluster.addHeightmap Heightmap 0 0
heightmap.setSize [color=Red]1025 1025[/color]
heightmap.setScale [color=Red]2[/color]/0.00762939/[color=Red]2[/color]
heightmap.setBitResolution 16
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapPrimary.raw
heightmap.setMaterialScale 1
heightmap.loadMaterialData Levels/Daqing_oilfields/HeightmapPrimary.mat

rem --- secondary ---
heightmapcluster.addHeightmap Heightmap -1 -1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_L1U1.raw
heightmapcluster.addHeightmap Heightmap 0 -1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_U1.raw
heightmapcluster.addHeightmap Heightmap 1 -1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_R1U1.raw

heightmapcluster.addHeightmap Heightmap -1 0
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_L1.raw
heightmapcluster.addHeightmap Heightmap 1 0
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_R1.raw

heightmapcluster.addHeightmap Heightmap -1 1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_L1D1.raw
heightmapcluster.addHeightmap Heightmap 0 1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_D1.raw
heightmapcluster.addHeightmap Heightmap 1 1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_R1D1.raw

heightmapcluster.setSeaWaterLevel 130
The red markered things tells you about the heightmap size:

heightmapcluster.setHeightmapSize 2048 [This tells you about the whole size of the map, here it is a 2048 => 2km map]

heightmap.setSize 1025 1025 [This tells you how big your heightmap is, so we have a 1024x2 => 2x2km map here][Note: it will always add 1 more so for 256 => 257, 512 => 513, 1024 => 1025]

heightmap.setScale 2/0.00762939/2 [This is about the scale, the scale is the factor on the heightmap, so the first and the last number should be the same as there are just for the flat and the number in the middle is the scale of the height, but we will get into this a bit more soon.]

so if your heightmap.con looks simular to my, than we can start editing the map :)

4.Editing the Heightmap (with Photoshop)

First off you need to unzip the client.zip and server.zip of your map if your making a custom map you wont need to do it cos your map is already unpacked :) )
Make sure they are not "read-only"!

Than make a copy of "HeightmapPrimary.raw" and call it lets say "4x4km.raw".

Now we will edit the heightmap with PS (you can also pick up another programm that reads and writes raw files. i think GIMP does that as well.).
Open "HeightmapPrimary.raw" and "4x4km.raw" with PS.

Now resize the "HeightmapPrimary.raw" to 50% of the orinial size.
Than paint the "4x4km.raw" with a paint tool the channel "alpha 1" comlpett black and channel "alpha 2" with 75% grey (you can also change the settings but for your first try this will be the guidelines :) )

After that copy and paste the 2 channels form "HeightmapPrimary.raw" to the matching channels of "4x4km.raw". The copied patches should right in the middle of "4x4km.raw".

Alpha channel 1:
Image

Alpha channel 2:
Image

Than we´re done and can save "4x4km.raw" as new "HeightmapPrimary.raw" and overwrite the old one. [no special saving settings, just let it as there are default and dont care about "losing data", its fine this way]

now delete the old unneeded "4x4km.raw".

5.Editing the Codefiles

So lets just get the codes line up and we´re toally done :) .
Open "Heightdata.con" with Notepad (under Vista it could be called "Editor").
Make sure they are not "read-only"!

Now this is my form "Daqing Oilfields":

Code: Select all

heightmapcluster.create HeighmapCluster
heightmapcluster.setClusterSize 3
heightmapcluster.setHeightmapSize 2048

rem --- primary ---
heightmapcluster.addHeightmap Heightmap 0 0
heightmap.setSize 1025 1025
heightmap.setScale 2/0.00762939/2
heightmap.setBitResolution 16
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapPrimary.raw
heightmap.setMaterialScale 1
heightmap.loadMaterialData Levels/Daqing_oilfields/HeightmapPrimary.mat

rem --- secondary ---
heightmapcluster.addHeightmap Heightmap -1 -1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_L1U1.raw
heightmapcluster.addHeightmap Heightmap 0 -1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_U1.raw
heightmapcluster.addHeightmap Heightmap 1 -1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_R1U1.raw

heightmapcluster.addHeightmap Heightmap -1 0
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_L1.raw
heightmapcluster.addHeightmap Heightmap 1 0
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_R1.raw

heightmapcluster.addHeightmap Heightmap -1 1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_L1D1.raw
heightmapcluster.addHeightmap Heightmap 0 1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_D1.raw
heightmapcluster.addHeightmap Heightmap 1 1
heightmap.setSize 257 257
heightmap.setScale 8/1.95312/8
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_R1D1.raw

heightmapcluster.setSeaWaterLevel 130
And this is how it should look like after editing:

Code: Select all

heightmapcluster.create HeighmapCluster
heightmapcluster.setClusterSize 3
heightmapcluster.setHeightmapSize [color=Red]4096[/color]

rem --- primary ---
heightmapcluster.addHeightmap Heightmap 0 0
heightmap.setSize 1025 1025
heightmap.setScale [color=Red]4[/color]/0.00762939/[color=Red]4[/color]
heightmap.setBitResolution 16
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapPrimary.raw
heightmap.setMaterialScale 1
heightmap.loadMaterialData Levels/Daqing_oilfields/HeightmapPrimary.mat

rem --- secondary ---
heightmapcluster.addHeightmap Heightmap -1 -1
heightmap.setSize 257 257
heightmap.setScale [color=Red]16[/color]/1.95312/[color=Red]16[/color]
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_L1U1.raw
heightmapcluster.addHeightmap Heightmap 0 -1
heightmap.setSize 257 257
heightmap.setScale [color=Red]16[/color]/1.95312/[color=Red]16[/color]
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_U1.raw
heightmapcluster.addHeightmap Heightmap 1 -1
heightmap.setSize 257 257
heightmap.setScale [color=Red]16[/color]/1.95312/[color=Red]16[/color]
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_R1U1.raw

heightmapcluster.addHeightmap Heightmap -1 0
heightmap.setSize 257 257
heightmap.setScale [color=Red]16[/color]/1.95312/[color=Red]16[/color]
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_L1.raw
heightmapcluster.addHeightmap Heightmap 1 0
heightmap.setSize 257 257
heightmap.setScale [color=Red]16[/color]/1.95312/[color=Red]16[/color]
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_R1.raw

heightmapcluster.addHeightmap Heightmap -1 1
heightmap.setSize 257 257
heightmap.setScale [color=Red]16[/color]/1.95312/[color=Red]16[/color]
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_L1D1.raw
heightmapcluster.addHeightmap Heightmap 0 1
heightmap.setSize 257 257
heightmap.setScale [color=Red]16[/color]/1.95312/[color=Red]16[/color]
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_D1.raw
heightmapcluster.addHeightmap Heightmap 1 1
heightmap.setSize 257 257
heightmap.setScale [color=Red]16[/color]/1.95312/[color=Red]16[/color]
heightmap.setBitResolution 8
heightmap.setModified 1
heightmap.loadHeightData Levels/Daqing_oilfields/HeightmapSecondary_R1D1.raw

heightmapcluster.setSeaWaterLevel 130
So what i´ve done is:
(Red markered things are changes)

I changed:
-the "whole" map size to 4096 [heightmapcluster.setHeightmapSize 4096]
-the scale of the "flat" terrian, i have not touched the height! [heightmap.setScale 4/0.00762939/4]
-and the scale of the secondary heightmaps [heightmap.setScale 16/1.95312/16]


Now we´re should be finished,...so lets check the result :) , load up your map in the editor.

You might be a bit shocked now,... because of the expanded scale of your map you will need to smooth everything out.

And now its your turn, grab the editor tools and map like there is no tomorrow and show us your expanded maps :D

Notes:
-This tutorial might not work with 512x2 => 1x1km maps, cos there are some problems with 512x4 => 2x2km maps
-no guarantee that this is turns out as you thought
-there is a way to keep your light + color + detailmaps! but i am too lazy to explane it :D

And here are some of my new 4x4km Daqing Oilfields:

Image
Image
Image
Image
Image

as a result of increasing the scale we have some weird terrain spots, but with a bit love from the smooth and modify tool we can work that out :) .

hope you can understand much/everything maybe learned a bit and hopfully it works for you and you are lucky with the result.

cheers J.F.Leusch69
Last edited by J.F.Leusch69 on 2009-05-22 12:08, edited 2 times in total.
Tonnie
Retired PR Developer
Posts: 2014
Joined: 2007-07-31 14:59

Re: [Tutorial] Expanding a map from scale 2 to 4

Post by Tonnie »

Nice tut mate i need this like a month ago for my map.... Meh i gave up on it tho hehe

EDIT:
Oh and can a R-MOD move this to Modding Tuts...

HangMan: BF2 Editor, it has very strict limitations memory wise, and crashes all the time. Its like a girl. Treat it with respect and take it slow and you'll get places. Rush and get ahead of yourself and it will turn around and punch you in the mouth
KP
Posts: 7863
Joined: 2006-11-04 17:20

Re: [Tutorial] Expanding a map from scale 2 to 4

Post by KP »

Moved thread.
Image
More guns and bullets make bad guys go away faster,
which in turn makes everyone in the area safer.

-Paul Howe
J.F.Leusch69
Retired PR Developer
Posts: 2988
Joined: 2008-04-23 16:37

Re: [Tutorial] Expanding a map from scale 2 to 4

Post by J.F.Leusch69 »

updated and finished so far :)
marcoelnk
Retired PR Developer
Posts: 1581
Joined: 2007-03-03 11:30

Re: [Tutorial] Expanding a map from scale 2 to 4

Post by marcoelnk »

Nice one.
never dared to try it . Looks like quite some work to actually do that but might pay out well in the end for some maps.
Image
Onil
Posts: 1232
Joined: 2007-08-19 09:50

Re: [Tutorial] Expanding a map from scale 2 to 4

Post by Onil »

What if you want your previous 2km map area to not be in the center of your new 4km map?

And is it possible to reduce the size instead of increase it?

Let's say you have a 2km map and want to make a 1km version of it? Is it possible and easier or does it also screw half of the map's work? Might be better to just keep the 2km and use no go zones... but the smaller, the less laggy they usually are.
Image
J.F.Leusch69
Retired PR Developer
Posts: 2988
Joined: 2008-04-23 16:37

Re: [Tutorial] Expanding a map from scale 2 to 4

Post by J.F.Leusch69 »

Onil wrote:1.What if you want your previous 2km map area to not be in the center of your new 4km map?

2.And is it possible to reduce the size instead of increase it?

Let's say you have a 2km map and want to make a 1km version of it? Is it possible and easier or does it also screw half of the map's work? Might be better to just keep the 2km and use no go zones... but the smaller, the less laggy they usually are.
1. yes its possible, but it will be much more work, and i havent done it yet. you would need to get into the static.con and move all statics in relation to the placment of your heightmap within the new 4x4km heightmap, and than i am not sure about other stuff like overgrowth roads, etc...

2. sure it would be possible but it would also take more work than just setting up new "no go zones". you would have to basicly delete all the stuff thats not anymore on the map (its still on the map but not on the primary heightmap) and than you might again have a lot of work getting all your other stuff back in place.


so i think this is useful if you already have started a map and now realize that i wanna have a bigger one, or you want to make a vbf2 audit and at the same time you wanna make it bigger as well.

expanding a finished map is in my opinion worthless.

cheers Leusch
Outlawz7
Retired PR Developer
Posts: 17261
Joined: 2007-02-17 14:59

Re: [Tutorial] Expanding a map from scale 2 to 4

Post by Outlawz7 »

-This tutorial might not work with 512x2 => 1x1km maps, cos there are some problems with 512x4 => 2x2km maps
Don't see why would you want a 512x4 map when you can resize the heightmap to 1024 and have 1024x2
Image
J.F.Leusch69
Retired PR Developer
Posts: 2988
Joined: 2008-04-23 16:37

Re: [Tutorial] Expanding a map from scale 2 to 4

Post by J.F.Leusch69 »

but than you might have the problem that your static placement and some other things dont fit anymoew the terrain, but i am not sure :)
Post Reply

Return to “Modding Tutorials”