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

Difference between revisions of "Category:Map Making"

From BZFlagWiki
Jump to: navigation, search
(Editing by Hand)
(Editing by Hand)
Line 238: Line 238:
 
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.  
 
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.  
  
If you have any more questions my email is dirtbikerdude_91@yahoo.com  
+
If you have any more questions my email is dirtbikerdude_91@yahoo.com
 +
 
 +
callsign flight
  
 
I’m happy to answer any questions that I am capable of answering.
 
I’m happy to answer any questions that I am capable of answering.
  
 
[[Category:Server]]
 
[[Category:Server]]

Revision as of 21:01, 27 June 2007

BZFlag uses its own map file format called the BZW file. BZW files are text based and contain a list of objects and map options that are read by the BZFS server.

Map Creation Methods

BZFlag has several well practiced methods for the design of maps, from simple text editing, custom editors, to exporters for 3D modeling software. While basic dedicated map editors, such as BZEdit, can often only create simple objects, 3D modeling software can create complex custom mesh objects, but have a much steeper learning curve.

Dedicated Map editors

Dedicated BZFlag map editors (i.e. written specifically for graphically editing BZW files) generally go by the name BZEdit. There are a number of versions of BZEdit that have been developed over the years, some of them sharing code, some of them not. Each editor has its own level of support for various map features. At this time there is no custom editor that supports every feature of the BZW format. In general, these will only support simple map objects such as a box, a pyramid or a teleporter.

Editors supporting BZW 1.10 features

Editors supporting some BZW 2.0 features.

Blender

The blender 3d modelling application features a plug-in called BZWTools, which enables blender to read and write the BZW file format and to create BZW specific objects. This is the preferred method of creating and editing BZW 2.0 map files. Tutorials on using blender (not specific to BZFlag) can be found on the blender web tutorials pages.

Wings 3D

Wings 3D is a good modeler to use if you're new modeling. It has a much smaller learning curve than Blender, although it doesn't have as many features. There is also a plugin (which you can download here) created by trepan which allows you to export objects to a BZW file. It is not widely know that you can export a bzflag map from the actual bzflag client in .obj format. To do so, you must connect to a server hosting the BZW map you would like to download and type /saveworld -o "mapname.obj". This will allow you to then import the .obj file into Wings 3D and edit the map. Then you can use the exporter created by trepan which allows you to export objects to a BZW file.

Creating BZW files via scripting or trivial programming

Several of the existing BZFLAG maps are created using a trivial application custom created for the purpose of generating each map. The application/program consists of print statements that output BZW file primitives (boxes, pyramids, meshes). This method, using Perl, visual basic or C, allows re-use of the print statements with variables, for relatively fast creation of nearly identical objects. Once a coder creates a box primitive, for instance, another box can be created with a simple call to the same set of print statements but with different size or location arguments. The sets of print statements are then collected by the coder to create a library of available primitives (box, cylinder, fancy-teleporter, cage) that can be used again and again. The library of primitives may then be used to create additional maps but without all of the original work required to make the first map. The flaws in using this method compared to a graphical modeller or even bzedit are: representation of the work are not available without first launching a bzflag client to look at the map; Errors in the library or in calls might make the map unusable but with only visual basic, Perl or C compiler output as a clue; The map is created in a text and syntax intensive process that may not be tollerated by many otherwise creative individuals.

The advantage of this method is that the library is relatively easy to improve compared to bzedit and new features of bzflag are easily applied. In addition, the ability to replicate structures in a for-next loop context allow for repetitive or stepped structures with more rapidity than other mapping methods.

Editing by Hand

The last method of creating maps is simply coding them by hand as text files using the raw BZW structures. This is still one of the most common ways that people create and edit maps, and can be very fun and challenging. This is easilly done in any text editor, for example NotePad on Windows, and TextEdit on Mac OS X.

Most maps made by hand tend to be fairly simple, though experienced mappers have made some extraordinary maps in this way. The reason for the popularity of the 'hand made' approach is partly because of the simple structure of the BZW code, but also the fact that, until recently, there were no graphical editors available for operating systems like Mac OS X.

Maps that contain 2.0 objects (such as mesh) tend to have been either completely made in a text editor, or partly modeled in 3D modeling software, and later manipulated in text format.

below in the article section there are hyperlinks taking you to different objects such as cones and arcs and what not. i will write explinations on how to make complex objects and what most of the options do such as angle ratio and matref and phydrv and all that stuff. ___________________________

complex shapes and options such as cones spheres meshes materials and physics can not be done in bzedit. blender or wings3d have been mentioned to make these shapes, and while these are GREAT apps they tend to be very difficult to learn! May I suggest doing what I like to do. Code things by hand. I think it’s kind of fun although it may not sound to fun haha. It isn't as easy as bzedit but in my opinion is much easier than learning blender or wings3d.

What you can do is create something in bzedit. Save it. Go to that file right click on it and open it with notepad or textedit on a mac. It should have what you created, but typed in code. That is where you can add any objects you can possibly imagine.

I’ll explain very briefly how to write a simple box in "code"

If you have created lets say a box in bzedit and opened the file in notepad you will see maybe #created in bzedit (date and all that) well any thing after a # sign the computer will ignore. You can put notes using the # this will prove to be helpful in some cases!! You will also notice the rest of the code will look something like this

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 

the fist thing you may notice is that every thing is called. Such as world or options, or box. You must write that down to let the computer know what you are about to create; as well as after every object there is an end command. This must be used. Also CHECK SPELLING! The most stupid spelling mistake will keep the server from launching. All the options and what not... well there are bazillians of options that I won't explain here but I’ll give you a link.

http://my.bzflag.org/w/Server_Variables

Put those in the options setting with "-set " in front of it. You can also make those changes as an admin by using /set _variable

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. I’ll explain most of the complex shapes later in the post.

Incase the article hyperlinks below confuse you, (because I know it confused me) I’ll let you know the only real things you need to make a cone is divisions, position, and size. Divisions basically make the cone smoother. 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. Position I assume you know what position is. Size I assume you know what that is too, how ever you should know that you can make a cone that's more of a oval 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.

cone 
  name cone1 <name is optional, but it helps  you.
  divisions 128 
  position 0 0 0 
  size 10 10 20 
end 

there are other options such as shift shear scale spin angle smoothbounce and flatshading and probably many more. Those options I’m not sure what they 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 cones case doesn't matter really what way it's rotated, angle, which basically allows you to make maybe half of a cone. If you say angle 180, that would make half a cone. Angle 90 would make 1/4th of a cone and so on. To add one of these simply type in angle <number> somewhere under "cone". I also know how to use phydrv and matref. I’ll show you how to use those later in this post. For now lets move on to arcs

An 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 lets 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. phydrv and matref I’ll show later. Lets 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 :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 as 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? I have a Mac so I can say how to get there for any one using a Mac. This won't apply to a PC user. but this might help a little. Maybe someone else with a PC could explain the path better.

If you control click (right click) on the bzflag icon and click show package contents and click on contents and click on resources those are the pictures you may use.

The path will be different on a PC. I don't know what it is. 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.

If you have any more questions my email is dirtbikerdude_91@yahoo.com

callsign flight

I’m happy to answer any questions that I am capable of answering.

Subcategories

This category has the following 2 subcategories, out of 2 total.