
JACK AND JILL DIDN'T GO UP THE HILL ... ?
sample files
--------------------------------------------------------------------------------
This is the Second part of the Pathmapping tutorial that will cover the pathing of terrain and how to use Editor 42 to find slopes that are too steep for a Bot to climb or drive up.
I will be using the use original Battlefield 1942 level Aberdeen as our guinea pig, which you will need to extract to the location that Ed42 is setup to read your levels from.
--------------------------------------------------------------------------------
Where to Start ?
Editor 42.
Without Coin Coin's Editor the method of making pathmaps i am about to introduce you to, would just not be possible. Previous methods usually have required shadows and/or a lot of guess work and continuous alt-tabbing & converting between applications. Very tedious. Whilst this method is no Sunday picnic, the accuracy to which you can make your Pathmaps is much better, and requires much less time & frustration overall.
To get a better idea of what lays ahead, Open Aberdeen with Editor42. Move around the level and “draw in your head” what you think will need to be Pathed out

This is over at the East Village control point, just in this small area we have a few things to contend with.
The ridge around the Base, has slopes of varying gradients. On some parts of this ridge, Bots will be able to walk & drive, up & down with no problems, and other parts will be too steep for the Bots to even walk up. The tricky bit is finding the parts in between that Tanks can drive up, but Cars cannot, and also parts that Infantry can walk up, but neither Tank or Cars can drive up.
There are also a few static objects here that will need to be pathed out. From what we have seen previously, we know the requirements for each unit's Pathing is different. For the Infantry, the Pathing will closely follow these objects, and if possible we will path the buildings for bot access. The Tank & Car Pathmaps will follow the same general layout as the Infantry Pathmap, but will be “bloated” so the Pathing will help keep some space between the Bots and Objects.
I hear your gears clicking already ... we're in Ed42 ... we can paint in Ed42! Well, hold it right there soldier. You are on the right track, but just stay here with us for the moment.
To give you an indication of where we are heading, here is a sneak peak at the finished product.

--------------------------------------------------------------------------------
Preparation
There are a couple of things we should organise. First we will need a separate copy of Aberdeen for each pathmap we want to create. Browse to your Ed42 levels folder.

Select your copy of Aberdeen and Copy it, then Paste 3 copies of it to the same folder.

And rename the folders for each of our pathmaps, to something that makes sense to you.

Aberdeen does not actually use Jeeps in Battlefield 1942 and we could get away without making this Pathmap, and use a duplicate of another pathmap instead. Of course your not getting off that easy, we shall do it for the exercise. But keep two things in mind; If your map is Infantry only, completing a single pathmap would be sufficient, and you could just use duplicates of the same pathmap for all the Units, AND you should also consider that conversions for other Mods may have units that will require their specific pathmaps.
Also, included with this tutorial are Textures for Ed42. We will be needing them shortly, so ensure you have them installed in Ed42's Library folder.
--------------------------------------------------------------------------------
Terrain & Pathmaps
We will use Ed42's Texturing capabilities to help us create the Pathing of slopes for each unit. Ed42 has a rather neat feature that can determine the slope of a terrain and texture the surfaces with bitmaps or colours according to the steepness. This is normally used to paint steeper terrain of a level with a texture of things like rocks and blend it with grass or sand on the flatter surfaces. The Textures you have just installed use Ed42's Slope Selector to texture the steeper slopes, not with a rock texture, but white. Each of the textures, will be used on the appropriate copy of Aberdeen we have created as each texture has a different slope threshold for each of the units. If you want to know more about the settings, you can view and edit them in the texture dialog we will come across shortly.
Open your “Carmap” copy of Aberdeen.

Well, it's still the same ol' Aberdeen ... for the moment.

We're about to give Aberdeen a paint job it will never forget. First, activate Ed42's texturing mode by pressing [F2] or use the Mode Menu. Next, open the Texture Dialog, use the button on the bottom tool bar, its the lil' TV with a bad reception.

That will open this.

We want to change the Child Layer, so click on the Single layer selection box ... where it says (Default).

In the Layer selection, Pick the Library and you should be able to find the Pathmap_Car Texture. Select the texture and press Ok.
On the way out we need to change the Light settings.

Make sure Ambiant light is at the Maximum value of 1.00 as we want to make sure that when we paint in white ... we get PURE white. Also, reduce the Sun light to zero, as shadowing will not be required.
Lets have a dabble to see what this will do for us, we just need to change a couple more settings. Use the Square brush, increase the brush size, and change the Opacity to 100%

Once you have change those settings, run the brush over a section of the map. You turn can turn grid by pressing [G] this will help you see the angles of the terrain

Well, that take most of the guess work out. The Slope Selector has applied White, just like we would use in a pathmap on the steeper slopes. The Texture does not however use black for the rest for one simple reason ... A black grid on a black ground is very hard to see. One advantage we can take from this is using the rest of the texture to get more information. A second Slope Selector colours the flattest areas in green, but colours the slightly steeper sections in brown. The brown indicates the “in between” area that you may have to keep your eyes on it for possible problems with the Bots. At the top of the ridge they have an opportunity to get quite close to the edge, and could fall off. Around the bottom you may them driving awkwardly on the hillside, as again they can get close to that. We will of course cover some techniques that will help in a later Tutorial Part.
Time to move on, we now have to cover the whole level with this texture. Wanna paint the whole thing by Hand ? Didn't think so. We can be happy that Ed42 can fill the map with two mouse clicks. First click this button on the bottom tool bar.

Then, do i need to tell you which button to click here ?

Aberdeen is a small map, and its not a complex texture so the process shouldn't take long, maybe around 30 to 60 seconds on a average PC. But be warned, bigger maps & slower machines ... you may want to put the kettle on.
Now most of the nasty slopes that Cars will not like have been found and pathed out. You can see the results in the mini-map.

That is all we will do for the Car Map in this step, save the changes to the level and open the “Infantry” Level. We don't need to do test scribble this time, we will just do the fill and get it done with.
As before, change to Texturing mode and open the texture dialog, change the single layer texture to Pathmap_Infantry from the Library. On the way out, don't forget to change the Light Settings; Ambient 1.00 & Sun 0.00
All you need to do now, is Fill the level.

As you would expect the infantry map to be like, less area is pathed out as the Bots can move on much steeper slopes while on foot than they can while in Cars.
You should have the hang of it now, save the Infantry Map, Open the Tank Map and do the drill soldier!

At first glance, this may not look much different to the Infantry Map, you will need to look at the hills in the background to see there is indeed quite a difference. Tanks are quite versatile machines, they have a decent amount of grip and can get to some surprising places. Given the opportunity the Bots will get to surprising places in Tanks. If they think they are following the shortest route that the Pathmaps are telling them, they will try and drive over a mountain ranges to get to their destination and if the pathmapping does its job properly of keeping the Bots away from areas they will get stuck in, they will get to its destination ... eventually.

That is all we need to do with Ed42 at this stage, make sure your Map is saved an we'll move on to the next step.
--------------------------------------------------------------------------------
At the moment we have 3 maps that almost look like Pathmaps. From here we need to get these Maps, into something a little more usable. We will do this by taking the terrain textures and in a process involving a few steps, turn them into images that are more akin to pathmaps & we will be able to use these for further editing.
Browse to the Textures folder of your Aberdeen “Carmap” and have a look at the files we will be working with.

The files we are interested in here are the Tx**x**.dds Terrain Tiles, we need to “stitch” these together to get a single image. If you are already familiar with Terrain Merging, get to it, otherwise here comes instructions.
First we need to convert the .dds files to .tga, to do this we will use Undxt.exe, a small texture converter by MadBull, that is included in the unofficial SDK. This is another Command Line program, so for you Non-DosPrompt people, i have included undx.bat to run it for you. The downside is that you will need to copy Undxt.exe and the included Undx.bat into each and every folder containing textures you wish to convert.
Like this ...

Now all you need to do is double-click undx.bat and all the .dds files will be converted to .tga including some we're not interested in, but you get that.

At this point it might be worth a warning that the size of files we generate from here will start to add-up to a fair amount of Hard Drive space, especially later when you are doing 2048 Worldsize maps. If you did 3 2048 Worldsize Maps, all at the same time time, you would have roughly 1Gb just in textures files at the peak. If you are short on HDD space, you will have to process each map in turn, rather than each step for all the Maps in one go.
Ok, if you have the HDD space to stick with the plan, repeat the .dds conversion for the “Infantry” and “tank” maps. Remember you will need to copy Undxt.exe and Undx.bat to the folders where you are converting textures.
!!! TIP – Open Command Window Here ... !!!
Handy little “official addons” for Windows you may not know about is Powertoys.
One in particular is very handy ... Command Here.
This is available for WinXp, and if you dig there should be versions for Win9x around somewhere, and adds a new option to the Folder context menu, when you Right-Click on a folder the option Open Command Window Here will be available.
To setup our texture converter for use with this, copy undxt.exe and undx.bat to your Windows folder. When you use Open Command Window Here, simply type undx and the .dds files within the folder you selected will be converted to .tga

Our next task is the merging of the .tgas, for this we use the appropriately named tgaMerge, another tool by Madbull. This will read the .tga terrain tiles and write a new file that is a single image with the tiles stitched together the right way.

Yay! .. its a Gui!
First, the source directory must be changed to the folder where the .tga texture tiles of the level are. Do the maps in the same order as you did in the previous step, it helps to build a pattern. So browse through to the Textures folder of your “Car Map”

Then change the Output filename to where you like to keep to keep your “working” files. Save the file as Car4level0Map24bit.tga, keeping the same naming format as pathmaps, but note the change to 24bit as the output will be a 24 bit Colour Image.

Last option to set is TGA Segment Size. This setting will have the same as we have have used previously for the Pathmap preview tool, so it will be 4 for Aberdeen, a 1024 Worldsize level, and 8 for a standard 2048 Worldsize level.

Press Merge, and its off ...

Again, if you have the HDD space to stick with the plan, repeat the tga merging for the “Infantry” and “tank” maps, saving each as Infantry1level0map24bit.tga and tank0level0map24bit.tga respectively.

Once you have merged all three levels you can browse through and delete all the .tga files in the textures folder of each level and we are done with the merging.
The next step is to set the size of these images to the same resolution that we require for our pathmaps. Start your favorite Image Editor and Open Car4level0Map24bit.tga.
This image is currently 4096 x 4096 pixels, but our pathmap needs to match the Worldsize of 1024 for Aberdeen. So it is a simple matter of resizing the image to 1024 x 1024 pixels for Aberdeen, or to the Worldsize of your custom level. On resizing we must make sure the image stays sharp, and does not get blurred in the process. Ensure you turn off any filtering or anti-aliasing functions.
PHOTOSHOP

In Photoshop's Image size dialog, the Nearest Neighbor option will resample the image without any anti-aliasing

–=#=–
COREL PAINT (and other software)

Other software may have an Anti-alias tick box

–=#=–
Before we save this Image, you may remember something from the first part the tutorial when we look at Kursk's Pathmap for the first time ... think ... it was upside down. So guess what ? Thats right, Flip the image vertically before you save it
Resize and Flip the other images, Infantry1level0map24bit.tga & tank0level0map24bit.tga to 1024 x 1024 as well, and make sure the filtering is turned off, and that will complete another step. You will notice the files are much smaller now ... yay!

These images are now much closer to being a Pathmap. You could convert them to greyscale, fill the middle with black, pack em' up and away you go, but of course we still have most of the work ahead of us, in pathing the static objects.
- END OF PATH 2 -
--------------------------------------------------------------------------------

Credits:
Arc D'Wraith – Author
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
Notepad
TGA Merge
Open Office
undxt
Please excuse my english, i'm Australian ; )
|