Difference between revisions of "Map making by hand"
m (box doesn't take shift, so i made it meshbox (Transformations))
|Line 296:||Line 296:|
while the object..
while the object..
position 10 10 0
position 10 10 0
shift 0 0 10
shift 0 0 10
is at position 10 10 10.
is at position 10 10 10.
Revision as of 16:06, 4 March 2010
|There is still documentation to be done here!! If you feel up to the task, please have a go at it. Specifically what needs to be added is:|
Major re-organization, transform away from "chat" style. Need to reference pages elsewhere on the wiki in place of much of the content which appears to be building up here. Create them if necessary, or see the list here.
Although there are a number of GUI options for creating maps such as BZ-Edit, 3D modelers, many map-makers use a basic text-editor. There are many times when it is necessary to make small changes to a map, such as including objects that are unavailable in GUI map-maker, but there are also some who enjoy the challenge of creating a map entirely from scratch with a text-editor.
Most text-editors designed for coding/programming are more than sufficient for editing bzw files. Although word-processing programs such as Microsoft Word can be used, there are many cheaper (free) and more efficient programs designed specifically for coding.
- Command-line editors such as nano, emacs, pico, vim, or ed.
Editing existing maps
Beginning mapmakers should spend some time studying and making small changes in existing maps to see how things work. In the client, maps can be saved for editing by joining the desired server and choosing: Options>Save World. Maps can also be saved by issuing the /saveworld command. The map should be a simple map when getting started. One may find it easier to create a file in BZEdit and open the resulting file in the text-editor.
If you have created a box in BZEdit you may see:
# World built with bzedit32 world class, available at # http://www.sourceforge.net/projects/bzflag world size 400 end options +r -j -set _tankSpeed 25 -ms 5 -mp 0,2,0,2,0,2 end box name box1 position 0 0 0 size 10 10 10 rotation 0 end
What that means
"There are set variables that define various things such as how fast your tank is, how fast the bullets are, or if it's raining or foggy. Put those in the options setting with "-set(space) " in front of it. You can also make those changes as an admin by using /set _variable (notice there is a space between the set and the _). A full list of these settings can be found on the Server Variables page. Other options, such as how many times a flag can be grabbed before it resets or if flags can land on buildings are explained in this forum post Optionally, the variables can be placed in a separate configuration file and referenced when the server is started." old
First, it says:
- World built with bzedit32 world class, available at
(Note: the # sign is used for comments.)
This is the text added by the application initially, kind of like advertising. This will be the first thing anyone sees when they look at the map.
The next thing is:
world size 400 # Sets the world size to 400 (800 x 800 total) end
This is rather self-explanatory. It's the <size> of the <world>.
options +r # Enable Ricochet -j # Enable Jumping -set _tankSpeed 25 # Sets the tank speed to 25 bzunits/second -ms 5 # Sets the maximum shots (per tank) to 5 -mp 0,2,0,2,0,2 # Maximum of 2 Red Players, 2 Blue Players, and 2 Observers end
This is the <options>. The commands listed here are: Ricochet, Jumping, Tank speed, Max Shots, and Max Players. These are rather self explanatory, except for Max Players. It works like this. Rouge, Red, Green, Blue, Purple, Observer. Each number defines the max number of players per category.
For more, see Options Object.
We now come to:
box name box1 # Generally unused position 0 0 0 # X Y Z Position size 10 10 10 # X Y Z Size (bzunits from the position of the box) rotation 0 # Rotation (in degrees) end
This is a <box> with a <name> of <box1>. The <position> is 0,0,0 in R3. The rest is pretty self explanatory.
Important: EVERY STATEMENT MUST HAVE AN END.
- Objects are the basic building blocks of the bzw file. Objects begin with a line declaring the object, some fields describing that object, and a line that closes the object (usually with "end"). Each of these sections of the object is important.
- BZFS ignores anything in a line following the #; the line has been "commented out." It is highly recommended that comments be used often, both for the mapmaker and for others that may see the map.
- 3D Cartesian Coordinate System
- In most objects, you will see three numbers after position and size. These numbers are coordinates on a graph. The first number is the x coordinate (left and right) the middle number is the y coordinate (forward and backward) and the third number is the z coordinate (height and depth). Another way of thinking of it is: x = width, y = depth, z = height. (Those accustomed to the Y axis determining height will have to slightly adjust their thinking.)
Perhaps the simplest object is the box. There is actually nothing special you can do to it (but in versions of BZFlag from 2.0.8 up, you can do a lot more to it). Here is an example of a box:
box name box1 # Optional, but good to include position 0 0 0 size 10 10 10 rotation 0 end
In the first line, notice the word "box". It simply says the next object is a box. The next line is the name of the object. It is defined with the syntax "name objectName". It is not required, but is good to include. The third line defines the position of the center of the bottom of the object. The three arguments of position are the x, y, and z coordinates of the box, respectively. The x and y coordinates can be positive or negative, but the z coordinate should just be positive or zero. On the fourth line, the size of the box is defined. The arguments of size are the x, y, and z sizes of the object, respectively. The x and y arguments make the box that wide on both sides of it's position. However, the z argument makes the object exactly the number of units tall as defined. The next line just says how much the object is rotated. This number is the number of degrees of rotation, and can be negative or positive. The last line just tells BZFlag the object is done, and a new one can be defined. Be sure to always use this.
Most objects have similar parameters as the basic box. For instance, the code for a cone may look something like this:
cone name cone1 position 0 0 0 size 10 10 20 divisions 128 end
Divisions basically decide how smooth the cone is. The higher the divisions the more smooth the cone is. A division of 4 would look like a pyramid. Another parameter that can be added to the cone object is angle. If you say angle 180, that would make 1/2 of a cone, 90 would make 1/4 of a cone, and so on.
An arc is basically a cylinder. However it doesn’t have to be a perfect cylinder depending on certain options you select. For an arc the only required options are divisions, position and size. Just like the cone divisions have the same effect, position and size are all the same. Once again you can have an oval shaped cylinder type thing. Now, you WILL find more options to an arc than to a cone, for example the ratio option. The ratio options let you basically put a hole in the cylinder. So if you have the option: ratio 1 you would have a full cylinder. If you say for example ratio .3 or any number less than 1 you will get a whole in the cylinder. The bigger the number, the smaller the hole. Angle allows you to do a simi-circle. Rotation once again isn't really needed. all the options like spin and shear are the same for this object too! phydrv and matref I’ll show later. Let’s move to the sphere
The only options required to make a sphere are position, size, and divisions. All these options do the same thing as they did in the objects above. You may also have an oval like sphere. You make an oval like sphere simply by making the x and y's different sizes just like in the cone and arc. The radius option is just a substitute for size. You can write size 10 10 10 or radius 10. Both do the same thing. However if you want an oval shaped sphere you have to use size. Rotation wouldn't really have an effect and the shear and spin works the same for this object.
Getting more help
- The links at the bottom of the Map Making page.
- The original creator of this page is flight, you can email him at firstname.lastname@example.org and he will be happy to answer any questions that he is capable of answering.
There are certain objects that are often coded by hand because it is simpler or it is impossible to do with graphical map creation tools.
material name mat1 addtexture blue_bolt.png end meshbox position 0 0 0 size 10 10 10 rotation 0 matref mat1 end
Material is letting the computer know that a material is about to be explained to it. You name it so that way you can reference it with the matref. The name can be any thing you want as long as it does not have any spaces. You type in addtexture and you state a texture name. Now, how do you know what texture names there are to use?
On Linux: Running ls /usr/share/bzflag/*.png in a terminal will show the list of pictures.
On Mac: If you control click (right click) on the bzflag icon, click show package contents, click contents, and click resources, those are the pictures you may use.
On Windows: The default path is C:\Program Files\BZFlag\data\*.png
What you will find are images that are used in every day games. The top of a base, the wall of a base. A bullet which is blue_bolt.png (as was used above). The full path to the texture needs to be used if the texture is not found in that directory. Any customized textures should be uploaded to the BZFlag Image Submission System before the map is hosted publicly.
Servers running bzfs 2.0.8 and earlier will require "meshbox" and "meshpyr" in order to apply textures and physics to these objects.
Instead of creating a new texture, many interesting and creative things can be done with the "diffuse" parameter in the material object. You can add the diffuse command and it will look like this diffuse 1 1 1 1. The first number is the amount of red that will be in the meshobject. The second number is the amount of green, the third is the amount of blue. So you can mix those colors to make more colors. You may use a range from 0-1. For example diffuse .3 .5 .26 1. The fourth number determines the opacity or transparency (the see-throughability). 0 is invisible, .5 is half invisible, and 1 is normal.
material name mat1 diffuse .5 .25 .1 .6 addtexture mesh.png end
Physics make your tank behave in different ways. If you have ever played laser mania by Louman than you know on the outskirts of the map there is something you can jump on and you go really fast, that is a physics. Physics and materials work the same way. Physics is to material as phydrv is to matref. You must specify a physics then on a meshbox, meshpyr cone arc sphere or whatever, you can reference that physics by using the phydrv command just like you would use the matref command for materials. There are different physics commands. Linear, angular, slide and death. In the Louman map I mentioned above is a linear physics. Linear physics makes your tank move in a line. The numbers after a linear command are just like position x y z. Example:
physics name phy1 linear 50 0 0 end
This will make your tank move at a speed of 50 in a positive x direction you may use -50 and it will make it go the other way.
physics name phy2 linear 0 50 0 end
This will make your tank move at a speed of 50 in a positive y direction
physics name phy3 linear 0 0 50 end
This will make your tank jump at a speed of 50
physics name phy4 slide 5 0 end
This will make your tank basically feel like it's on ice. Whichever way the tank is moving it will keep moving that way.
physics name phy5 death haha! you died end
This will make the tank die when it touches the object that refers to this and the message haha! you died will be displayed to that person.
physics name phy1 death I like you better dead! end meshbox position 0 0 0 size 10 10 10 rotation 0 phydrv phy1 # Or what ever you named the physics. end
This works just like the material
The thing about physics and materials is that they have to be written before they are referenced.
This won't work
meshbox position 0 0 0 size 10 10 10 rotation 0 matref mat1 end material name mat1 addtexture blue_team.png end
A group is a defined group of objects that can be called to gether as one.
For example if a map editor is makeing a forest, and each tree contains 2 objects, the editor doesn't want to type up the code for each tree over and over again. What he can do is tell BZFS that these objects = tree. and then whenever he wants to make a tree he just types tree.
first define a group of obects as a tree
define tree box position 0 0 0 size 2 2 4 end pyramid position 0 0 3 size 5 5 10 end enddef
then to add a tree simpily type
group tree position 0 0 0 end
Transformations are simple ways of modifying objects so that maps have some variety. These can get complicated so I will only give you a sample of what they can do. There are 3 transformations shift, spin, and shear.
The one is will tell you about is Shift.
Shift moves an object by the amount of units that you specify from its present position. the object..
box position 10 10 0 end
is at place 10 10 0
while the object..
meshbox position 10 10 0 shift 0 0 10 end
is at position 10 10 10. Please also note, that not all object can take the shift argument.