The information in this post is taken from my "Unofficial Haptek Reference Guide 1.3".
Additions and corrections are always appreciated.
Loading a Haptek character
A file with a Haptek model is recognizable by the .htr or .haptar-extension. These files are actually packages that can include a range of different files. A .htr-file just need to be loaded by the Haptek player to start working.
This can be done in several ways:
a) dropping the file on the window of the Haptek player;
b) dropping the file on the Haptek debug console, when activated;
c) typing the instruction to load a file on the top line of the debug console:
? ?\load [file=[c:\path name\file name.htr]]
d) putting the previous instruction inside a text file and, once again, dropping that file on the window of the player or on the debugger.
When a Haptek model is loaded by the Haptek player all files inside the package are extracted to a temporary folder with the name hap_temp. This folder will usually appear in the main folder of your Haptek installation.
Loading many files at once
When the Haptek player searches for additional files you will probably notice a delay in the performance of the player. To avoid such a hiccup you can choose to load all files at the start of a scene. Also if you need to load many files at once you can get them by instructng a "group download" (\setcachedownload). Once the instruction \startcachedownload is received, the player will halt until the whole group of files has been loaded. The finishing of this proces might trigger another string of commands (\setgrouphypertext). What's more, if you have enabled the download indicator (\showstatus) the user will understand what the player is doing at that time.
Pictures
You can load a picture (.bmp .jpg) to provide a background for your scene (\loadbackground) or to skin a character (\settexture). A picture file must meet the following criteria to work safely inside the player:
- the picture must have 24-bits colors;
- the file name does better not contain spaces;
- and the pixel width and height of the picture must be a power of 2,
which means you have to work with any of the these numbers: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024.
Tapes
A Haptek tape will usually be an skeletal animation file .bvh), but might be a sound (.ogg .spx) as well if I understand the Haptek SDK correctly. You can load a tape and play it (\settape) and remove it afterwards to free up memory (\removetape \deletetape).
Scripts
Haptek scripts (.hap) are text files that can be viewed with Notepad. You can load a script into the player (\createscript), run it (\playscript) and remove it again (\deletescript). While a script is playing, it can be abandoned (\switchscript) or even have its content overwritten by another script (\replacescript), unless you prevent this of happening (\setscript).
File pointers
For your convenience you can assign pointers for quick reference when you find yourself more than once refering to the same file (\addfilelocation) or folder (\pathadd).
Timing instructions
The command lines of a script are executed all-at-once and as fast as your computer can handle. This can cause problems when some actions take more time to finish than others. Sometimes you just want the action to take place in the right order. Place the \clock-command at the beginning of a program line to time instructions. The waiting time specified by the \clock-command is always calculated from the start of a script. Please remember that this last command won't work on the Haptek debug console.
Controlling your character
If a scene holds several characters you can select a single character (\setperson), perhaps rename it (\setname), change its size (\scale) or provide it with accessories (\attachecharacter). Use \switchscript to change the mood of your character. You can prevent a character from wandering around (\setsticky) and from manipulation by the users mouse (\setmousemode). A character can be made to float in a direction (\translate), to turn (\rotate, \rotatequat) or to perform both actions simultaneously (\keyframe). Use \home to return your character to its start position.
Center of interest
What's nice is that a character can be made to show interest in other objects besides the camera (\createlookobject). Use \setheadtrack to control the bodily involvement of a character that is looking at an object.
Scene display
The flow of action in the scene can be paused (\setcontrol \stop) or returned to its initial state (\reset \restoredefaults). The camera on the scene can be moved (\translate) and is able to automatically follow a character (\tether). The depth of the scene is adjustable (\camera) and so is the framerate (\setframerate). You can experiment with the display of a scene by changing the renderstyle (\rendermode) or the lighting (\setlight). Characters can be made transparant and shiny (\setmaterial), motionless (\setcalc), invisible (\setcalc), or just removed from the scene and out of memory (\delperson).
Speech
Your character is able to speak any message (\q \q2 \qclear \speak) by using an installed text-to-speech engine. When a character opens its mouth for the first time the TTS-engine needs to be loaded into memory and activated. On such moments you will probably notice a short delay in the performance of the player. You can get around this inconvenience by initializing the TTS-engine at the start of the scene (\sapittsload \settts). Once the TTS-engine is active use \ttspause and \ttsresume to hush the characters temporarily.
Another way to provide speech for your character is by using a sound file (\soundplay). A sound file needs the .ogg or .spx-format to work with the Haptek player. Spx.-files have slightly better compression for voice-only data than .ogg-files according to Haptek. For lip synchronization a .spx-file has to be accompanied by a .phn-file which asks for another Haptek product.
You can also provide sound by using .ogg-files. To generate an .ogg-file with embedded lip synchronization data there is a function inside Haptek's PeoplePutty. Although the predecessor of the Haptek player (Virtual Friend) used .wav-files, this format is not longer supported by the Haptek player.
The Haptek registry
A running Haptek player maintains an internal index with values related to the figures in the scene. The \setreg-command will allow you to make changes to the registry parameters. To examine those parameters you can use the tool HapRegistry.exe inside the Haptek SDK.
Switches
The behaviour of a Haptek character is controlled by series of states that are bundled in Switches. A state defines a single pose or an face for a character. A Switch is a group of similar states. What the states of a Switch are about will usually be hinted at by the name of the Switch. For example, the Switch called "morphs" has states with names like chimp, cat, baby, etc., the Switch for mouth positions, "visemes", has states with names like "aa", "b", "ey", "uh", etc. Inside a Switch only one state can be active at a time which represents the present state of the Switch. Switches usually own a state called "neutral" or "off" that is activated by default.
When a Switch is changed it doesn't just jump from the old state to the new one. The Switch rather provides a curve-like transition between those states to make the process seem as smooth as possible. This makes sense when you keep in mind that every state defines a pose or a face for your Haptek character. When you want to know more about the available switches for a character you need to find a file with a name like standard_FigDef.hap inside the hap_temp-folder after your character has been loaded by the player.