Blender for maps...
by Frank Samuelson · in Artist Corner · 03/21/2004 (7:30 am) · 35 replies
Does anyone know if it possible to use blender to make .map files that can be converted to .dif files, or is it possible to go directly blender->.dif? I'm not especially keen on learning another 3D editor. Does a map file editor even exist for Linux?
Thanks for any help.
-Frank
Thanks for any help.
-Frank
#2
The current linux solutions for .map editing on linux that i am aware of are :
Quest
www.quest-ed.sf.net
Pros: Open source, written in c.
Cons: Source doesn't compile out of the box. Some features buggy. Uses 8bit display (yuck). Not much documentation. Odd interface.
Radiant
www.qeradiant.com
Pros: Decent native map editor, many tutorials available.
Cons: Licensing issues for commerical games (as in, you need to pay ID $$$$ to license the tools to use them for anything other than quake games).
Quark
www.planetquake.com/quark
Pros: Used to make maps for marble blast; Torque support; Supported by GG
Cons: Some people do not like the interface; Written in delphi; Needs wine to work in linux(though a howto to get it running is on the site);
Others
There are probably many other .map editors that i haven't talked about. google around to find them :)
It is possible to make .map files in blender; Though you need to write an export script to do so. (Remember, you must use convex shapes).
The easy part is exporting the brushes. The hard part is doing everything else :)
03/21/2004 (8:32 am)
Frank,The current linux solutions for .map editing on linux that i am aware of are :
Quest
www.quest-ed.sf.net
Pros: Open source, written in c.
Cons: Source doesn't compile out of the box. Some features buggy. Uses 8bit display (yuck). Not much documentation. Odd interface.
Radiant
www.qeradiant.com
Pros: Decent native map editor, many tutorials available.
Cons: Licensing issues for commerical games (as in, you need to pay ID $$$$ to license the tools to use them for anything other than quake games).
Quark
www.planetquake.com/quark
Pros: Used to make maps for marble blast; Torque support; Supported by GG
Cons: Some people do not like the interface; Written in delphi; Needs wine to work in linux(though a howto to get it running is on the site);
Others
There are probably many other .map editors that i haven't talked about. google around to find them :)
It is possible to make .map files in blender; Though you need to write an export script to do so. (Remember, you must use convex shapes).
The easy part is exporting the brushes. The hard part is doing everything else :)
#3
It sounds as though you may have an idea about what needs to be done. Could you clue me into what you are thinking? Blender exports scripts I've done; with .map files I am not familiar.
03/21/2004 (1:02 pm)
It is possible to make .map files in blender; Though you need to write an export script to do so. (Remember, you must use convex shapes). The easy part is exporting the brushes. The hard part is doing everything else :) It sounds as though you may have an idea about what needs to be done. Could you clue me into what you are thinking? Blender exports scripts I've done; with .map files I am not familiar.
#4
03/21/2004 (1:10 pm)
Theres more to making a map file than just spitting out geometry as I understand it. There is a "compilation" process in map editors that calculates all sorts of things like portals, lighting, builds the BSP tree, etc.
#5
But a QuArk con to me: you can't manipulate vertices.
03/21/2004 (1:24 pm)
"written in Delphi" is a pro to me, hehe...But a QuArk con to me: you can't manipulate vertices.
#6
03/21/2004 (1:26 pm)
Actually, that's the map2dif stage, which is already solved. The hard port would be getting Blender to export the .map. If you can do that you'd be golden.
#7
Could you tell me what "map" version (if there is such a thing). I took a quick look on the web, but have not found the "map" file format. Is there a document in the Torque engine as to what the format should look like? It seems to me that some of the blender to dts code could be reused to make a "map" exporter.
Also, would a "dif" object be appropriate for arches that are mostly outside like in a colloseum? I am planning on making a huge colloseum and started making "dts" arches. They look good, but was looking into "difs" to save time? I was thinking that maybe I would just make a huge "dts". Is this going to have a performance hit compared to "dif"?
I agree with Frank S. that being able to use Blender for "dif" files would greatly reduce the learning curve to making "dts" and "dif" files.
Thanks,
Frank
03/21/2004 (9:46 pm)
Hello,Could you tell me what "map" version (if there is such a thing). I took a quick look on the web, but have not found the "map" file format. Is there a document in the Torque engine as to what the format should look like? It seems to me that some of the blender to dts code could be reused to make a "map" exporter.
Also, would a "dif" object be appropriate for arches that are mostly outside like in a colloseum? I am planning on making a huge colloseum and started making "dts" arches. They look good, but was looking into "difs" to save time? I was thinking that maybe I would just make a huge "dts". Is this going to have a performance hit compared to "dif"?
I agree with Frank S. that being able to use Blender for "dif" files would greatly reduce the learning curve to making "dts" and "dif" files.
Thanks,
Frank
#8
The .map format is a standard text format exported by most Quake map editors. You can open it with notepad to see how it works. Integrating map2dif directly with blender would be a bad idea.
03/21/2004 (10:35 pm)
DIFs are appropriate for any buildings.The .map format is a standard text format exported by most Quake map editors. You can open it with notepad to see how it works. Integrating map2dif directly with blender would be a bad idea.
#9
Back to to the performance issues. Is "dif" faster? I noticed my frame rates in a "dif" structure go way up when inside. So I guess it would be faster. I guess my question is: Is "dif" faster when the structure is substantially open so that the terrain engine is in view most of the time?
Thanks,
Frank
03/22/2004 (8:04 pm)
Let me correct myself. Using Blender to create "map" files would be good. You are correct that "dif" files would be bad due to the BSP trees that would have to generated among other things. That is the one area of Doom I stayed away from when looking at the source code for it.Back to to the performance issues. Is "dif" faster? I noticed my frame rates in a "dif" structure go way up when inside. So I guess it would be faster. I guess my question is: Is "dif" faster when the structure is substantially open so that the terrain engine is in view most of the time?
Thanks,
Frank
#10
And you're right, an interior only speeds up framerate when the outdoors is not visible. So a substantially open one wouldn't help much. But it is still a lot better suited for collisions and stuff than a shape would be, so it's still probably a good idea.
03/23/2004 (12:07 am)
Exporting "map" files out of blender would be pretty easy. But the level designer would have to make sure every shape was convex, because that's what map2dif expects. Making a exporter that split the blender scene into convex brushes is much harder.And you're right, an interior only speeds up framerate when the outdoors is not visible. So a substantially open one wouldn't help much. But it is still a lot better suited for collisions and stuff than a shape would be, so it's still probably a good idea.
#11
03/23/2004 (4:07 pm)
You're right, it looks relatively simple, and so I have started working on it. I may ask for assistance along the way.
#12
Let me know how I can help you. I will test anything you want. I am not very versed in Python, but I can wade through it. I got an article on the map format that describes how faces are constructed from the map format. It has other stuff in it too about the map format, plus has a bunch of code:
http://collective.valve-erc.com/index.php?go=map_format
There is a link to the actual code and code at the bottom of the article. Again, let me know how I can help you. I am setup and have modified the current exporter to fix some little things. I have also looked through the Blender Python API.
I was thinking about trying to add map export buttons in a different window under the current exporter.
Thanks,
Frank
03/23/2004 (7:56 pm)
Frank S.,Let me know how I can help you. I will test anything you want. I am not very versed in Python, but I can wade through it. I got an article on the map format that describes how faces are constructed from the map format. It has other stuff in it too about the map format, plus has a bunch of code:
http://collective.valve-erc.com/index.php?go=map_format
There is a link to the actual code and code at the bottom of the article. Again, let me know how I can help you. I am setup and have modified the current exporter to fix some little things. I have also looked through the Blender Python API.
I was thinking about trying to add map export buttons in a different window under the current exporter.
Thanks,
Frank
#13
The tricky thing is to calculate the texGen's. I have not yet found a solution for generating them from the blender UV coords.
Remember, there are 2 texGen's; one for the u axis, and one for the v axis. Each texgen specify's a normal, and a shift value.
If you want a flat texture on your face, make the texGen normals perpendicular to the face normal on both axis.
04/10/2004 (2:20 pm)
Extremely simplistic map brush exporter :planeFormat = "( %d %d %d ) ( %d %d %d ) ( %d %d %d ) %s [ %f %f %f %f ] [ %f %f %f %f ] 0 1 1\n"
print "{"
# Add worldspawn entity params here
for o in Blender.Object.Get()
if o.getType() == "Mesh":
msh = o.getData()
print "{"
for f in msh.faces:
vert1 = f.verts[0]
vert2 = f.verts[1]
vert3 = f.verts[2]
print planeFormat % (vert1[0], vert1[1], vert1[2], vert2[0], vert2[1], vert2[2], vert3[0], vert3[1], vert3[2], "default", 0,0,0,0,0,0,0,0)
print "}"
print "}"The tricky thing is to calculate the texGen's. I have not yet found a solution for generating them from the blender UV coords.
Remember, there are 2 texGen's; one for the u axis, and one for the v axis. Each texgen specify's a normal, and a shift value.
If you want a flat texture on your face, make the texGen normals perpendicular to the face normal on both axis.
#14
04/10/2004 (7:30 pm)
Nifty, James. I'd love to see an example of a map exported this way. :)
#15
So far my script breaks up meshes into parts that are joined by faces and turns the parts into brushes. In this way a mesh can be made from of a number of unconnected convex shapes. Each shape is checked for convexness before being exported and is skipped if not convex. All shapes/brushes of a mesh are put in the same entity.
What I need to accomplish:
-Figure out the UV->texture conversion.
-Convert the blender realtime properties in to entity properties.
I would be nice to create some autobreaking of meshes to convex shapes. From what I've read there is no one way to do this well and thus would probably involve some sort of semi-exhaustive search that eats up lots of cpu.
If someone else figures out how to convert the uv textures, that would be great too. :)
04/11/2004 (1:49 pm)
Yes, the UV coords -> texGen conversion is the most difficult/complicated part of this. Especially because I'm having difficulty understanding the .map format texture values due to lack on information on them. Anybody got some good links that explain it really well?So far my script breaks up meshes into parts that are joined by faces and turns the parts into brushes. In this way a mesh can be made from of a number of unconnected convex shapes. Each shape is checked for convexness before being exported and is skipped if not convex. All shapes/brushes of a mesh are put in the same entity.
What I need to accomplish:
-Figure out the UV->texture conversion.
-Convert the blender realtime properties in to entity properties.
I would be nice to create some autobreaking of meshes to convex shapes. From what I've read there is no one way to do this well and thus would probably involve some sort of semi-exhaustive search that eats up lots of cpu.
If someone else figures out how to convert the uv textures, that would be great too. :)
#16
This is hands down the best reference for the Valve220 .map format that I have found (I mirrored it on my site b/c it can be hard to find on the Internet these days). It covers going from TexGen->UV but with a little work you could figure out how to go from UV->TexGen (I have to write code for that sometime soon if you are willing to wait).
Devolving a polysoup mesh into a set of convexes isn't easy but it also isn't too bad. Generating a useful set of convexes for the TGE engine is a whole different issue though. The worst case scenario of having all every triangle represented as a single convex can lead to very, very *bad* performance. In the end it is easier to just have a convex or two approximate the shape.
04/12/2004 (4:58 am)
www.rustycode.com/matt/MAPFiles.pdf.zipThis is hands down the best reference for the Valve220 .map format that I have found (I mirrored it on my site b/c it can be hard to find on the Internet these days). It covers going from TexGen->UV but with a little work you could figure out how to go from UV->TexGen (I have to write code for that sometime soon if you are willing to wait).
Devolving a polysoup mesh into a set of convexes isn't easy but it also isn't too bad. Generating a useful set of convexes for the TGE engine is a whole different issue though. The worst case scenario of having all every triangle represented as a single convex can lead to very, very *bad* performance. In the end it is easier to just have a convex or two approximate the shape.
#17
www.gamers.org/dEngine/quake/QuakeEd/map_example.html
04/12/2004 (8:29 am)
Another, older and shorter view on the .map file format is here:www.gamers.org/dEngine/quake/QuakeEd/map_example.html
#18
I'm a professional software engineer, although I don't know perl or blender all that well and I'm new to torque, I'm motivate to do what I need to do to make an exporter. I have Mac OS X and I'm not willing to buy the PC emulator and to buy Windows just to create .map files. I'm not willing to get 10.3 yet so QERadient is out.
I'm motivated to get this to work and if others are as well then let's come up with a plan and an effective way that would allow us to pool our efforts together. This doesn't have to be just programmers, it could be people who are well versed in the map format or blender.
Let me know if your interested.
04/19/2004 (5:30 am)
It seems that there is some duplication of effort happening. I suggest that we find a way to pool our resources together and find a way to develop a .map exporter for blender. If someone is able to provide a wiki or some other type of resource that would allow us to collaborate on the exporter.I'm a professional software engineer, although I don't know perl or blender all that well and I'm new to torque, I'm motivate to do what I need to do to make an exporter. I have Mac OS X and I'm not willing to buy the PC emulator and to buy Windows just to create .map files. I'm not willing to get 10.3 yet so QERadient is out.
I'm motivated to get this to work and if others are as well then let's come up with a plan and an effective way that would allow us to pool our efforts together. This doesn't have to be just programmers, it could be people who are well versed in the map format or blender.
Let me know if your interested.
#20
04/19/2004 (10:03 am)
Hey Joe. I don't know anything about coding or the .map format. But I'm pretty experienced in blender. So I can easily test stuff for you. And I can also test the exported .map files since I'm also running linux aside from my main osx machine. I also had gtkradiant installed and working on osx. But I did a reinstall so I lost it. But if need be, I can reinstall it. Do you have msn or aim? My msn is spindude1@hotmail.com and my aim is blackdragon4@mac.com
Shadowdragon