This wiki is archived and useful information is being migrated to the main bzflag.org website

Difference between revisions of "Map making by hand"

From BZFlagWiki
Jump to: navigation, search
(Building World Objects: added wiki table and content)
 
(76 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{DoDoc|Major re-organization, transform away from "chat" style}}
+
{{DoDoc|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 [[Special:Allpages|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.
+
Editing by hand is still a common way of creating maps.
 +
Although there's a number of GUI options for creating maps such as [[BZEditWin32|BZEdit]], [[BZWTools]], [[BZFed]], [[PyBZEdit]] and [[IBZEdit]].
 +
Many map-makers use a basic text-editor. This can be due to the enjoyment of the challenge of creating a map by hand or due to a lack of graphics modeling capability.
  
 
==Text Editors==
 
==Text Editors==
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.
+
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. If you are interested in syntax highlighting, look at the [http://my.bzflag.org/bb/viewtopic.php?f=24&t=16037&p=148953 forum topic].
 
===Windows===
 
===Windows===
 
*Notepad
 
*Notepad
 
*PSPad
 
*PSPad
 +
*NoteTab
 +
*[http://notepad-plus-plus.org/ Notepad ++] - a tabbed editor based on Scite.
 +
 
===Mac===
 
===Mac===
 
*TextWrangler
 
*TextWrangler
 
*TextEdit
 
*TextEdit
 
===Linux===
 
===Linux===
*Command-line editors such as nano, emacs, pico, vim, ed.  
+
*Command-line editors such as nano, emacs, pico, vim, or ed.
 
*GEdit
 
*GEdit
 +
*Kate
 +
*Scite
  
 
==Editing existing maps==
 
==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.
 
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.
 +
One can gain experience by also converting map objects into their mesh equivalents such as converting a [[Box|box]] into a [[Meshbox|meshbox]] or a [[Pyramid|pyramid]] into a [[Meshpyr|meshpyramid]].
  
 
==Getting Started==
 
==Getting Started==
If you have created a box in BZEdit you may see:
+
One should become familiar with the [[BZW]] syntax before attempting to create a map by hand from scratch or have on hand a reference card.
 +
Also knowing the coordinates of where object placement(s) will occur based on the options set.
 +
The way world units are oriented in a normal right hand rule coordinate system with positive Z being the "UP" direction.
 +
"north" on the in game radar is the positive Y direction in map coordinates.
 +
This image shows a typical map, with the origin and axis directions clearly marked out.
 +
[[Image:MapCoordinateSystem.png]]
 +
 
 +
The positioning of map objects in the "position" of an object goes as such.
 +
The first setting is for the "X" axis with the second being for the "Y" axis and the third being for the "Z" axis.
 +
The same applies to the "size" in a world object.
 +
 
 +
A good way to start learning is to begin with simple world objects and settings:
 
{|
 
{|
 
|
 
|
  # World built with bzedit32 world class, available at
+
  # Example world with settings and box
  # http://www.sourceforge.net/projects/bzflag
+
  # The number sign is not needed for a map to function, but is used for comments.
 
  world  
 
  world  
 
   size 400  
 
   size 400  
Line 40: Line 59:
 
  end  
 
  end  
 
|}
 
|}
===Basic Definitions===
 
;Objects
 
: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.
 
;Comments
 
: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.)
 
  
===Explanation of the Sample Code===
+
=== Example map explained ===
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 [http://my.bzflag.org/bb/files/antigrav4teamconf_114.txt in this forum post]
+
First, it says:
 +
  # Example world with settings and box
 +
# The number sign is not needed for a map to function, but is used for comments.
 +
(Note: the # sign is used for comments.)
  
==Sample Objects==
+
This is many times added by map editors, but with different comments.(depending on editor)
  
==Getting more help==
+
The next thing is:
*The links at the bottom of the [[:Category:Map Making|Map Making]] page.
+
<pre>
*The original creator of this page is flight, you can email him at dirtbikerdude_91@yahoo.com and he will be happy to answer any questions that he is capable of answering.
+
world
 +
  size 400 # Sets the world size to 400 (800 x 800 total)
 +
end
 +
</pre>
 +
This is rather self-explanatory. It's the <size> of the <world> (The BZFlag arena).
  
==The Original Post==
+
Next is an <options> section:
For now, you can put those in the options part of your map file, but when you are ready to get your map public, copy those options out to another blank text file and save it as a .conf. You don't have to know what that does, just do it. .conf is configuration file. Then in terminal or command prompt you can specify the path to your .conf file and it will open the map. For more information on this, look in the link above. It explains a lot.  
+
<pre>
 +
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
 +
</pre>
 +
This allows you to define in the map file certain options that are also available from the command line when you start the bzfs server, or in the optional server config file. Options embedded into a world file will override those input on the command line or in a config file.
  
The code for the cone works like a box. In fact, the code for every other object (other than meshes and tetra) look like the box code. You must say you are creating a cone. Complex shapes will be explained later in the post.  
+
The commands listed here are:
 +
Ricochet, Jumping, Tank speed, Max Shots, and Max Players.
 +
These are rather self explanatory, except for Max Players. Each number represents how many of each of the following team players are allowed in the game (in the order listed): Rogue, Red, Green, Blue, Purple, Observer. Each number defines the max number of players per category.
  
In case the article hyperlinks in the previous page confuse you, (because I know it confused me) I’ll let you know the only real things you need to make a cone are divisions, position, and size. Divisions basically decide how smooth the cone is. The higher the divisions the more smooth. For example, if you were to say 4 divisions it would look like a pyramid. Basically the divisions is how many sides there are. 4 divisions, 4 sides. Imagine 128 divisions. The sides would be so small you wouldn't really notice them, making it look more like a cone. To see what I’m talking about, go ahead and test it out. I’ll show the code to test it in a second. I assume you know what position is. I assume you know what size is too, however you should know that you can make a cone that's more of an oval-shaped cone simply by making the size something like 5 10 20. If the x is larger than the y coordinate or vise versa than obviously you have an oval, just like in a box you would have a rectangle. That's it.  
+
For more info, see [[Options_(object)|Options Object]].
  
cone
+
We now come to:
    name cone1            # name is optional, but it helps you.
+
<pre>
    divisions 128
+
box
    position 0 0 0  
+
  name box1      # Generally unused
    size 10 10 20
+
  position 0 0 0 # X Y Z Position
  end  
+
  size 10 10 10 # X Y Z Size (bzunits from the position of the box)
 +
  rotation 0    # Rotation (in degrees)
 +
end  
 +
</pre>
 +
This is a <box> with a <name> of <box1>.
 +
The <position> is 0,0,0 in R3[https://en.wikipedia.org/wiki/Three-dimensional_space_(mathematics)].
 +
The rest is pretty self explanatory.
  
There are other options such as shift, shear, scale, spin, angle, smoothbounce, flatshading, and probably many more. I don't know what the smoothbounce and flatshading options do, however I do know how to use the other options such as rotation (I'm sure you know what that does too) which in a cone's case doesn't really matter what way it's rotated, angle, which basically allows you to make half of a cone. If you say angle 180, that would make 1/2 of a cone, 90 would make 1/4 of a cone, and so on. To add one of these, simply type in angle <number> somewhere under "cone". Shear is interesting!  This is what it does. Imagine a slinky. Hold the bottom of the slinky tight. Take the top of the slinky and move it to the left (right, forward, or backward). That would be a perfect example of a sheared arc! When you write the shear options, it must look like this:  shear 3 0 0  . This is telling the object to be sheared 3 units to the x coordinate. The number next to the 3 is the y and the last 0 is the z or the height. Shift is weird in my opinion. It doesn't seem to have any benefits unless you are working with a mesh. When you shift something, you are basically changing the position of it. Shift is a synonym for position. The scale option is the same as the size option. Another really cool option is spin. This takes a tall pyramid and can turn it on it's side. The code for this may be a little hard to understand, so I'll do my best to explain it. Take an object (in this case I'm using a cone).
+
'''Important:''' EVERY STATEMENT MUST HAVE AN END.
 +
If a statement does not have an end you will get an error.
  
cone
+
===Basic Definitions===
  name cone
+
;Objects
  divisions 128
+
: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.
  position 0 0 0
+
;Comments
  size 10 10 10
+
: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.
  spin 90 0 1 0
+
;3D Cartesian Coordinate System
end
+
: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.)
  
One thing you will notice about BZFlag is a lot of times the numbers 1 and 0 will be given not as a value, but more of a way of saying on or off, or in this case which coordinate gets the spin. I'll show you what I'm talking about. I say spin (that is to say it I'm putting a spin on it). The 90 is saying that the object is going to spin 90 degrees, but it doesn't now which way to turn 90 degrees.  that is what the 0 1 0 are for. Because there is a 0 in the x and z coordinates it won't spin that way. Because there is a 1 in the y coordinate it will spin that way 90 degrees. 
+
===Optional client setup===
 
+
There are some options that appear useful when editing a map, especially when editing by hand.
I also know how to use phydrv and matref. I’ll show you how to use those later in this article. For now lets move on to arcs.
+
;showCoordinates
 +
:The BZFlag client is capable of displaying a tank's current location for the player at the top right corner, right below the clock. This feature is being activated by executing the "/localset showCoordinates 1" command to the chat line.
  
An arc...
+
==Building World Objects==
 +
In order to build maps, one must know the world objects used in them.
 +
The table below provides an overview of the map objects which exist in BZFlag.
 +
{|{{Prettytable}}
 +
|-
 +
| {{Hl3}} |'''Map Object'''
 +
| {{Hl3}} |'''Description'''
 +
|-
 +
|  [[ Arc]] ||  Arc is an object that defines an arc or cylinder in a map.
 +
|-
 +
| [[ Base]] ||  Base is an object which is similar to a box, but defines properties of it being a base for capture the flag style game play modes.
 +
|-
 +
|  [[Box]]  ||  Box is an object which defines a cube structure in a world file.
 +
|-
 +
|  [[Color(BZW)]]  ||  Color is used in a BZFlag world (BZW) as a sub parameter for many parameters, such as materials and dynamic colors.
 +
|-
 +
|  [[Cone]]  ||  Cone object is a BZW object that defines a cone in a BZW world file.
 +
|-
 +
|  [[Define]]  ||  Group Definition, or define, will group a set of objects that can be recalled and duplicated multiple times with the group object.
 +
|-
 +
|  [[DrawInfo]]  ||  DrawInfo allows clients to render the mesh object more efficiently through LODs (Levels of Detail). Drawinfo also allows the ability to create moving objects in a map.
 +
|-
 +
|  [[DynamicColor]]  ||  DynamicColor describes how a color channel will be dynamically updated.
 +
|-
 +
|  [[GroundMaterial]] ||  GroundMaterial is an option for a Material that allows one to set the ground texture. .
 +
|-
 +
|  [[Group]] ||  Group allows one to bring together a number of elements and refer to them as a single object.
 +
|-
 +
|  [[Include]] ||  Include is an option which allows one to specify a second bzw file that will be included in the first bzw.
 +
|-
 +
|  [[Link]]  ||  Link is an object which creates a link (route) between two teleporters.
 +
|-
 +
|  [[Linkmaterial]]  ||  LinkMaterial allows one to set the texture of the teleporter window to anything one would like it to be..
 +
|-
 +
|  [[Material]]  ||  A material is used in a BZFlag world to define a new look for otherwise regular objects, such as meshboxes.
 +
|-
 +
|  [[Mesh]]  || Mesh is an object which defines an arbitrary three dimensional shape.
 +
|-
 +
|  [[Meshbox]]  ||  Meshbox is an update to the original [[Box]] object and supports features such as physics drivers and textures.
 +
|-
 +
|  [[Meshpyr]]  ||  Meshpyr is an object that constructs a specialized mesh that has the geometric appearance of a Pyramid.
 +
|-
 +
|  [[Options (object)]]  ||  Options object is a BZW map structure that defines various options for a server to use when running a map.
 +
|-
 +
|  [[Physics]]  ||  Physics, or Physics Driver, is an object when applied to another object, will affect a tank touching it in some way.
 +
|-
 +
|  [[Pyramid]]  ||  Pyramid is a BZW map structure that defines a polyhedron having a polygonal base and triangular sides with a common vertex in the world.
 +
|-
 +
|  [[Sphere]]  ||  The sphere is an Object that defines a sphere in a map file.
 +
|-
 +
|  [[Teleporter]]  ||  Teleporter is an object which transports the user to another teleporter in a different part of the world.
 +
|-
 +
|  [[Tetra]]  ||  Tetra is an map object which creates a polygon with four vertices.
 +
|-
 +
|  [[TextureMatrix]]  ||  TextureMatrix, or texmat, when applied to a material object, allows you to define how a texture will appear in a material.
 +
|-
 +
|  [[WaterLevel]]  ||  WaterLevel is an object that defines a plane of water that spans the entire map. WaterLevel is deadly to all tanks that cross it.
 +
|-
 +
|  [[Weapon (object)]]  ||  Weapon object is a BZW map structure that defines a fixed weapon effect.
 +
|-
 +
|  [[World (object)]]  ||  World object is a BZW map structure that defines various options for the map.
 +
|-
 +
|  [[Zone]]  ||  Zone is a rectangular BZW map structure for spawn or flag zones.
 +
|}
  
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
+
==See also==
 +
===Map Editors===
 +
{| class="wikitable" style="margin-right: auto; margin-left: 0px;"
 +
| [[BZEdit]]
 +
| [[BZEditWin32]]
 +
| [[BZFed]]
 +
| [[BZWTools]]
 +
| [[DI-Machine]]
 +
|-
 +
| [[IBZEdit]]
 +
| [[Modeltool]]
 +
| [[PyBZEdit]]
 +
| [[Wings3D]]
 +
|
 +
|}
  
The sphere...
+
===Map Objects===
 
+
{{Template:Map objects}}
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. :O I can show you how to use phydrv and marref now.
+
 
+
OK, a phydrv is a physics driver. And a matref, well I’m not sure what it means, but I always thought it meant material reference. Lets focus on material right now. A material is how you add a design or a texture on something. For example if you make a box, that box doesn’t have to have bricks around the outside of it like it does in bzedit. You want to make a tree? Later I will show you how to make a cone and put a material on it like Louman does for the trunk although Louman is way better than I am!! You might want to find a picture of wood on Google or something and use it as a material so that instead of a cone with bricks it looks like wood. I’ll show you how to do this later. You can change that design by using the material and matref. These two work together. Material is where you define the material. And matref is where you reference the material you defined. Let me show you...
+
 
+
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 (i used above). You can check the rest out by going to that folder. You can also add your own. Any picture you add must be in a .png format. I suggest just taking a screen shot of a picture you want to use, such as, the wood picture to make a tree trunk. Most screen shots are .png formats. (At least mine are) you can name that what ever you want as long as it has a .png in the title and no spaces. Then put it in the same folder as the rest of the images in the resource folder. You may now reference those images by typing matref (name of image.png)
+
 
+
Also you probably noticed I typed meshbox, not box. To enable the material or physics it must be a meshbox. A meshbox is a box just like a "box" however it enables things such as materials and physics. The same goes for pyramids. You must type meshpyr to get a pyramid with a material on it or physics. However objects such as spheres cones and arcs don't need do have the word mesh in front of them.
+
 
+
Also a really cool thing is diffuse. You can add the diffuse command and it will look like this diffuse 1 1 1 1. Those four numbers represent things. 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. Now the fourth number is cool. It is the opacity or transparency. The see through-ability I call it.  0 is invisible .5 is half invisible 1 is normal. If you use this I suggest using the texture mesh.png only because it looks the best however you can use that option on any texture. so it would look like the code below. (For default images you don't have to say .png but I suggest getting in the habit of doing it.)
+
 
+
material
+
  name mat1
+
  diffuse .5 .25 .1 .6
+
  addtexture mesh.png
+
end
+
 
+
So the best way of thinking about a material or rather a meshbox is NOT this– A mateial isn't something you put on as a skin to a box. A meshbox is a different type of box that allows the use of a material or physics. So lets cap up materials
+
 
+
 
+
 
+
material <you must type material
+
  name mat1 <you must give it a name so that you can reference it, the name may be any thing as long as there are no spaces and ends in .png. I named it mat1
+
  addtexture <add a texture name you may find in the folder I specified simply by  typing the file name of that image.
+
end <must use end
+
meshbox <this alows for a box to use the material above
+
  position x y z
+
  size x y z
+
  rotation 0
+
  matref mat1<referencing the material to the name mat1 so that this box will have the properties of the material specified.
+
end <must use end
+
 
+
Similarly, lets make a mesh pyramid (a pyramid with different images on it)
+
 
+
meshpry <this alows for a pyramid to use the material above
+
  position x y z
+
  size x y z
+
  rotation 0
+
  matref mat1 <referencing the material to the name mat1 (note, I can have several material listed above with different names and reference them as I want with different objects
+
end <must use end
+
 
+
And the same for an arc, cone and sphere, this time without the mesh in front of the name
+
 
+
sphere
+
  divisions 128
+
  position
+
  size
+
  rotation
+
  matref mat1
+
end
+
 
+
Done with materials.
+
 
+
Lets move on to phydrv and physics
+
 
+
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... well 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, that's the only way I can explain it. Whichever way the tank is moving it will keep moving that way. A good example is in ... I forgot the exact title, but it's the "wide world even wider" on the sides if you go up top there is a slide physics.
+
 
+
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.
+
 
+
Now you know how to write a physics you have to be able to reference it.
+
Let me show you the code
+
 
+
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
+
  
I hope this helped. As you get more advanced into making maps by hand you will start doing meshes and "tetra" which is a tetrahedron. <I think that's how you spell it. I’m willing to explain meshes but it's much more complicated and would be easier to explain in a conversation.
+
===Helpful links===
*flight
+
* [[Comparison of map editors]]
 +
* [[Comparison of map objects]]
 +
* [[Map FAQ]]
 +
* [[Map making]]
 +
* [[Texturing how to]]
 +
* [[World units]]
  
 +
[[Category:Tutorials]]
 
[[Category:Map Making]]
 
[[Category:Map Making]]
 +
[[Category:Partial Documentation]]

Latest revision as of 20:38, 15 February 2017

Plywood hammer100x101.gif 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.

Editing by hand is still a common way of creating maps. Although there's a number of GUI options for creating maps such as BZEdit, BZWTools, BZFed, PyBZEdit and IBZEdit. Many map-makers use a basic text-editor. This can be due to the enjoyment of the challenge of creating a map by hand or due to a lack of graphics modeling capability.

Text Editors[edit]

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. If you are interested in syntax highlighting, look at the forum topic.

Windows[edit]

  • Notepad
  • PSPad
  • NoteTab
  • Notepad ++ - a tabbed editor based on Scite.

Mac[edit]

  • TextWrangler
  • TextEdit

Linux[edit]

  • Command-line editors such as nano, emacs, pico, vim, or ed.
  • GEdit
  • Kate
  • Scite

Editing existing maps[edit]

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. One can gain experience by also converting map objects into their mesh equivalents such as converting a box into a meshbox or a pyramid into a meshpyramid.

Getting Started[edit]

One should become familiar with the BZW syntax before attempting to create a map by hand from scratch or have on hand a reference card. Also knowing the coordinates of where object placement(s) will occur based on the options set. The way world units are oriented in a normal right hand rule coordinate system with positive Z being the "UP" direction. "north" on the in game radar is the positive Y direction in map coordinates. This image shows a typical map, with the origin and axis directions clearly marked out. MapCoordinateSystem.png

The positioning of map objects in the "position" of an object goes as such. The first setting is for the "X" axis with the second being for the "Y" axis and the third being for the "Z" axis. The same applies to the "size" in a world object.

A good way to start learning is to begin with simple world objects and settings:

# Example world with settings and box
# The number sign is not needed for a map to function, but is used for comments.
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 

Example map explained[edit]

First, it says:

# Example world with settings and box
# The number sign is not needed for a map to function, but is used for comments.

(Note: the # sign is used for comments.)

This is many times added by map editors, but with different comments.(depending on editor)

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> (The BZFlag arena).

Next is an <options> section:

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 allows you to define in the map file certain options that are also available from the command line when you start the bzfs server, or in the optional server config file. Options embedded into a world file will override those input on the command line or in a config file.

The commands listed here are: Ricochet, Jumping, Tank speed, Max Shots, and Max Players. These are rather self explanatory, except for Max Players. Each number represents how many of each of the following team players are allowed in the game (in the order listed): Rogue, Red, Green, Blue, Purple, Observer. Each number defines the max number of players per category.

For more info, 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[1]. The rest is pretty self explanatory.

Important: EVERY STATEMENT MUST HAVE AN END. If a statement does not have an end you will get an error.

Basic Definitions[edit]

Objects
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.
Comments
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.)

Optional client setup[edit]

There are some options that appear useful when editing a map, especially when editing by hand.

showCoordinates
The BZFlag client is capable of displaying a tank's current location for the player at the top right corner, right below the clock. This feature is being activated by executing the "/localset showCoordinates 1" command to the chat line.

Building World Objects[edit]

In order to build maps, one must know the world objects used in them. The table below provides an overview of the map objects which exist in BZFlag.

Map Object Description
Arc Arc is an object that defines an arc or cylinder in a map.
Base Base is an object which is similar to a box, but defines properties of it being a base for capture the flag style game play modes.
Box Box is an object which defines a cube structure in a world file.
Color(BZW) Color is used in a BZFlag world (BZW) as a sub parameter for many parameters, such as materials and dynamic colors.
Cone Cone object is a BZW object that defines a cone in a BZW world file.
Define Group Definition, or define, will group a set of objects that can be recalled and duplicated multiple times with the group object.
DrawInfo DrawInfo allows clients to render the mesh object more efficiently through LODs (Levels of Detail). Drawinfo also allows the ability to create moving objects in a map.
DynamicColor DynamicColor describes how a color channel will be dynamically updated.
GroundMaterial GroundMaterial is an option for a Material that allows one to set the ground texture. .
Group Group allows one to bring together a number of elements and refer to them as a single object.
Include Include is an option which allows one to specify a second bzw file that will be included in the first bzw.
Link Link is an object which creates a link (route) between two teleporters.
Linkmaterial LinkMaterial allows one to set the texture of the teleporter window to anything one would like it to be..
Material A material is used in a BZFlag world to define a new look for otherwise regular objects, such as meshboxes.
Mesh Mesh is an object which defines an arbitrary three dimensional shape.
Meshbox Meshbox is an update to the original Box object and supports features such as physics drivers and textures.
Meshpyr Meshpyr is an object that constructs a specialized mesh that has the geometric appearance of a Pyramid.
Options (object) Options object is a BZW map structure that defines various options for a server to use when running a map.
Physics Physics, or Physics Driver, is an object when applied to another object, will affect a tank touching it in some way.
Pyramid Pyramid is a BZW map structure that defines a polyhedron having a polygonal base and triangular sides with a common vertex in the world.
Sphere The sphere is an Object that defines a sphere in a map file.
Teleporter Teleporter is an object which transports the user to another teleporter in a different part of the world.
Tetra Tetra is an map object which creates a polygon with four vertices.
TextureMatrix TextureMatrix, or texmat, when applied to a material object, allows you to define how a texture will appear in a material.
WaterLevel WaterLevel is an object that defines a plane of water that spans the entire map. WaterLevel is deadly to all tanks that cross it.
Weapon (object) Weapon object is a BZW map structure that defines a fixed weapon effect.
World (object) World object is a BZW map structure that defines various options for the map.
Zone Zone is a rectangular BZW map structure for spawn or flag zones.

See also[edit]

Map Editors[edit]

BZEdit BZEditWin32 BZFed BZWTools DI-Machine
IBZEdit Modeltool PyBZEdit Wings3D

Map Objects[edit]

Arc Base Box Color(BZW) Cone Define DrawInfo
DynamicColor GroundMaterial Group Include Link Linkmaterial Material
Mesh Meshbox Meshpyr Options (object) Physics Pyramid Sphere
Teleporter Tetra TextureMatrix WaterLevel Weapon (object) World (object) Zone

Helpful links[edit]