Map2Curve Documentation

Last Update: March 31, 2019

1. Program Usage

This program lets you generate Arcs from Goldsource map files. It works by dropping map or txt files onto the programs executable.
Map files will have to match certain criteria, see below for further informations.

Also since the tool can not read Goldsource WAD files, you will have to create custom text files, that contain the needed texture informations for the program to function properly. See the WAD folder for further information.

Multiple files can be dropped onto the exe at once. They will be processed one after another.

2. Arc Settings Files

At the moment arcs can be generated by either dropping a map file or a previously created settings file (that has the same name as the mapfile) onto the program executable.
When dropping the map onto the exe, the program will use internal or external (default.txt in root folder) default settings for the arc generation process, instead of your own custom arc settings.

2.1. Creating Settings files

Name: A custom settings-file needs to have the same name as the *.map-File.
Comments: Any other text than commands and respective values has to be commented out -> “// Comment”
Rad: At least one “rad” command has to be inside of a settings-file.
  • The only command that is crucial to generate an ARC, is “rad”. Every rad command, stands for one arc object.
  • You can generate multiple arcs from the same map-file. To do this, just add more than one rad command.
  • The Order of the commands specifies to which arc object they belong.
  • If there are e.g. 5 “rad”-commands, you only need to specify one optional command (offset, res, type, arc, obj).
    The following arc objects then share the settings of the first arc, use default values or automatically generate them from previous values.
  • If there are e.g. more “res”-commands than “rad”-commands, the redundant res-commands will be ignored.
  • Commands can be commented out like this: “// rad 1024”

2.1.1. Examples

Setting File #1

rad 0 // Arc #1 and #2 use the original y-coordinates from source map file for their radius
rad 0 // Arc #2

arc 90 // Both arcs will only output 90 degree (25%) of the whole generated arc (360 deg)

offset 0
offset 256 // Arc #2 will be 256 units wider than #1

res 24 // Arc #1 will have 24 sides
res 0 // Arc #2 will maintain the level of detail of the first Arc.

type 0 // Both arcs will use the “Pi” method for their construction

Example1 Source

Example1 Result

2.2. Command List

Command Type Value Range Description
rad float +0 This specifies the arcs radius and is at the same time the “representative” for this arc. Each rad command stands for one arc, that is to be generated.
[rad = 0] original radius (y-coord)
[rad > 0] custom arc radius in game units
offset float +/-0 [offset = 0] additional offset on top of radius in game units
res integer 4-384 Number of arc sides. Minimum: 4.
[res = 0] Maintains “level of detail” from previous arc. Default number of sides if first arc: 8.
type integer 0-2 Construction type for the generated objects.
[type = 0] Pi Circle
[type = 1] Grid Circle
[type = 2] Path from path file (TBD)
shift integer 0-4 Horizontal texture shift mode.
[shift = 0] Nullshift
[shift = 1] Per Section
[shift = 2] Per Brush
[shift = 3] Per Brush Texture
[shift = 4] Aligned Left(Section)
height float +0 Adds custom height to each section of greater than zero (stair steps).
[height > 0] Custom height is being added to each section.
ramp integer 0-2 Creates a ramp if height command is greater than zero.
[ramp = 0] OFF
[ramp = 1] Linear Ramp Mode
[ramp = 2] Smooth Ramp Mode
round bool 0/1 Rounds all coordinates to integer numbers.
[round = 0] OFF
[round = 1] ON
tri bool 0/1 Triangulation for 6 sided brushes with planar front and back-face.
Brushes which don’t match the criteria won’t be processed and exported.
[tri = 0] OFF
[tri = 1] ON
obj bool 0/1 Exports individual arcs as OBJ files.
[obj = 0] OFF
[obj = 1] ON

3. Map Files

3.1. Brushes

  • Brushwork has to be horizontally aligned along the X-axis and can be anywhere on the map, but should be on the top side of the Y-axis. If some vertices of the map-brushes are below 0 on the Y axis, the source object will always be moved above 0 on the Y-axis for arc generation.
  • Cutting Edges have to be planar.
  • Slopes along the X-axis will lead to an invalid brush.
  • Texture Rotations other than 0, 90, 180, 270, etc. will be automatically aligned to “World”.
  • There can be Solid Entities and World Brushes in a Map file.
  • Point Entities are being ignored.

3.1.1. Brush Mesh Criteria

Mesh criteria for arc generation:

  • No sloped faces along the X-axis.
  • Planar cutting edge faces.

Valid brush lengths:
Brushes can have any length on the X-axis.

Displaced brushes qualify for arc generation

Some valid brush profiles:

Examples of valid brush profiles

Valid brush profiles for Triangulation:

Valid Brushes for Triangulation

3.1.2. Brush Positions

Position rules:
Brushes can be anywhere on the map, but will be moved above 0 on the Y-axis before arc generation.

Automove of Brushes above Y axis

3.2. Texture Rotations/Alignments

Texture-Criteria:

  • On body faces (all faces along X-axis) only the texture rotations/alignments: 0,90,180 and 270.
  • Cutting edge faces can have any rotation/alignment.
  • Each face can have any Scale and Shift.

3.3. Solid Entities

Solid entities are being supported by Map2Curve. It is advised to turn anything into a solid entity (e.g. func_detail or func_wall) for a better brush-handling in the editor.

3.4. Point Entities

Point entities are currently not supported but might be added in a future update.

4. Features

4.1. Generating Arcs

4.1.1. rad & offset

  • “rad 0” will use the original mesh position from the map file, as long as it is above 0. Otherwise, it is moved above 0 on the Y-axis before the arc is being generated.
  • Each radius (rad) command in a Map2Curve setting file corresponds to one arc.
  • A setting file can consists of only one rad command. Anything else will be filled with default values by the program.
  • Each arc defined in a settings file will always use the same base mesh from the loaded map file.

Offset Command

4.1.3. res

  • Resolutions for PI Circles are always divisible by 4. Everything else will be rounded by the program.
    At the moment the minimum resolution is 4.
  • Resolutions for GRID Circles must be 12, 24, 48, 96, 192 or 384 or the appropiate ID: 1(12)…6(384)


Res command for arc generation.

4.1.4. type

Currently there are 2 ways the program generates arcs: Pi and Grid Circles. Both are very different.

Arc Type Properties

Type Res ID Minimum
Sides
Maximum
Sides
Default
Sides
Section
Length
Precision
of Coordinates
Pi 0 4 384 8 equal floating point
Grid 1 12 384 12 varies integer
floating point
  1. PI (pi)
    This uses pi to generate the contruction circles. This method will let you “arc” non-rectangular brushes (e.g. pipes), without the need of using triangles.

    Upsides:

    – Even length of each section
    – Perfect circle

    Downsides:

    – The resulting floating point coordinates are not easy to work with (but can be compiled flawlessly in most cases and can be rounded to integer numbers)

    Arc that is based on PI construction method
  2. GRID
    This uses a special construction method, where the basic circle was rotated by 15 degrees, scaled to the nearest grid and then its vertices were snapped to the nearest grid. For a 12-sided circle with a radius of 128, this gridsize would be 32. By doing this, the resulting arc brushes won’t need any triangles to be planar either AND can even have integer coordinates, which can be handled a lot easier than floating point coordinates of course.

    Upsides:

    – The coordinates can be integer and are thus very comfortable to work with.
    – Cutting edges are easier to work with.

    Downsides:

    – When arcing smaller brushes at high resolutions floating point coordinates (e.g. 0.5, 0.25, 0.125, 0.0625, etc.) are possible and can’t be rounded to integer numbers that easily without deforming the mesh and making the “Grid” type pointless.
    – Not a perfect circle, rather oval.
    – Sections don’t share the same length.

    Arc that is based on Grid construction method

    Grid Circle Construction

4.1.5. round

  • The original generated vertice coordinates have floating point precision and are thus off grid.
  • “Round 1” rounds these coordinates to integer numbers, which can be handled easier in an Editor because they are on grid.
Attention: Rounding the coordinates of brushes with sloped faces, like Cylinders, might lead to invalid solids, messed up meshes and/or faulty compilation!
Round Command

4.1.6. height

Height Command adds height to each section

4.2. Generating Ramps

Ramps are created by combining the commands height, tri and ramp.

Ramp generation steps

  • While height adds a custom height (32) to each section…
  • tri 1 splits up the brushes into wedges, which is crucial for the sloped brushes to be loaded flawlessly by a Goldsource map editor.
  • ramp 1, in the end, creates the actual ramp, with a linear slope. Ramp 2 would create a smooth slope.

Ramp (Slope) Mode

  • ramp 1 creates a linear slope.
  • ramp 2 creates a smooth slope.
Difference between ramp 1 and ramp 2

4.3. Triangulation

  • Using Triangulation on an Arc is crucial for ramp generation!
  • Triangulation will currently only work on brushes that have 6 faces (cuboids) and an upright front and back face!
Tri Command

Valid Brushes

Valid Brushes for Triangulation

Valid Brushes for Triangulation

4.4. Textures

Map2Curve reads texture information from imported brush faces and uses them to calculate the new generated textures, aka rotate them, re-scale them and move them horizontally along the respective brush/arc edges.

In Order to do this, source textures need to meet certain criteria in terms of texture rotations/alignments.
There are several ways textures can be arranged on the generated arc brushes horizontally:

  1. Shift 0 [Null] – Simply puts all horizontal texture shifts to “0”.
  2. Shift 1 [Per Section] – All faces of a section share the same shift that is based on the longest edge length of that section.
  3. Shift 2 [Per Brush] – All faces of a brush share the same shift that is based on the longest edge length of that brush.
  4. Shift 3 [Per Brush Texture] – All faces of a brush, that share the same texture, will have the same shift, based on the longest edge length of that brush-texture.
  5. Shift 4 [Align Left] – All faces of a section are aligned to the left corner of this section.

Shift Modes for horizontal body textures

The per Brush Texture shift mode for horizontal body faces.

4.5. Exporting as OBJ

OBJ is a 3D model exchange format. It can be imported and/or viewed in potentially any available 3D software.
Exporting a generated arc or ramp to OBJ can have multiple reasons and benefits. You might want to use it as reference when animating scenes in an external 3D software, other than a classic Goldsource editor.

Map2Curve can not export any texture information to an OBJ file!
Exported OBJ file viewed in Blender 3D
Exported OBJ file viewed in Windows 10 3D Builder

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.