New Tool: Hlfix

JedediahJedediah Join Date: 2003-01-27 Member: 12847Members
edited April 2003 in Mapping Forum
<a href='http://extension.ws/hlfix/' target='_blank'>http://extension.ws/hlfix/</a>

hlfix is a tool that converts Worldcraft/VHE format files (.rmf) to standard .map files. In the process, it performs a number of geometric operations to fix common problems with brush geometry. hlfix is far more sophisticated than VHE's built-in map export feature. The purpose of this tool is to give map designers much greater flexibility in the type of geometry they use to build their maps.

Comments

  • KageKage Join Date: 2002-11-01 Member: 2016Members
    edited April 2003
    <!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->To begin with, hlfix outputs floating point coordinates to .map files as opposed to VHE which rounds all coordinates to integers. This alone solves a number of typical mapping problems.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    This was the main thing I was looking for.

    This might help a few mappers... too bad it's still beta, though.

    Edit: Now with less jubilation!
  • tommy14tommy14 Join Date: 2002-11-15 Member: 8839Members
    check out <a href='http://extension.ws/hlfix/' target='_blank'>HLfix .rmf to .map exporting tool</a>.

    <!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->hlfix is a tool that converts Worldcraft/VHE format files (.rmf) to standard .map files. In the process, it performs a number of geometric operations to fix common problems with brush geometry. hlfix is far more sophisticated than VHE's built-in map export feature. The purpose of this tool is to give map designers much greater flexibility in the type of geometry they use to build their maps.

    To begin with, hlfix outputs floating point coordinates to .map files as opposed to VHE which rounds all coordinates to integers. This alone solves a number of typical mapping problems. hlfix also performs three phases of geometry correction:

    -Tesselating non-planar faces
    Faces that do not lie entirely in one plane are decomposed into planar polygons which approximate the intended surface.
    -Decomposing non-convex solids
    A convex brush has all it's edges "pointing" outward. Non-convex brushes are cut into convex pieces.
    -Uniting coplanar faces
    The .map compile tools do not allow a brush to have multiple faces in the same plane. Any such faces are joined together by hlfix and a warning is given if they have different texture information. <!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->

    check it out!

    <i>also, for cagey and other coders, he has a tech page and the .rmf coding format.</i>
  • blue2kblue2k Join Date: 2002-11-02 Member: 4025Members
    tut tut tommy does your enthusiam know no bounds? <a href='http://www.unknownworlds.com/forums/index.php?act=ST&f=4&t=30612' target='_blank'>http://www.unknownworlds.com/forums/in...=ST&f=4&t=30612</a>
  • tommy14tommy14 Join Date: 2002-11-15 Member: 8839Members
    didn't see that. oh well, a good thing bears repeating!
  • CageyCagey Ex-Unknown Worlds Programmer Join Date: 2002-11-15 Member: 8829Members, Retired Developer, NS1 Playtester, Constellation
    Thanks for the pointer Tommy <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
  • CageyCagey Ex-Unknown Worlds Programmer Join Date: 2002-11-15 Member: 8829Members, Retired Developer, NS1 Playtester, Constellation
    Very cool -- Valve have a comment on it yet?
  • JedediahJedediah Join Date: 2003-01-27 Member: 12847Members
    autolycus said he was going to show it around the office
  • YamazakiYamazaki Join Date: 2002-01-24 Member: 21Members, NS1 Playtester, Contributor
    The tesselating option is probably the most useful for those wanting to do organic surfaces (Like infestation growths) but hate using the slow triangle method. Just warp some blocks into the desire shape and let HLFIX do the hard work.
  • KungFuSquirrelKungFuSquirrel Basher of Muttons Join Date: 2002-01-26 Member: 103Members, NS1 Playtester, Contributor
    <!--QuoteBegin--Jedediah+Apr 28 2003, 08:38 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Jedediah @ Apr 28 2003, 08:38 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> In the process, it performs a number of geometric operations to fix common problems with brush geometry. <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    And encourages sloppy design, all at the same time! woo!

    Not to demean the efforts or anything, but floating point support is hardly the godsend so many people make it out to be...
  • taledentaleden Join Date: 2003-04-06 Member: 15252Members, Constellation
    If there was a way to have Hammer snap to a grid smaller than 1 - such as .5 and .25 - I would be more excited. But I am still excited, solely because this means I can compile completely outside of Hammer now, which is something I asked about a few weeks ago.. having to have Hammer export to map before I could run my batch compile script was annoying, and having Hammer call the batch compile using its compile interface was annoying for different reasons, so I'm happy to be able to save and close and do all the compiling afterwards.

    But I am curious what Valve will have to say on it, and what Cagey would have to say when (if) he looks at the code.
  • JedediahJedediah Join Date: 2003-01-27 Member: 12847Members
    <!--QuoteBegin--KungFuSquirrel+Apr 28 2003, 05:33 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (KungFuSquirrel @ Apr 28 2003, 05:33 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> <!--QuoteBegin--Jedediah+Apr 28 2003, 08:38 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Jedediah @ Apr 28 2003, 08:38 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> In the process, it performs a number of geometric operations to fix common problems with brush geometry. <!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    And encourages sloppy design, all at the same time! woo!

    Not to demean the efforts or anything, but floating point support is hardly the godsend so many people make it out to be... <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    There are a few things that FP support fixes on its own but mostly it is there because it's necessary for the other geometry correction. I had some very specific cases in mind when I designed this tool. When I have time, I may write an article illustrating them.
  • KungFuSquirrelKungFuSquirrel Basher of Muttons Join Date: 2002-01-26 Member: 103Members, NS1 Playtester, Contributor
    Yeah, it definitely has its uses... The thing that annoys the hell out of me is the all-too-common "whoa, I need to make things at .01422 unit intervals" or whatever when there's no logical reason to intentionally go below 1 unit increments. I guarantee you, even if the geometry were technically "half" the size it is now (i.e. 1 current unit = 2 units, with players being 144 units, etc.), there'd still be an outcry for floating point geometry...

    You'd be surprised what you can do with careful and well-placed vertices on the 1 or even 2 or 4 unit grids.
  • JedediahJedediah Join Date: 2003-01-27 Member: 12847Members
    I agree there is no reason to build things on a sub-unit scale. You still can't do that anyway because VHE doesn't let you place things off the 1x1 grid. The non-integer coordinates pop up when you stretch and rotate things and this is why transformed brushwork often gets mangled when VHE rounds to int.
  • KungFuSquirrelKungFuSquirrel Basher of Muttons Join Date: 2002-01-26 Member: 103Members, NS1 Playtester, Contributor
    <!--QuoteBegin--Jedediah+Apr 28 2003, 11:12 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Jedediah @ Apr 28 2003, 11:12 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> The non-integer coordinates pop up when you stretch and rotate things and this is why transformed brushwork often gets mangled when VHE rounds to int. <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    Indeed, but this is also where the sloppy design factor comes in. A lot of this -can- be avoided, though, either through vertex manipulation, or in some cases well-placed rotating entities.

    Regardless, it's nice to have this for the times it can't be avoided. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo--> Anyway. This is far too much waxing on theory for me at the moment - I've got work to do. <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'><!--endemo-->
  • CageyCagey Ex-Unknown Worlds Programmer Join Date: 2002-11-15 Member: 8829Members, Retired Developer, NS1 Playtester, Constellation
    <!--QuoteBegin--KungFuSquirrel+Apr 28 2003, 02:56 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (KungFuSquirrel @ Apr 28 2003, 02:56 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->You'd be surprised what you can do with careful and well-placed vertices on the 1 or even 2 or 4 unit grids.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    Yeah, and this is the case even when you stray from 45/90 degree geometry.

    With some intelligent unit transformations you can get good approximations for 6,12,16, and 24 sided objects while sticking to a 1 unit grid--if you are careful about using consistent angles by using multiples of a small line segment you'll end up with much less resource intensive (leaves, planes, etc) maps.

    Examples for a ~16 unit long line at various angles:
    0 degrees : 16,0 units in x,y dimensions
    ~15 : 15,4
    ~30 : 14,8 (also useful for 8 unit long segments)
    45 : 11,11 (I use 12,12 frequently because it's evenly divisible)

    Once you have the ratios down, you can orient things just about any way you want while maintaining exact proportions and being faithful to the grid -- by using multiples of the above segments, you guarantee that you can chop up the angled walls at regular intervals and still have your brushwork aligned to a single plane (the compiler tools will thank you)... I've almost entirely written off the in-editor rotation tool unless I'm using it for multiples of 90 degrees.

    That said, just having an independent RMF -> MAP converter that's open source is a step toward preserving visgroup information in a neutral format for other editors to import, flagging bad brushes that VHE doesn't catch, and potentially helping mappers fix problems automatically (although I definitely agree with KFS that people should be avoiding bad brushwork in the first place instead of fixing it). It also means I won't necessarily need to remember to export to .map before I run the tools in an external batch, which is something I have a mental block about... HLFix as potential IMO <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->.
  • CrAcKbRoCkCrAcKbRoCk Join Date: 2002-11-22 Member: 9619Members
    This is great. I love seeing programmers stretch HL for all its worth <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'><!--endemo-->

    Now...if only we could get a scripting language that is part of the bsp file that HL reads....mmmm, yum yum custom FX
  • JedediahJedediah Join Date: 2003-01-27 Member: 12847Members
    Actually there is no open source at the moment but I'd have no problem publishing it after I package it up a bit.
  • CageyCagey Ex-Unknown Worlds Programmer Join Date: 2002-11-15 Member: 8829Members, Retired Developer, NS1 Playtester, Constellation
    <!--QuoteBegin--Jedediah+Apr 28 2003, 03:29 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Jedediah @ Apr 28 2003, 03:29 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> Actually there is no open source at the moment but I'd have no problem publishing it after I package it up a bit. <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    My bad - if you decide to keep your code, I can always look at the format you published <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
  • JedediahJedediah Join Date: 2003-01-27 Member: 12847Members
    Source is now published.. also fixed the forums.
  • quazilinquazilin Join Date: 2002-11-25 Member: 9880Members, Contributor, NS2 Playtester, Squad Five Blue
    More promising tools for mapping, this is great. Thanks guys!
  • AsranielAsraniel Join Date: 2002-06-03 Member: 724Members, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow, Subnautica Playtester, Retired Community Developer
    im a little bit lost around here.. i see more or less what it does, but what exactly are the new possibilites that were impossible to do before? help me a bit...
  • JedediahJedediah Join Date: 2003-01-27 Member: 12847Members
    Well, what originally inspired me to make this was working on this windowed roof:

    <a href='http://silencegreys.com/sa/conf_worldcraft.gif' target='_blank'>http://silencegreys.com/sa/conf_worldcraft.gif</a>

    It got completely mangled mostly because the faces that join adjacent window segments were non-planar. I ended up having to manually split each segment into 4 tetrahedrons which was a huge hassle. What's worse is that all of the splits I made were ultimately joined by hlcsg anyway.

    The original goal of hlfix was non-planar fixing, in particular, for joining faces as in the above example. However, non-planar tesselation creates non-convex brushes, hence the decomposition phase.

    There are other cases that I know of and probably some that I don't.. as I said earlier, when I have time I'll write a tutorial or something.

    The first thing I wanted to do when I started mapping was create oddly angled objects and curved surfaces. It was very frustrating discovering that VHE effectively limits you to architecture that is much simpler than what the HL engine is capable of.
  • BlackPantherBlackPanther Join Date: 2002-02-11 Member: 197Members
    yeah when doing complex architecture like that, you need to split everything in triangles to keep it from getting errors from coplanar faces and the likes.

    Now, in my current map NS_Democles, my first hive has some serious rocky architecture, filled with triangles to make it look smooth. I wonder if this tool would help. But i doubt it.
    I try to align everything to the VHE grid as much as i can.
    I CANNOT stand seeing me map with lines that aren't straight and aligned.. unless im making rock or natural terrain.
  • tommy14tommy14 Join Date: 2002-11-15 Member: 8839Members
    now just a reminder - this is still a beta, AFAIK. and some bugs have been found. so check thru any maps you made with it carefully.

    Jedidiah did you figure out why it was renaming and retargetting buttons and such?
  • CageyCagey Ex-Unknown Worlds Programmer Join Date: 2002-11-15 Member: 8829Members, Retired Developer, NS1 Playtester, Constellation
    <!--QuoteBegin--Asraniel+Apr 29 2003, 02:35 AM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Asraniel @ Apr 29 2003, 02:35 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->im a little bit lost around here.. i see more or less what it does, but what exactly are the new possibilites that were impossible to do before? help me a bit...<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    From my post above, but in an easier to read format:
    <ul><li>preserving visgroup information in a neutral format for other editors to import
    <li>flagging bad brushes that VHE doesn't catch before its map exporter mangles the source
    <li>potentially helping mappers fix geometry problems automatically (although I definitely agree with KFS that people should be avoiding bad brushwork in the first place instead of fixing it). This has been the focus thus far.</ul>I will probably add .rmf input file support to the tools once the bugs are worked out of the HLFix source. Doing this will result in better error detection for VHE based maps and opportunities to halt on geometry errors that I can't detect now (you can add HLFix as a separate program in the compile chain in the meantime, much like opt_plns is used now).
  • The_Real_NemThe_Real_Nem Join Date: 2002-12-16 Member: 10900Members
    Posted this in a few places, but you can find a Batch Compiler Spec File supporting HLFix, ZHLT Custom Build 1.7 and MapBackup at the bottom of this page:

    <a href='http://countermap.counter-strike.net/Nemesis/batchspec.html' target='_blank'>http://countermap.counter-strike.net/Nemes.../batchspec.html</a>

    Will add a few varieties of it latter.
    ~Nem
  • AsranielAsraniel Join Date: 2002-06-03 Member: 724Members, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow, Subnautica Playtester, Retired Community Developer
    thx.. thats great.. now i just have to find the bug that makes that my VHE isnt working any more... but we will see.. perhaps im the first mapper that is mapping for HL in linux with WINE.. :-) perhaps there is no error :-)
  • YamazakiYamazaki Join Date: 2002-01-24 Member: 21Members, NS1 Playtester, Contributor
    <!--QuoteBegin--XP-Cagey+Apr 28 2003, 11:23 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (XP-Cagey @ Apr 28 2003, 11:23 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> <!--QuoteBegin--KungFuSquirrel+Apr 28 2003, 02:56 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (KungFuSquirrel @ Apr 28 2003, 02:56 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->You'd be surprised what you can do with careful and well-placed vertices on the 1 or even 2 or 4 unit grids.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    Yeah, and this is the case even when you stray from 45/90 degree geometry.

    With some intelligent unit transformations you can get good approximations for 6,12,16, and 24 sided objects while sticking to a 1 unit grid--if you are careful about using consistent angles by using multiples of a small line segment you'll end up with much less resource intensive (leaves, planes, etc) maps.

    Examples for a ~16 unit long line at various angles:
    0 degrees : 16,0 units in x,y dimensions
    ~15 : 15,4
    ~30 : 14,8 (also useful for 8 unit long segments)
    45 : 11,11 (I use 12,12 frequently because it's evenly divisible)

    <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    Not to stray too far off topic, but I've got another option to add in addition to XP-Cagey's take on angled brushwork.

    For 45 degree pieces, I rescale the texturing to 1.06 in both axis, stretch the object a bit so that the X and Y length of each line is 75% of the texture's unrotated length (ie. A texture 128x128, would have each side be 96x96, making the total brush 192x192), and this allows me to fit the object to the grid more easily.

    For example, let's say I have a floor texture that is 128x128. I want it angled at 45 degrees to represent a bend in the hallway. I slap it down, rotate it 45 degrees, then stretch it out a bit so it occupies a 192x192 area (96x96 per side). I then texture it at 45 degree rotation, with a scale of 1.06 for both x and y. Since the brush is 192x192, it fits perfectly to a grid of 32 units. The 1.06 texture stretch isn't noticable at all either.

    1.06 seems to be a magical number for 45 degree rotations, since it always fits perfectly as long as you apply the 75% rule.
  • JedediahJedediah Join Date: 2003-01-27 Member: 12847Members
    FYI new version available for download

    fixes a couple of major bugs
  • WolfWingsWolfWings NS_Nancy Resurrectionist Join Date: 2002-11-02 Member: 4416Members
    While I'm sure this is wonderful for the folks using VHE... I'm just amazed at the contortions you've all had to go through to get brushwork that's commonplace to see out of the Radiant series of editors. Gah... I'm surprised people can stand VHE and pull off as much as they do now..... KFS... I just gained a whole new level of respect for what you've managed to create to date. :-)
Sign In or Register to comment.