Author Topic: tamit  (Read 6788 times)

Draeke

  • Posts: 56
  • Turrets: +8/-2
tamit
« on: November 14, 2010, 04:00:29 pm »
The Short
tamit is a command-line program intended to assist mappers when creating symmetrical maps.

:: Introduction
The advantage to creating symmetrical maps over asymmetric ones is that your workload is somewhat reduced. The idea is that you only ever work on one half of the level geometry. Once you want to test a full map just duplicate your existing geometry, make some changes to textures and the like, then compile. This approach allows the mapper to not worry about inconsistencies between map halves.

However the process of converting the original half of a map into the second (we'll call it inversion) can be tedious - and it only gets worse as map complexity increases (doors, particle systems, etc). This where tamit comes in.

:: Description
tamit (Tremulous Arena Map Inversion Tool) is a command-line program (originally written for personal use) that aims to substitute manual map inversion (except explicit manipulation of geometry/entities). It works by executing a series of commands read from an IVT script file and performing them on a map file.

tamit was written in C and makes extensive use of the Better String Library.

:: Script File
The script file is a plain text file (*.ivt) that consists of a series of commands that are performed on a map file. The script file must have the same base name (filename minus the extension) and directory as the map you want to invert.

:: Script Example
The script file (mercyb2.ivt) may look something like this:

   entMod(func_door #?, angle@ ? + 180);
   textMod(blue = red);
   textMod(_human_inter = _alien_inter);
   textMod(0.901961\\0.882353\\1 = 1\\0.882353\\0.882353);
   mapAdd(greencam.map);
   mapAdd(redbase.map);

   
The above script performs the following on the map data (in order):
- Increases the numeric value of the angle key for all func_doors by 180 (effectively makes all func_doors reverse direction of operation; except ones that move vertically).
- Replaces all occurences of the text 'blue' with 'red' (this effectively swaps all blue textures with red ones).
- Replaces all occurences of the text '_human_inter' with '_alien_inter' (this effectively makes any info_human_intermissions into alien ones).
- Replaces all occurences of the text '0.901961 0.882353 1' with '1 0.882353 0.882353' (effectively changes all blue lights to red lights).
- Appends the map file 'greencam.map' to the current map data (effectively puts in a spectator camera from an external map file).
- Appends the map file 'redbase.map' to the current map data (effectively puts in alien buildable structures from an external map file).

Note:
- In order to specify a space in text, you must use double backslashes '\\'. The reason for this is that tamit ignores all white space when interpreting the script file. This also means you can format script files with all the white space you want.
- Comments in tamit are effectively commands that aren't processed. This also means you can't stick comments inside of other commands.
The syntax is:
   //your comment here;


:: Command Syntax and Description
textMod(oldtext = newtext);
   Replaces all occurences of oldtext with newtext.
textMod(oldtext + newtext);
   Concatenates newtext onto all occurences of oldtext.
textMod(oldtext - newtext);
   Removes all occurences of newtext from all occurences of oldtext.

entMod(classname #targetname, key@ oldvalue = newvalue, ...);
   Recognises entities with matching classname and targetname, and sets key values that match the old value to the new value. Multiple key-old-new modifications can be done in one entMod. To specify no targetname, use a '?' in place of the targetname.
   To perform addition/subtraction of numeric values; specify an oldvalue of '?' (which specifies all values) or some specific value, and then a relative newvalue.

mapAdd(basename.map);
   Appends the contents of a map file onto the map data. The rough equivalent in Radiant is doing a map import.

:: Output
When tamit has successfully run, it will generate an inverted map file (basename.inverted.map) in the same directory as your original map.

You'll then probably want to mirror/rotate/move the inverted map geometry and import it into your final map.

:: Usage
   tamit <map location minus extension>

Example Usage:
   tamit mercyb2
   tamit ~/builds/mercyb2
   tamit "X:\Program Files\Tremulous\base\maps\mercyb2"

:: Installation
Unzip the file(s) to anywhere you wish (I recommend your base/maps directory for easy access to in-development maps).

:: Downloads
[MediaFire] Windows (32 bit)
[MediaFire] Linux (32 bit)
« Last Edit: December 02, 2010, 05:34:27 pm by Draeke »

UniqPhoeniX

  • Spam Killer
  • *
  • Posts: 1376
  • Turrets: +66/-32
Re: tamit
« Reply #1 on: November 14, 2010, 06:26:51 pm »
Seems quite useful. Tho is it possible to just add 180 to func_door angle key values (and perhaps subtract 360 if it ends up being over 360)?

Draeke

  • Posts: 56
  • Turrets: +8/-2
Re: tamit
« Reply #2 on: November 16, 2010, 09:31:31 am »
Nope that can't be done in the current build. You should be able to do what you've suggest using the supplied commands though (it just takes longer).

Plague Bringer

  • Posts: 3815
  • Turrets: +147/-187
Re: tamit
« Reply #3 on: November 16, 2010, 04:29:30 pm »
Though your math would be much more simple if you simply added 180 to func_door angle key values (and perhaps subtracted 360 if the output is greater than 360).
U R A Q T

Draeke

  • Posts: 56
  • Turrets: +8/-2
Re: tamit
« Reply #4 on: December 02, 2010, 05:51:28 pm »
Uploaded a small update for entMod functionality which lets you perform addition/subtraction of entity key values.

entMod(func_door #?, angle@ ? = 333);
   Sets all func_door angle key values to 333.

entMod(func_door #?, angle@ ? + 123);
   Increases all func_door angle key values by 123.

entMod(func_door #?, angle@ ? + -90);
   Decreases all func_door angle key values by 90.
« Last Edit: December 02, 2010, 05:53:37 pm by Draeke »