User login

Navigation

Poll

I downloaded the ETQW demo and....
...I'm too busy playing for polls.
0%
...it's awesome.
60%
...it's okay, I expected better.
20%
...I'm lost in the valley, anyone have a map?
0%
...my machine won't run it. :-(
20%
Total votes: 5

Who's online

There are currently 0 users and 32 guests online.

Welcome to RUST | Gamedesign.net

Using Text Editors for Mapping

Submitted by Gard on Fri, 2004-08-20 08:24.

Using Text Editors For Mapping

by Ricebug

You've been working on this huge map and have just discovered that about a thousand brushes need the detail property applied to them. This job would be tedious in the best of circumstances, not to mention the possibility of missing a few brushes.  Or let's say you need to change all the _focus values for a certain light entity. Those mine lights are a bitch to select due to their size. Again, an exercise in tedium.

Lucky for us, the standard .map format is nothing more than simple ASCII---in other words, plain English. So opening it up in a text editor provides us with the ability to use the Search & Replace functions to do sweeping changes in a map, thus removing the drudgery. Doing so requires some preparation, however.

1. Back up the map file! There's nothing worse than destroying a map with the click of a mouse.

2. Get a text editor. I'd recommend EditPad. It's free, it will do operations on multiple files, and will not contaminate the map file with unnecessary (and fatal) characters. If you like more muscle, UltraEdit32 is also a good choice. Do not use Windows' Notepad. It has the nasty habit of inserting or deleting carriage returns. Besides, it has a limited filesize buffer. Same for any high-end word processor. Unless you really understand the different .txt formats, (there are 4) it's safer to use EditPad. 

3. If you're using a map editor that saves its maps in a proprietary format, such as WorldCraft or QOOLE, you'll have to export the map as a .map file. Once the changes have been made, you can then re-load the repaired map and press on.

WARNING

If your editor supports  brush grouping or some other hierarchical tactic, you will lose this information in the export process. See the caveat and recommendations mentioned at the end of this tutorial.


The Basic Brush

{
( 128 0 -64 ) ( 8 0 -64 ) ( 8 -128 -64 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
( 8 -128 0 ) ( 8 0 0 ) ( 128 0 0 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
( 8 -64 8 ) ( 128 -64 8 ) ( 128 -64 0 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
( 64 -128 8 ) ( 64 0 8 ) ( 64 0 0 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
( 128 0 8 ) ( 8 0 8 ) ( 8 0 0 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
( 0 0 8 ) ( 0 -128 8 ) ( 0 -128 0 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
}

This is all the info describing a 643 brush with the c_met11_2 texture applied to it. If you care to check, one corner of this brush sits at the center of the world (0 0 0). Imagine having to construct an entire map using a text editor! Believe it or not, the first CAD programs were done exactly in this manner. Lucky for the users, they only had to worry about drawing a 2-dimensional world.

What we're really interested in are the numbers following the texture name. You'll see there are eight. Taken from the example above, the first line would be 0 0 0 1 1 0 0 0. These are all of the texture values and spawnflags. The fact that there are mostly zeros means the texture has no surface or content flags set for it; it's just a plain old texture. The two 1's are the texture's dimensions, which mean that it has been applied with it's default size. 

A visual reference for the texture property flags

Even though you may use a different editor, the flags still mean the same thing.


Texture Properties

Now that you know what the 8 data bits reference, you now need to know what possible values can be used. Let's take the light value, which is used typically for sky textures and light-emitting textures. Therefore, a string of 0 0 0 1 1 0 0 100 means that you've get a light value of 100. However, since the light flag is normally set for a situation like this, it would read 0 0 0 1 1 0 1 100. Reason being, is that 'light' is the first item in the surface property list, and therefore has a spawnflag value of '1'. 'Slick' is '2', sky is '4' and so on, following the numerical convention used for spawnflags. Here's a handy reference showing all of the spawnflags:

Surface Property Spawnflags Content Property Spawnflags
Light
Slick 
Sky Flag
Warp
Trans33 
Trans66 
Flowing 
NoDraw 
Hint
Skip
1
2
4
8
16
32
64
128
256
512
Solid
Window
Aux
Lava
Slime
Water
Mist
PlayerClip
MonsterClip
Current_0
Current_90
Current_180
Current_270
Current_up
Current_dn
Origin
Monster
Corpse
Detail
Translucent
Ladder
1
2
4
8
16
32
64
65536
131072
262144
524288
1048576
2097152
4194304
8388608
16777216
33554432
67108864
134217728
268435456
536870912

With this information you can now fix certain things in the blink of an eye. Some suggestions:

In some map editors, applying the ladder flag can be a tedious process. Suppose your ladder is using a texture named eggwhite. Open the map in EditPad, highlight and copy the text, paste it into the Text to find field, paste it again into the Replace with: field and replace the third zero from the end with the ladder spawnflag number.

EditPad's Find & Replace dialog

Or suppose you had a level with a lot of sky brushes and it needed the light value jacked up. A real pain to do so within the editor, but a piece of cake with a text editor. 

e1u1/sky1 0 0 0 50 50 0 133 50

 The '50 50' tells you that I've applied a vertical and horizontal stretch value of 50 to the sky texture. The '133' is a surface property spawnflag total of light (1) + sky (4) + nodraw (128). The '50' at the end is the light value I applied to the sky texture. Since 100 would give me better results, changing this last number via EditPad on all sky brushes would be a piece of cake.

I had a large warehouse whose ceiling used a light-emitting texture that covered a host of various-sized brushes. As in the case of the sky, the same method was used to correct the light value, A real time saver.


A Note Concerning Non-Radiant Editors

Mad Dog had some input on this issue which is relevant to Worldcraft, QOOLE, and QuArk users. If you're thinking of replacing textures globally with new properties using a text editor, do not export not the entire map as a .map.  Instead, first determine which groups are affected, and then export each group
individually as a separate .map. Then, after changing things, copy the contents of each of those new "maplets" into your primary map, make each a new group, and replace each old group with the new ones. That way the grouping is preserved.


Map making should be fun and not tedious. Hopefully, I've enlightened you on how to be more productive in your endeavors and put the fun back into creating those worlds. 


Copyright 2001, by Terry DeLaney. Permission is granted to distribute this file as long as the author receives credit.

RUST | Gamedesign.net is your source for all the latest game-editing news and tutorials. If you are seeing this message, this means that you are using a browser that does not support CSS. Please upgrade your browser and enjoy your stay at RUST and if you have any questions, comments, or suggestions, please contact a site administrator.