PDA

View Full Version : Mapping Expanding a Map From Scale 2 to 4


J.F.Leusch69
2009-05-22, 08:13
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-modding-tutorials/14468-tutorial-setting-up-bf2-editor-pr-mapping-modding.html

and this:

How To Make A Scale 4 Map - Official BF Editor Forums (http://bfeditor.org/forums/index.php?showtopic=8407)

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
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

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:
http://img33.imageshack.us/img33/5486/screenshot2205200913203.jpg

Alpha channel 2:
http://img34.imageshack.us/img34/6650/screenshot2205200913204.jpg

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":
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:

heightmapcluster.create HeighmapCluster
heightmapcluster.setClusterSize 3
heightmapcluster.setHeightmapSize 4096

rem --- primary ---
heightmapcluster.addHeightmap Heightmap 0 0
heightmap.setSize 1025 1025
heightmap.setScale 4/0.00762939/4
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 16/1.95312/16
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 16/1.95312/16
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 16/1.95312/16
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 16/1.95312/16
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 16/1.95312/16
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 16/1.95312/16
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 16/1.95312/16
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 16/1.95312/16
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:

http://img32.imageshack.us/img32/3340/screenshot2205200913450.jpg
http://img193.imageshack.us/img193/4697/screenshot2205200913454.jpg
http://img195.imageshack.us/img195/2468/screenshot2205200913455.jpg
http://img194.imageshack.us/img194/1986/screenshot2205200913474.jpg
http://img196.imageshack.us/img196/3284/screenshot2205200913480.jpg

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

Tonnie
2009-05-22, 08:18
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...

KP
2009-05-22, 09:02
Moved thread.

J.F.Leusch69
2009-05-22, 12:01
updated and finished so far :)

marcoelnk
2009-05-22, 12:11
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.

Onil
2009-05-22, 13:40
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.

J.F.Leusch69
2009-05-22, 13:48
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
2009-07-21, 14:41
-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

J.F.Leusch69
2009-07-21, 15:07
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 :)