Short explanation of Haptek commands

  • 3 Replies
  • 7259 Views
*

doc

  • Guest
Short explanation of Haptek commands
« on: November 20, 2005, 12:48:05 pm »
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.



*

Carl2

  • Trusty Member
  • ********
  • Replicant
  • *
  • 560
Re: Short explanation of Haptek commands
« Reply #1 on: March 17, 2009, 01:00:56 am »
  I'm going to place this post hoping someone will see and reply to it.  I noticed Doc refered to a debug console in Haptek that I am unfamiliar with.  To be honest I've never been able to get the Haplogctrl running.  I'd like to use the debug console with a hap player in the computer and not on the internet.
Carl2

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6832
  • Mostly Harmless
Re: Short explanation of Haptek commands
« Reply #2 on: March 17, 2009, 12:41:14 pm »
I think he's talking about the HapLogCtrl.txt which needs to live in the root drive :

Code
#################
##
# Haptek Logging Control File
#
# c:\HapLogCtrl.txt
#
# This file must be in c:\ and named "HapLogCtrl.txt".
# Otherwise it is ignored.
#
# log= <feature> <level> <filename root>
#   Feature = one of
#       HapApi2
#       HapActiveX
#       HapRendDX
#       HapSoundMgr
#       HapNetscape
#
#   level = one of
#       0 - no logging
#       1 - logging to constant filenames     (recommended to reduce disk usage)
#       2 - logging to time-stamped filenames (better for intense debugging)
#
#   filename root = root of the filename. .txt and/or .log and timestamping may be pre/a-pended.
#       if ommited, the feature name is used.
#
#
# logdirectory= c:\HaptekLogs
#   Specifies the directory all the log files go into. The directory must exist.
#
# debugger= y/n
#   special command used by Win32HaptekApi2 to open a pop-up debugger right away,
#   useful for seeing which commands are being sent to the API.
#
#
#
# Examples
#
# log= hapapi2 1 my log file
#   means log the hapapi2 features to c:\hapteklogs\my log file.txt
#
# log= hapapi2 2
#   means log the hapapi2 features to c:\hapteklogs\<timestamp>_hapapi2.txt
#
# logdirectory= e:\my haptek logs
#   log files will go in e:\my haptek logs
#
# debugger= y
#   a debugger window will open immediately when the Win32HaptekApi2 starts up.
#
##
#################

logdirectory= c:\HaptekLogs
debugger= y

log= HapApi2 1
log= HapActiveX 0
log= HapRendDX 0
log= HapSoundMgr 0
log= HapNetscape 0



*

Carl2

  • Trusty Member
  • ********
  • Replicant
  • *
  • 560
Re: Short explanation of Haptek commands
« Reply #3 on: March 17, 2009, 11:49:43 pm »
  Thanks Freddy, that should help me out.
Carl2

 


Useful new robot.
by MagnusWootton (Robotics News)
January 15, 2022, 01:50:10 am
Christmas Eve Launch
by frankinstien (Robotics News)
January 13, 2022, 08:08:13 am
Forest - The Show
by Zero (Robotics News)
January 09, 2022, 01:58:03 pm
I wonder how well GPT-3 will on run this.
by frankinstien (AI News )
December 20, 2021, 04:36:39 am

Users Online

75 Guests, 0 Users

Most Online Today: 95. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles