How to make custom mercnet missions

Guides and such related to development go here.

Moderator: Skyfaller

Forum rules
No Discussion Threads!
allmhuran
House Steiner Private
House Steiner Private
Posts: 32
Joined: Mon Nov 24, 2008 4:12 pm

How to make custom mercnet missions

Post by allmhuran »

Note: Whether or not this can be applied to netmech, I do not know. It would probably involve messing with the .prj.

Who am I?
I am Don Halloran, aka "Axe" back when I played netmech and mercnet. I wrote 7 missions for mercnet, axe1 through axe7. I worked with Ed Wong, Mike Grover and Pat Grover on the 3D mercnet mission editor.

What's this about?
This will be an attempt to compile the knowledge I can still find or remember about creating mercnet missions.

What's the structure of a mercnet mission?
A mercnet mission is a file of the form xxxx.mwm in the missions directory under your mercenaries installation. A .mwm is simply a zip file (gzipped), you can open it with, for example, winrar.

Inside the zipped mwm you will find two types of files, .bwd and .txt.

.bwd files
The .bwd files are compiled/encrypted versions of another file type, known as a .wld file. BWD probably stands for "binary wld". A program to decompile .bwd files into .wld files was written by Ed Wong circa 1996. Each .bwd file represents one .wld file.

.wld files
The .wld files are plain text files written in a declarative langauge created by Activision. There are may different types of .wld files, which describe various aspects of the mission. For example, a file xxxxARE1.wld describes the placement of geometry in the mission.

.txt files
Opening these makes what they are fairly obvious. Text files in a .mwm are used to contain the briefing each team or player sees in the mission lobby, and other metadata about a mission, such as the player limit.

Turning .wld files into .mwm files. AKA, compiling a mission
In order to make a .mwm file that can be distributed to other players, you must take your collection of .wld and .txt files and compile them into the .mwm file. A couple of programs are used to do this: stripwld.exe and wasm.exe. Stripwld will "clean up" your wld files and produce a batch file. Wasm then uses this batch file to create the .mwm file. Wasm can also add the data directly to the prj. Run wasm with no arguments to see how this works. Note: everybody making missions back in the day always used the -t option with wasm to make a .mwm. Nobody ever modified a prj, because it makes mission distribution hard. See more below.

These tools are available on the mercenaries CD in the tools directory. You can also get them from various links on the mech2.org site. Both programs are packaged with the mission editor zip available in the downloads forum.

In order to use these tools you need to have dos4gw.exe. At this moment I'm not sure whether this program is on the mercenaries CD. If not, it is available here http://www.allstargaming.net/dl/files/dos4gw.zip

Distrubuting missions
This is easy. Just make your .mwm file available to other players. These files go into the missions dir in your mercenaries installation. There is no need to modify the .prj.

jNote: perhaps, maybe, just as a guess, but probably not, it is possible to make new missions for netmech by using wasm (see below) to add the mission info to the .prj. This means that each player would effectively have to perform the last couple of development steps. I have no idea whether or not this will work. All custom missions were made for mercnet. AFAIK no new content was ever added to netmech around the time all of this mission building stuff was originally going on (circa 1996-1999).

Turning .mwm files into .wld and .txt files
By far the easiest way to make a mission is to decompile an existing mission into its component files and edit those files. To start out, take one of the simpler missions, a small map with a small amount of geometry and simple objectives. The catch is that I no longer have the program necessary to do the decompilation. Such a program was written by Ed Wong circa 1996.

So now what?
Fortunately, the mw2 3d editor download (available on mech2.org) includes a sample mission, called "Gas". The source code (.wld files) for this mission are available in the "source" directory of the download. Unfortunatey, this is not the simplest mission to work with, containing a lot of files. Not every mission has to have all of the files shown in Gas. On the other hand, it does give you a lot of information!

REAL information
As you can see, I can no longer remember much about building missions. Hey, it's been 11 years since I made one. Luckily, EXTENSIVE documentation is still available....

MW2DOC.HTM
The mission building FAQ download available at mech2.org includes a file called MW2DOC.HTM. This file is also on the mercenaries CD. This is an excellent source of information as to what goes into each .wld file, and the overall structure of the files. Originally this document had a background image and white text, so in order to read it I suggest you open it with notepad or something similar and change the body tag text color to 000000 instead of FFFFFF!

Dan Kegel's Mission Building FAQ
Perhaps even more useful (while containing a lot of the same info) is a page belonging to Dan Kegel, which you can find here
http://alumnus.caltech.edu/~dank/mercmfaq.htm

Note: I STRONGLY suggest someone copy the contents of this page and make it available from mech2.org, because Dan Kegel's page on caltech is way, way, waaaaaay overdue for deletion.

Note2: Actually, this file is also available in the mission building FAQ download. Again, change the text color to black in order to be able to actually read it!

Ed Wong's mission table FAQ
Some .wld files have a bunch of "mission tables" in them. These tables describe such things as objectives, and even AI (note: as far as we ever knew, AI DOES NOT WORK PROPERLY IN MERCNET MISSIONS. You can add AI mechs, but they won't do anything. You CAN use them to set off nukes though...hehe). Anyway, these tables can be hard to understand. Fortunately, in the mission editing FAQ download from mech2.org is a file by Ed Wong called MERCSTAB.HTM. This file describes these tables, and is referenced by Dan Kegel's page.
User avatar
Col.Kell
House Steiner Archon
House Steiner Archon
Posts: 868
Joined: Sat Sep 27, 2008 7:44 am
Location: An Isolated Tennessee Valley.

Re: How to make custom mercnet missions

Post by Col.Kell »

A .mwm is simply a zip file (gzipped), you can open it with, for example, winrar.
Cool! I didn't know you can open a mwm file with an unpacker. I wonder if you can do that with the .prj...
perhaps, maybe, just as a guess, but probably not, it is possible to make new missions for netmech by using wasm
It is possible to replace NetMech missions. The PRJ's of the MW2 series you see, (e.g., 31cc, GBL, Mercs) the programmers never removed any terrain or building geometry as they made more games, they just kept adding to the game PRJ. If you wanted to make a NetMech mission, you can use mercnet tools to build them, you just have to make sure you are putting objects that the original MW2 had in that new mission in order for it to work. And still, there is that problem with distributing the PRJ, it's a big file.
I wrote 7 missions for mercnet, axe1 through axe7.
I published a test mission myself in the latest "build-a-world" post called KELL.MWM, though it needs to be named DEM1.MWM.
But I have played your mercnet missions not too long ago. Some cool stuff, Don.
MechWarrior 2: 31stCC
Image
allmhuran
House Steiner Private
House Steiner Private
Posts: 32
Joined: Mon Nov 24, 2008 4:12 pm

Re: How to make custom mercnet missions

Post by allmhuran »

OK, how do I actually make a mission
The help files linked above seem to give you all of the information you need in order to build a mission, but there is one thing that's only hinted at: making a mission is a long, LONG process. Why? Because (unless you manage to get the 3D editor working nicely), you've got a LOT of text editing ahead of you.

Let me make this completely clear: making custom missions means a LOT of very cryptic text editing. Yes, missions are made in text, with, like, notepad. The 3D editor does exist, but I never used it. 90% of missions made for mercnet and which you can still get online were created using text editors.

The process generally looks like this:

- Decide on your mission handle. This is a 4 character identifier, and is used throughout your file contents and file names. Eg, I played as AXE, so I used "AXE1" as the name of my first mission.

- Modify all of the wld and txt filenames to use your new identifier. Also, modify the contents of those files to use your new identifier. For example, the demo mission on the CD is called DEM1. To make AXE1, I would rename all files, replacing DEM1 with AXE1, and also editing the contents of all files, replacing DEM1 with AXE1.

- Modify your briefing files to be whatever you want your players to see.

- Play with the planet file, xxxxPLT1.wld. Actually, when starting out I suggest you don't do this.

- Play with the palette file, xxxxPAL1.wld. This defines things such as the colour of the sky, ambient light, etc. Again, if starting out I suggest you don't modify this file other than to change the name.

- Make sure you've got all of the necessary extra files which you probably won't modify much but need to be there. For example, the star files. Again, read Dan's document for info on this stuff.

- Add geometry. This is done in the xxxxAREx.wld files. You can have as many of these geometry definition files as you like, but if you add new ones or delete existing ones, make sure you update the file xxxxWLD1.wld. The WLD1 file is the file that tells the compiler (stripwld+wasm) which files contain the geometry for the mission. What I used to do when starting out was to delete all but one of the AREx.wld files, and update xxxxWLD1.wld to only reference that file. Then I'd open xxxxARE1.wld and delete all of the content except for one block, which I used as a template for any other geometry I wanted to add. Then you look at the list of available geometry pieces (in the help files linked from the first page), and start adding items.

- This is where things get really time consuming. You have added geometry using X Y and Z co-ordinates, but have no idea what exactly you've added, what it looks like, or where it is in your world. What you do now run your compiling tools (stripwld and wasm) to make your mwm file, fire up mercnet (version 1.06 so you can launch with no other players). Load your mission and walk around in your mech looking around the world to see what you've added and where it is. If you're making a complex object from pieces, like a custom base made of walls and turrets and whatever else, you will do this about 1000 times, editing the coordinates, scale and rotation of your geometry in the AREx.wld file and relaunching the mission to see if the pieces line up the way you want them to. This requires enormous time and patience.

- Add nav points, xxxxNAVx.wld. These can be referenced by objectives. See Dan's document for more info.

- Play with objectives. By far the simplest objective is a "kill the enemy mechs" type mission. If I or anyone else ever finds out how to decompile .bwd files to .wld files you can look at some of my missions to see just how complex objective definitions can be. Objectives are defined in tables in the scenario file (xxxxSCN1.wld). Details about making objective tables can be found in the documents by Dan and Ed talked about in the first post.

- Run your compiling tools, stripwld and wasm. You can use the batch file on the cd to do both steps, but you may want to modify it so that it outputs a .mwm file instead of modifying the prj. This is done by using the -t option with wasm. (strip1.bat on the cd may already be configured this way, I can't remember).

- Fix errors. There will be errors. They will be hard to figure out. Some will be references to geometry that doesnt exist. Or your objectives won't work properly. Or your nav points won't work. Trust me, there will be errors.

- Compile and test your mwm again. Several times.

- You're done. Distrubute!
allmhuran
House Steiner Private
House Steiner Private
Posts: 32
Joined: Mon Nov 24, 2008 4:12 pm

Re: How to make custom mercnet missions

Post by allmhuran »

And still, there is that problem with distributing the PRJ, it's a big file.
Yeah, that's the main problem. And remember, we were making missions back in 1997, where 14.4k modems were the norm.

Also, note that you don't have to modify the prj if everyone who wants to play your mission has the tools. You could just distrubute the .wld files, the .txt files, and a batch file that adds your files to the prj using stripwld and wasm. This would require that
1) Everyone had the stripwld and wasm tools available. They are on the mercs CD.
2) Everyone had dos4gw.exe, whic is needed by wasm IIRC.
3) Everyone understands that they are in fact modifying their prj, and whatever the consequences of that are.
though it needs to be named DEM1.MWM
This should not be necessary. It sounds like there are references in the files, or the filenames themselves, which still have the "DEM1" tag. If you change every instance of DEM1, in both the file names and file contents, to "KELL", you should be able to create your file as KELL.MWM, add it to the missions directory, and play it. If you are using the 3D editor to make the mission, this may have been an unresolved issue in the editor, or maybe there's some configuration settings to change. I can no longer remember. Like I said, I did everything in text, so the details of how the 3D editor actually works with the files is not something I know much about, or can't remember.
User avatar
Col.Kell
House Steiner Archon
House Steiner Archon
Posts: 868
Joined: Sat Sep 27, 2008 7:44 am
Location: An Isolated Tennessee Valley.

Re: How to make custom mercnet missions

Post by Col.Kell »

Don, your tip on using an archive/zip program on MWM files has proved very useful. Thank you.
Using MechVM, I am copying mission BWD's from the campaign and using those in place of simple multiplayer map BWD's. I am doing this because I wold like to make a good single player map, and I work best usualy by reverse-enginiering. So far I am working on the Wolf-Clan trial arena from MW2:31cc to work on Mercnet, and the IVA3 campaign mission from Mercs.

BTW, I need to ask you a quick question; I place a mesa in a test map, but when I deploy and I aproach it, I somehow hit this invisible-wall before actualy reaching it. What type of object does this mesa need to be classified as in order for it to be a normal part of the mission earth?
MechWarrior 2: 31stCC
Image
allmhuran
House Steiner Private
House Steiner Private
Posts: 32
Joined: Mon Nov 24, 2008 4:12 pm

Re: How to make custom mercnet missions

Post by allmhuran »

Hehe, yes, I remember this problem :D

When objects are declared in the xxxAREx.wld files the type of collision model has to be specified. There are several to choose from. What you've currently got for your mesa is "orthorect", which is an orthogonal rectangular prism. Very fast, but not that useful for terrain! Change the collision attribute from "orthorect" to "ground" (or possibly "allpoly", but I think any models whose asset name begins with "t" should use "ground").

Of course, if you're not using a text editor to build your mission and are instead editing binaries or something, this is going to be difficult...
User avatar
Col.Kell
House Steiner Archon
House Steiner Archon
Posts: 868
Joined: Sat Sep 27, 2008 7:44 am
Location: An Isolated Tennessee Valley.

Re: How to make custom mercnet missions

Post by Col.Kell »

Thanks, Don!
I am working on a single-player MWM, I just couldn't have the player crash into things that didn't exist, people would be coming at me with torches and pitchforks! :D
MechWarrior 2: 31stCC
Image
allmhuran
House Steiner Private
House Steiner Private
Posts: 32
Joined: Mon Nov 24, 2008 4:12 pm

Re: How to make custom mercnet missions

Post by allmhuran »

A single player MWM? You mean a mission launched through mercnet that has AI?

As far as I am aware, this won't work.

Yes you can add AI tables to your mission, but I don't think this will work. The mechs will exist in the mission, they might even shoot at you... I don't really remember. But I do remember that they will not move. I don't know why, but I'd guess it would be something along the lines of all controllable entities being (including AI) being assigned a controller via the shell. In other words, a player has to exist for each mech.

This might be something you can somehow modify, but I wouldn't have the first clue as to how. If you've managed to get AI mechs that walk around, attempt objectives, attack, etc, I'd be curious as to how you did it!
Endymion
I.S. Baby
Posts: 8
Joined: Fri Nov 28, 2008 6:11 am

Re: How to make custom mercnet missions

Post by Endymion »

I don't actually remember, but according to the FAQ it was possible to run single player missions through the mercnet shell and have AI that behaved properly.

The problem was that AI mechs were invulnerable in multiplayer. I don't remember if they moved or not - i suspect that they did not.

edit: it rings a bell - they just stood there and shot at you.
allmhuran
House Steiner Private
House Steiner Private
Posts: 32
Joined: Mon Nov 24, 2008 4:12 pm

Re: How to make custom mercnet missions

Post by allmhuran »

Yup. The only thing I ever managed to do with AI mechs was set off nukes. To do this I made them invisible and put them underground. The blast radius wasn't huge either, maybe 100m, so I had to use about 10 to get the effect I wanted...
Post Reply