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

Editing Map making by hand

Jump to: navigation, search

Warning: The database has been locked for maintenance, so you will not be able to save your edits right now. You may wish to copy and paste your text into a text file and save it for later.

The administrator who locked it offered this explanation: Archived wiki

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 124: Line 124:
  
 
==Building World Objects==
 
==Building World Objects==
In order to build maps, one must know the world objects used in them.
+
We're getting to the part of building world objects in a map.
The table below provides an overview of the map objects which exist in BZFlag.
+
Most of the objects covered are quite simple to understand and program into a map.
{|{{Prettytable}}
+
The first objects covered are the simple objects.
|-
+
The overview will first deal with boxes then move onto bases and then to pyramids.
| {{Hl3}} |'''Map Object'''
+
===Box===
| {{Hl3}} |'''Description'''
+
Perhaps the simplest object is the box.
|-
+
Here is an example of a box:
|  [[ Arc]] ||  Arc is an object that defines an arc or cylinder in a map.
+
[[Image:BoxeAppearance.png|thumbnail|399px|right|Default boxes]]
|-
+
The code for a box object is as follows
| [[ 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.
+
  box
|-
+
  position 10 20 30
|  [[Color(BZW)]]  ||  Color is used in a BZFlag world (BZW) as a sub parameter for many parameters, such as materials and dynamic colors.
+
  rotation 45 (rotation is optional and does not have to be included)
|-
+
  size 1 2 3
|  [[Cone]]  ||  Cone object is a BZW object that defines a cone in a BZW world file.
+
  end
|-
+
|  [[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.
+
 
|}
 
|}
 +
Valid parameters for a box are
  
==See also==
+
;position: defines the center of the box in X and Y and the bottom of the box in Z.
===Map Editors===
+
;rotation: defines a rotation around the Z axis for the box, in degrees.
{| class="wikitable" style="margin-right: auto; margin-left: 0px;"
+
;size: defines the distance from the center to the side of the box in X and Y, and the total height of the box in Z.
| [[BZEdit]]
+
;drivethrough: lets a player drive into a box without the oscillation overthruster flag.
| [[BZEditWin32]]
+
;shootthrough: lets a player shoot into the box without the super bullet flag.
| [[BZFed]]
+
 
| [[BZWTools]]
+
===Base===
| [[DI-Machine]]
+
The base is a common object and is included in many maps.
|-
+
The base allows for the CTF game mode to be implemented.
| [[IBZEdit]]
+
[[Image:BasesAppearance.png|right|frame|300px|Base Appearance]]
| [[Modeltool]]
+
The code for a box object is as follows
| [[PyBZEdit]]
+
{|
| [[Wings3D]]
+
|
|
+
base
 +
  position 10 20 30
 +
  rotation 45 (rotation is optional and does not have to be included)
 +
  size 1 2 3
 +
  color 1
 +
  oncap SW
 +
end
 
|}
 
|}
 +
Valid parameters for a base are
 +
 +
;position: defines the center of the box in X and Y and the bottom of the box in Z.
 +
;rotation: defines a rotation around the Z axis for the box, in degrees.
 +
;size: defines the distance from the center to the side of the box in X and Y, and the total height of the box in Z. A Z size of 0 creates a thin base with no thickness or walls.
 +
;color: defines the team to which the base is allocated:- 1: red, 2: green, 3: blue, 4: purple.  Because [[rogue]] is not a team, there is no such thing as a "rogue base", nor is there a rogue team flag.
 +
;oncap: if specified, indicates that a [[weapon (object)|world weapon]] with the specified [[FlagCode]] is to be automatically generated and fired whenever a flag is captured at this base.[[ShockWave]] is a very common [[FlagCode]] to use here.
 +
 +
Bases do not support the use of [[Material]] or [[Physics Drivers]].  You will have to supply the -mp and -c server directives for the bases to appear.  A team's flag is automatically spawned in the middle of their base when a minimum of one player from two or more teams have connected to a CTF game.
 +
Make sure to pay attention to the '''-mp''' options as this can lead to an error with maps.(only allow players to spawn unless they have a base in a ctf map. Rogue can be excepted from this rule if one wants to have a ctf map with rogues involved.)
 +
 +
===Pyramid===
 +
[[Image:PyraAppearance.png|frame|right|A pyramid with the default blue marble texture]]
 +
The code for a pyramid object is as follows
 +
{|
 +
|
 +
pyramid
 +
  position 10 20 30
 +
  rotation 45 (rotation is optional and does not have to be included)
 +
  size 1 2 3
 +
end
 +
|}
 +
 +
Valid parameters for a pyramid are
 +
 +
;position: defines the center of the box in X and Y and the bottom of the box in Z.
 +
;rotation: defines a rotation around the Z axis for the box, in degrees.
 +
;size: defines the distance from the center to the side of the box in X and Y, and the total height of the box in Z.
 +
;matref: reference to a predefined [[material]]. (requires [[BZFlag_2.0.9|v2.0.9]]+)
 +
;phydrv: reference to a predefined [[physics|physics driver]]. (requires [[BZFlag_2.0.9|v2.0.9]]+)
 +
;drivethrough: lets a player drive into the pyramid without the oscillation overthruster flag.
 +
;shootthrough: lets a player shoot into the object without the super bullet flag.
 +
 +
== More Complex World Objects ==
 +
===The Cone===
 +
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.
 +
 +
===The Arc===
 +
 +
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 hole in the cylinder. The bigger the number, the smaller the hole. Angle allows you to do a semicircle. Rotation, once again, isn't really needed, unless you need a semicircle that has a certain specific orientation in your map. all the options like spin and shear are the same for this object too! phydrv and matref I’ll show later.
 +
 +
The screenshot below shows three arcs.  The only difference between them is the inner radius number.  The first is set to 1, the second to .5, and the third to .1.  Notice how the texture on the top surface of the arc becomes "stretched" when the radius is less than one.
 +
 +
[[Image:Bzfi0015.png]]
 +
 +
Here is the code for the arc with the .1 ratio:
 +
 +
<pre>
 +
arc
 +
divisions 16 # number of subdivisions
 +
angle 360 # the sweep angle
 +
ratio .1 # (outrad - inrad) / outrad
 +
position 0.0 -42 0.0
 +
size 10 10 1
 +
rotation 0.0
 +
shift 0 0 0 # (repeatable)
 +
scale 1 1 1 # (repeatable)
 +
shear 0 0 0 # (repeatable)
 +
smoothbounce # ricochets use normals
 +
end
 +
</pre>
 +
 +
Now lets see what happens if we change the angle value.  The ones below use 60, 120, and 240.  This is where you would need to use rotate to get the arc oriented the way you want.
 +
 +
[[Image:Arcs.jpg]]
 +
 +
Here is the code for the 60 degree arc:
 +
 +
<pre>
 +
arc
 +
divisions 16 # number of subdivisions
 +
angle 60 # the sweep angle
 +
ratio .5 # (outrad - inrad) / outrad
 +
position 0.0 0.0 0.0
 +
size 10 10 1
 +
rotation 0.0
 +
shift 0 0 0 # (repeatable)
 +
scale 1 1 1 # (repeatable)
 +
shear 0 0 0 # (repeatable)
 +
smoothbounce # ricochets use normals
 +
end
 +
</pre>
 +
 +
 +
Let’s move to the sphere:
 +
 +
===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 [[:Category:Map Making|Map Making]] page.
 +
*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.
 +
 +
==Special Objects==
 +
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. 
 +
 +
===Materials ===
 +
Example:
 +
 +
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 <tt>addtexture</tt> and you state a texture name.  Now, how do you know what texture names there are to use?
 +
 +
'''On Linux''': Running <tt>ls /usr/share/bzflag/*.png</tt> 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 <tt>C:\Program Files\BZFlag\data\*.png</tt>
 +
 +
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 [http://images.bzflag.org/submitimages/ 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===
 +
 +
The format of the physics driver is like this:
 +
(note that not all the commands are used concurrently, there is no point in using a death driver with a linear driver, etc.)
 +
<pre>
 +
physics
 +
  name example_phydrv
 +
  linear 0.0 0.0 0.0 # x/y/z linear velocities
 +
  angular 0.0 0.0 0.0 # rotation freq, x/y coordinates
 +
  slide 0.0 # time until max velocity (> 0.0 enables)
 +
  death Message goes here.
 +
  # the 'death' property requires a non-blank message
 +
end
 +
</pre>
 +
 +
Physics drivers subject your tank to external forces.  If you have ever played laser mania by Louman then you may have encountered on the outskirts of the map an object that you can jump on and you go really fast, that is a physics driver. Physics and materials are both similar in that you must first define them, and then apply them to an object.  When you define a mesh object (regular BXFlag objects, such as boxes can't use physics drivers) you can reference that physics driver 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.  The physics driver used in the Louman map mentioned above is a linear driver.  Linear physics makes your tank move in a line.  The numbers after a linear command are how much "force" is applied in a given axis x y z, and you can have force applied in more than one axis. The direction is NOT along the axis of the object you apply the physics driver to, but along the major world axis, so if your object is rotated 45 degrees, you would need to put values for both x and y in your physics driver.  45 degrees is fairly easy, but other angles would require figuring out the proportions needed to move the tank along an object rotated to a given angle, it can get a bit tricky.
 +
 +
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 (bounce) 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.
 +
 +
example:
 +
<pre>
 +
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
 +
</pre>
 +
 +
This is applied to an object in a manner similar to that of a material.  Both physics and materials must be created in the map file before they are referenced.  The example below illustrates incorrectly placing a material definition after it is referenced by the meshbox:
 +
 +
<pre>
 +
meshbox
 +
  position 0 0 0
 +
  size 10 10 10
 +
  rotation 0
 +
  matref mat1
 +
end
 +
 +
material
 +
  name mat1
 +
  addtexture blue_team.png
 +
end
 +
</pre>
 +
 +
===Groups===
 +
A group is cluster of objects that can be "gathered together" and treated as if they were a single object.  Certain things cannot be included in groups:
 +
 +
*textureMatrix
 +
 +
*dynamicColor
 +
 +
*material
 +
 +
*physics
 +
 +
*links
 +
 +
*weapon
 +
 +
*zone
 +
 +
Notice that while teleporters aren't excluded from groups, you can't create links to teleporters within a group, except for purely random ones using "*"(asterisk) for the link. (this may not be entirely accurate, Trepan at one point hinted that there is a way around this...)
 +
 +
Groups can be nested (you can have a group that is included in another group).
 +
 +
For example if a map editor is making 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 calls that group, as shown below.
 +
 +
Example:
 +
 +
First define a group of obects as a tree...
 +
<pre>
 +
  define tree
 +
 
 +
  box
 +
  position 0 0 0
 +
  size 2 2 4
 +
  end
 +
 
 +
  pyramid
 +
  position 0 0 3
 +
  size 5 5 10
 +
  end
 +
 
 +
  enddef
 +
</pre>
 +
 +
...then, to call the "tree" group, just:
 +
<pre>
 +
  group tree
 +
  position 0 0 0
 +
  end
 +
</pre>
 +
 +
==Transformations==
 +
[[Category:Map Making]]
 +
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. You can find a more in depth page here:
 +
[[3d Transformations]]
 +
 +
====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..
 +
 +
  box
 +
  position 10 10 0
 +
  shift 0 0 10
 +
  end
 +
 +
is at position 10 10 10.
 +
 +
====Spin====
 +
Spinning an object is just like rotating an object but can be on a different axis. (y and x)
 +
When you rotate it is around the center of the object.
 +
Remember: Only spin-able objects can be spun.
 +
Here is what the code looks like:
 +
meshbox
 +
  position 0 0 0
 +
  rotation 0
 +
  size 10 10 10
 +
  spin 45 0 1 0
 +
end
 +
The meshbox will now be tilted 45 degrees on its y axis.
 +
Spin code has four numbers, the first one is how many degrees to spin.
 +
The last three are for which axis's to spin, by placing a value of more than 0.
 +
Spin can be a bit tricky and unintuitive to use.  It is not exactly like rotate, because it is possible to "spin" something so that it ends up "underneath" the BZFlag playing field.
 +
 +
Spin is often best used with shift.  Think of the center of your map as a sort of "construction yard".  You position objects at location 0 0 0, then spin and shift them to the location you want.
 +
 +
Here is what you get if you use the above code in a map:
 +
 +
[[Image:Bzfi0012.png]]
 +
 +
Looks fairly normal in this screenshot, doesn't it.  But if you drive around, the box will behave oddly, and appear to "float" in front of your HUD.  What has happened is that the box hasn't rotated around it's own axis, but around the world axis for the whole BZFlag arena!  But if we add some code to shift the box up above the z plane, it will look normal in-game.
 +
 +
So if we make a simple change to the above code and add a shift statement and shift the box up in z (this is not the z axis of the box, but the world axis of our game arena):
 +
 +
meshbox
 +
  position 0 0 0
 +
  rotation 0
 +
  size 10 10 10
 +
  spin 45 0 1 0
 +
  shift 0 0 10
 +
end
 +
 +
...we get this:
 +
 +
[[Image:Bzfi0013.png]]
  
===Map Objects===
+
... and the box doesn't do the weird "float" thing any more.  This "construction yard" technique is really handy, you just "build" your stuff smack in the middle of your map, then spin and shift it to where you want it (in the example above, it could have been shifted in x and y as well.  Just don't shift and then spin, or you will be back to having things "float" again.
{{Template:Map objects}}
+
  
===Helpful links===
+
With shift and spin you can also work with groups and make a "master" group in the middle of your map, then shift and spin multiple copies to other locations on your map.
* [[Comparison of map editors]]
+
* [[Comparison of map objects]]
+
* [[Map FAQ]]
+
* [[Map making]]
+
* [[Texturing how to]]
+
* [[World units]]
+
  
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
 
[[Category:Map Making]]
 
[[Category:Map Making]]
 
[[Category:Partial Documentation]]
 
[[Category:Partial Documentation]]

Please note that all contributions to BZFlagWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BZFlagWiki:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)