The explorer draws a picture for each effect in a file: the force the effect asks of the device, worked out from the numbers in the file. It is a picture of the file, not a measurement of a joystick, and nothing here was checked on a force feedback device. The picture has no text; the heading above it gives the scales. The force is always drawn from −10000 to 10000, the range of DirectInput forces, and the time runs from 0 to the end of the effect.
Force over time
For a constant force, a ramp or a wave, the force at a moment t, counted
from the end of the start delay, is:
| Effect | Force |
|---|---|
| Constant force | lMagnitude |
| Ramp force | lStart + (lEnd − lStart) × t / dwDuration |
| Sine wave | lOffset + dwMagnitude × sin(2π × p) |
| Square wave | lOffset + dwMagnitude while sin(2π × p) is not negative, lOffset − dwMagnitude otherwise |
| Triangle wave | lOffset + dwMagnitude × a triangle that rises from 0 to 1 over a quarter cycle, falls to −1 and comes back |
| Sawtooth up | lOffset + dwMagnitude × a line that rises from −1 to 1 over one cycle, passing 0 at p = 0 |
| Sawtooth down | the same, falling from 1 to −1 |
where p is the position in the cycle: t / dwPeriod plus
dwPhase / 36000, keeping only the part after the point.
The result is scaled by the gain, dwGain / 10000. Before the start delay
has passed the force is 0, so the curve starts with a flat stretch of that length. An
effect that lasts until stopped is drawn for three cycles of its wave (or one second
when it has none), after the delay.
The envelope
An envelope gives the effect a level that changes with time. The curve is multiplied by the level divided by the effect’s full strength (the magnitude of a constant force or wave, the larger end of a ramp):
- for the first
dwAttackTimethe level rises in a straight line fromdwAttackLevelto full strength; - for the last
dwFadeTimeit falls in a straight line from full strength todwFadeLevel; - in between, it is full strength.
The picture marks the envelope with a dashed orange line (two for a wave, one above and
one below the offset), so the envelope can be seen separately from the wave inside
it. An attack level above full strength, such as 8000 on a wave of 5000 in
chainb.ffe, starts the wave stronger and brings it down. This is the
reading of the envelope in the DirectInput documentation; no device was used to check it.
Spring, damper, inertia and friction
These have no time curve, so the explorer draws force against position (spring), velocity (damper and friction) or acceleration (inertia), from −10000 to 10000. There is one line for each axis in the effect. Beyond the dead band each side of the offset the force is the coefficient × the distance from the dead band ÷ 10000, held at the saturation; friction is the coefficient itself, at once, a step. A saturation of 0, which all the SDK’s files have, is drawn as no limit, because a limit of 0 would draw a flat line whatever the coefficient. The sign shown is the side of the neutral point, not the direction the real force pushes (a spring pulls the stick back to its neutral point).
Custom force
A custom force is drawn from its samples, one line for each channel, spread across the picture. Its layout in the file is unconfirmed (see effect types).
What is not checked
- How a device draws the start of a wave: DirectInput gives the phase as an angle, and the explorer applies it as the start of a sine. The square and sawtooth shapes follow the same convention, which is a choice made here.
- How an envelope applies to a ramp, a condition effect or a custom force. The explorer applies it to a ramp as a scale and does not apply it to the others.
- The effect of
dwSamplePeriod, which is 0 in every file, and of the trigger button, which only decides what starts the effect. - The direction: it is shown as a number and not drawn.