News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

blender level creator script

Started by BielBdeLuna, March 24, 2015, 06:38:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BielBdeLuna

I'm wondering if we could create MAP files within Blender via python scripting.

I've started coding the initial code of the scripts, I'm using this as a reference for the map format: https://modwiki.xnet.fi/MAP_%28file_format%29

how could then the UV coords for the materials be applied? it woudl be great to have the UV pre-established as in any radiant
how would entities be set? maybe create a box and have it a "custom property" announcing it's "spawnclass"?

on the bezier surfaces (patches) blender has a bezier very similar to idtech3/4

well guys what do you think?

The Happy Friar

Blender 2.49 already has a .map exporter.  I don't know if it's compatible with D3 but it does work with Q2/3.  That would be a good start to see how they did that one.

BielBdeLuna

do you have it? I've been trying to locate the most recent version of it, it should have been in a more modern Blender, but in the current version of Blender it's no longer present in the addons folder.

The Happy Friar

Here's the Blender 2.49b release downloads: http://download.blender.org/release/Blender2.49b/

Just download the one for your OS & install/unzip.   The script has some issues, like not settings verts to the grid all the time, everything is walls (no solid brushes), but it works.

BielBdeLuna

I've been toying with it, and I see that even the most recent version of that script is for quake 1 / 2 map system

quake 3 used version 2 already that stores the brush info diferently, it stores the brush face with the "face equation" and then a 3X2 matrix for the textures in this implementation:

(plane equation) ( ( xxscale xyscale xoffset ) ( yxscale yyscale yoffset ) ) "material" ?

where the plane equation is 4 numbers: 3 for normal direction and the fourth for the shortest distance to the center of the map

therefore a brush is a mesh defined not by its vertex positions but by the volume inside it's faces

so that means that the "quake map" script is useless

trebor

I've been working on a new .map format for id Tech 4 for the last weeks. I have an implementation on my private branch that works with polygons instead of brushes like Blender works.
I also modified the map compiler and the collision framework to support it. AAS support is still missing but I think I can figure out that as well.
I was able to build a valid BSP tree using triangles instead of brushes once I figured that dmap bsp surfaces only require windings and not brush sides.
I'm going to merge this back to RBDOOM-3-BFG this or the next weekend. It would be cool if I can get some support in the Blender scripting department.

My plan is to scrap the Radiant level editors completely and the first big important step is done. I thought it would be trivial but it took me another 80 hours to get it done with areaportals and everything.
My branch also features nice .map -> .obj exporters and dmap features -glview that exports several .obj files for BSP / split plane analysis in Blender.

https://www.dropbox.com/s/6vmw0dwlyebih6j/Screenshot%202015-02-23%2014.33.29.png?dl=0

https://www.dropbox.com/s/lewlkqcnduz4qf3/Screenshot%202015-03-11%2000.26.53.png?dl=0


motorsep

The effort is admirable, but getting a rid of brush based level design workflow is not wise. Even UE4 will be bringing CSG/BSP geometry back. Rapid prototyping is not possible with models.

AFAIK ETQW made it possible for AAS to use models too, which I think is a way to go. But hey, anyone can do whatever they want with their engines :-)  Good luck trebor.

BielBdeLuna

Trebor this is great news! I was thinking on adding a new brush token that used definitions for triangles instead of planes, I also think we should maintain the brush system though, because it makes prototyping a level quite easy.

argoon

#8
I also think removing BSP geometry is not wise, for whats its worth, like others said prototyping is faster, is also easier for a younger modder to mod your game, learning Radiant like tools is easier than learning blender or any other alike 3D app. Is also faster to make your map and see it ingame.

Valve didn't removed BSP they even used it has a template for their terrain system on Source, Epic didn't removed it even on UE 4 (even tho i found its BSP tools to be inferior to Radiant), Cryengine and Unity have tools on the editors that give us the ability to box map (not really BSP).       

BielBdeLuna

I've found the method by which find the distance between the surface and the origin of the map (the fourth number in the brush surface equation):

Find the tangent to the surface. Then find the equation of line perpendicular to the tangent. Substitute the points. You will get the equation of line. Find its intersection with the surface(points). Then find the distance between two points.

now i need to translate this to python and to idtech4 specifics...

motorsep

Quote from: BielBdeLuna on March 27, 2015, 12:51:16 AM
now i need to translate this to python and to idtech4 specifics...

May I ask why do you need this? If you want to make a .map file in blender and then finish it in Radiant (any flavor that works with Doom 3) then it makes no sense, sorry.

If you need some ideas to put your unending energy into a more practical direction, I have a few :-)  Solving "player gets stuck" beyond 32k units around 0 0 0 of the map is one of them. Besides the obvious solutions, there is an unfinished function in physics_player.CPP that suppose to get player unstuck. That would be a really useful fix that would help all :-)

trebor

My approach is just the next logical consequence because I don't want to maintain any crappy radiant editor and this stuff is to enhance my own productivity on the content production side.
And it only requires a new meshDef primitive definition in the .map file. You can forget to export Blender polygons to brush sides because it has tons of limitations and is error prone.
It is also obsolete because brushes are converted to windings which are equivalent to Blender N-Gons anyway. So it is better to write a .map file that contains meshes with N-Gon faces.


motorsep

Quote from: trebor on March 27, 2015, 09:02:03 AM
My approach is just the next logical consequence because I don't want to maintain any crappy radiant editor and this stuff is to enhance my own productivity on the content production side.
And it only requires a new meshDef primitive definition in the .map file. You can forget to export Blender polygons to brush sides because it has tons of limitations and is error prone.
It is also obsolete because brushes are converted to windings which are equivalent to Blender N-Gons anyway. So it is better to write a .map file that contains meshes with N-Gon faces.

Although you already settled with new approach, may I ask if you tried DarkRadiant? (I know it's not a flexible as Blender, but it seems to be the best of Radiants for Doom 3 out there).

BielBdeLuna

#13
 - dark radiant doesn't compile form me since several builds

- dark radiant displays strange geometry in the compiled builds due some kind of incompatibility between the intel GPU I have and the new framework they are using

- my time is for me to waste on whatever I want to waste it to, is what you waste your time worth the time you waste on it?

besides I get a great hardon when I solve maths problems by myself and my findings, and that REALLY suits me... is it ok? do you approve?  ;D

Trebor how do you need data structured in your implementation?

motorsep

#14
Quote from: BielBdeLuna on March 27, 2015, 11:26:12 AM
besides I get a great hardon when I solve maths problems by myself and my findings, and that REALLY suits me... is it ok? do you approve?  ;D

Oh, then you will definitely a get double (or even triple) of that by solving collision issues :)

I see your reasons for using Blender (I have similar concerns, but not really due to the same issue you have) as mapping tool.

The fundamental issue of using Blender for mapping (and exporting to .map) isn't the brushes. We already have exporter that sames .map with perfect brush work (Quake 3 .map) and making it saving Doom 3 brushes isn't that hard. The core issue is texturing these brushes, since not only there is no UV map on them, but there are no tools to do texturing in Blender like it's done in Radiant (and exporting proper texture coordinates). Another issue is lights, entities, links and bindings, etc.