Tutorial:FILT

From The Powder Toy
Revision as of 13:07, 28 February 2014 by mniip (talk | contribs) (replace /too/ layman explanations with valid and source-sourced facts, also add images)
Jump to: navigation, search

FILT is one of those seemingly boring, but in reality extremely complex and interesting elements. The wiki description of FILT is way out of date, and completely ignores many aspects of its behaviour, particularly when used as a component in electronics or as a thermal conductor. So, here are some uses of FILT:

Heat Conductor

Probably the simplest way to use FILT, for a beginner at least, is to transfer heat. FILT has a very high thermal conductivity and is indestructible to everything but BOMB and DEST, making it ideal for transferring heat away from reactors to cooling fluids. It is also useful for debugging, as it changes colour from blue at 0ºC to red at 1000ºC. (more detail on this in later sections). Note that if ambient heat is enabled, FILT's temperature will not be affected by the 'air temperature' around it, only items touching it.

ARAY Conduit

The basis of most modern electronics in TPT is FILT/ARAY conduits. If you SPRK a pixel of ARAY from a basic conductor (a conductor that is not PSCN, INST or INWR), it will create a beam of BRAY with a life of 30 that will SPRK any basic conductors or PSCN in the way. This is useful for transferring current over long distances quickly and more compressed-ly than INST, however it is clunky and slow as one must wait 30 frames before the ARAY can be SPRK'd again compared to 4 for INST.

If a pixel of FILT is pressed up against ARAY, and another pixel of conductor is on the end, it will conduct instantly. This is currently the most reliable, fastest method of conducting electricity.

Note that both white and brown BRAY can pass through it, and can enter, exit and re-enter the FILT without stopping the beam. White BRAY will pick up the display colour of the FILT, but cannot be used for wavelength transfer.

Filter for Photons

Waves.gif

BIZR/G/S and PHOT particles store their wavelengths in the ctype field. Wavelengths are stored in binary, using 30 out of 32 available bits. A set bit indicates that a specific wavelength is present, a zero bit means it is absent.

The visible color depends only on amount of bits in 5 bit groups: red, yellow, green, cyan, and blue. They are 9, 3, 6, 3, and 9 bits long respectively. The position of bits within a group is preserved, but does not affect particle's color. More specifically color only depends on proportions of those amounts. To get white color, set the ctype to 0x3FFFFFFF, which will enable all the wavelengths. A photon dies if its ctype is 0, which means that no wavelengths are present.

FILT uses the ctype field to store wavelengths too, however if ctype is 0, wavelengths are calculated from its temperature: it slowly changes from blue when cold, to red when hot. More specifically, a group of 5 bits is set, and starting from 0°C, every 40°C the group is red-shifted by 1, and after 25 shifts, at 1000°C, the group is shifted to the most red wavelengths.

FILT has a couple of operation modes determined by its tmp property:

FiltTmp.gif
  1. "set" mode: FILT's spectrum is copied into PHOT particles that pass through it
  2. "and" mode: A bitwise and is performed on PHOT's and FILT's spectrums and the result is stored in the PHOT particle, any wavelengths not present in FILT will be removed from PHOT.
  3. "or" mode: Performs a bitwise or: all wavelengths present in FILT are "enabled" in PHOT, if not already.
  4. "red shift" mode: In this specific case, the value in FILT's tmp interpreted as a spectrum. It is just a number that specifies by how many wavelengths is PHOT's spectrum shifted, in red direction.
  5. "blue shift" mode: Like "red shift", but the shifting direction is opposite, wavelengths are moved towards the blue end.
  6. "nop" mode: No spectrum changes are performed. Useful if you want to cross beams of PHOT and ARAY without mangling the spectrum
  7. "xor" mode: Performs a bitwise xor: all wavelengths present in FILT are "flipped" in PHOT's spectrum, that is, if some color was on, it turns off, and vice versa.
  8. "not" mode: Performs a bitwise not: all wavelengths of PHOT are flipped. Note that FILT's spectrum is ignored.
  9. "QRTZ scattering" mode: Randomizes photons' velocity and randomly changes their color, just like QRTZ.

Any other tmp value makes FILT do nothing, like the "nop" mode.

DTEC can be used to modify FILT's ctype: when PHOT hits DTEC, it copies photon's spectrum into adjacent FILT blocks, if any.