Difference between revisions of "Element:FILT"

From The Powder Toy
Jump to: navigation, search
(FILT serialization: Changed the wording to get the point across more concisely.)
(Decoration Color Changing)
 
Line 118: Line 118:
 
=== Decoration Color Changing ===
 
=== Decoration Color Changing ===
  
When {{Material| CRAY}} fires through FILT, the deco color of the particles change to match the color of the FILT. BIZR also changes its deco color to the color of FILT when it passes through it. This proves very useful if you want to create something temporarily but don’t want to ruin the dark or bright esthetic of your surroundings.
+
When {{Material| CRAY}} fires through FILT, the deco color of the particles change to match the color of the FILT. BIZR also changes its deco color to the color of FILT when it passes through it. This proves very useful if you want to create something with a specific color.
  
 
=== Extra ===
 
=== Extra ===

Latest revision as of 00:24, 5 July 2023

FILT.png Filter
Properties
Section Solids
Spawn temperature 22°C
Heat Conductivity 100%
Relative weight 100
Gravity 0
Acid dissolve rate 0.1%
Flammability 0
State Solid
Misc properties
Source code


Term explanation

Wavelength and spectrum both refer to the ctype of a particle that can hold a 30 bit value. Sparked and SPRKed both refer to the SPRK particle in TPT having been applied to a metal. Filter is the same as FILT. FILT is the term you see when you mouse over the particle in TPT.

Usage

When created, Filter's color is based on its temperature. It will scale from dark blue to dark red, corresponding roughly to temperatures between 200 and 840°C. Filter has high temperature conductivity, and its color-changing makes it easy to see the flow of heat.

Filter will color BIZR and white BRAY passing through it. FILT can also change the color of passing PHOT and BRAY using binary logic, described in detail later. FILT is one of those seemingly boring, but in reality extremely complex and interesting elements. 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 (but not the highest) thermal conductivity and is nearly indestructible, making it ideal for transferring heat away from reactors to cooling fluids. It is also useful for debugging, as it changes color 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

An ARAY wire is composed of ARAYs which activate each other in sequence. When an ARAY is activated it creates a ray of BRAY. The BRAY has a life of 30 so unless you’re not using that wire often, you’ll need to find a way to remove the BRAY before the next SPRK cycle. You could do this by using a brown BRAY ray but most of the time it is easier to just place transparent particles along its path instead. There are many transparent particles but FILT is the most common. For more information on ARAY visit its page here. ARAY

Coloring properties for Photons and BRAY

Waves.gif

BIZR/G/S, BRAY, FILT, and PHOT particles store their wavelengths in the ctype field. Wavelengths are just 30 bit numbers that are stored in the ctype of a particle.

You can learn more about wavelengths here.

The visible color depends only on the 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 the particle's color. More specifically, color only depends on the proportions of those amounts. To set all bits, set the ctype to 0x3FFFFFFF or -1, which will enable all the wavelengths and make it white.

FILT uses the ctype field to store wavelengths too, however, if the ctype is 0, wavelengths will be calculated from its temperature instead: it will slowly shift towards blue when cold, and to red when hot. Technically, 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 largest bits in the red part of the spectrum.

Logic Component for Electronics

Because of the FILT's ability to change a BRAY’s wavelength given a mode, you can treat it as a really powerful logical operator that single handedly allows for complex and large sized computations. It has the ability to store large amounts of binary info into a very small space (30 bits per pixel). For a practiced person, FILT electronics are far easier to set up than INST or metal based electronics. There is a list of modes below. Each mode fulfills a purpose. The and ,not, xor, and or gates give access to the base elements of a logic system. With this logic system there have been many who have made computers with enough room to spare accessories like a screen, keyboard, and touch screens!

FILT has many operation modes determined by its tmp property:

FiltTmp.gif
  1. "set colour" 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. "subtract colour" mode: Performs a bitwise and-not: all wavelengths present in FILT are subtracted from PHOT.
  5. "red shift" mode: The wavelengths of a photon are red-shifted. The distance of the shift is calculated from the temperature only: the ctype value of the FILT is ignored..
  6. "blue shift" mode: Like "red shift", but the shifting direction is opposite, wavelengths are moved towards the blue end.
  7. "no effect" mode: No spectrum changes are performed. Useful if you want to cross beams of PHOT and ARAY without mangling the spectrum
  8. "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.
  9. "not" mode: Performs a bitwise not: all wavelengths of PHOT are flipped. Note that FILT's spectrum is ignored.
  10. "QRTZ scattering" mode: Randomizes photons' velocity and randomly changes their color, just like QRTZ in old versions of The Powder Toy.
  11. "variable red shift" mode: Shift bits toward the red side by how many bits are to the right of the least significant bit.
  12. "variable blue shift" mode: Same as "variable red shift" but shifts towards the blue side of the spectrum instead.

Any other tmp value makes FILT functionally equivalent to mode 6 (nothing). It is strongly recommended not to use any tmp's above those listed here, as the developers may add more modes for those tmp values in the future, which would break your save.

Almost all of these modes are all equivalent to an array of logic gates applying its logic across each of the thirty bits. FILT electronics are usually performed by setting a BRAY to a specific value, and moving it through one or more FILT with a specific mode and/or value. Then reading the output. The output can be read by either putting it back into a line of FILT for later storage or calculation, or taken as either on or off, based on whether or not it could make it through the FILT.

FILT electronics sometimes use a common spark-able like iron or metal as a more straightforward output, because if the operation that was performed on the BRAY results in a zero, then the BRAY is terminated and nothing is sparked. In this way, you can get a binary 1 or 0 depending on whether or not the operation resulted in a 0. While this feature may be very useful sometimes, if it happens unexpectedly, you could be left without any BRAY at all and operation would stop. To avoid this, most people always set the 30th bit while doing their calculation even if a calculation results in zero they can still read it. For all operations this bit is ignored and exists solely to keep the BRAY around. Be aware that if any bit is shifted too much in any direction it will be launched off the spectrum and disappear.

FILT Memory Techniques

I'd say there are three linked ways to store your FILT, here they are.

  1. Easy storage. Sometimes we just need to get our data stored. No need for a technique right? Easy storage is about using one FILT per value, so that you can reference it later.
  2. Reference storage. Sometimes we have to work with some pretty large numbers. When you're coding your computer, or if you are making a set of instructions for a printer, you don't want to have to write out these large, hard to remember numbers. Instead we can assign those big numbers to smaller and more manageable numbers. An example would be if you have five values. 537100575, 537085324, 536870975, 536870975, and 537052300. Each of these numbers are a direct data representation of a letter h, e, l, l, or o. Wouldn't it be nice if I could call them by their place in the alphabet? Just like this 8, 5, 12, 12, 15. Now instead of using around 18 bits to store a single letter, I'm using just 4. I still need those big numbers somewhere. But it’s better if I can assign them to smaller numbers.
  3. FILT Sharing storage. With this technique, you can write multiple values to the same FILT. Most of the time you use less than 7 bits in a FILT. This technique utilizes the remaining 23 bits by placing another 7 bits shifted onto the same spectrum. If you shift four seven-bit numbers onto the same spectrum then you would be using a forth of the space that you would have if you gave the number to its own FILT. If you want to single out a specific value from it you can just perform a bitwise and operation on it specifying the 7 bit range of binary that you want. Then to make it a normal number you just need to shift it a little. This technique can potentially quadruple your storage, but it's one requirement is that the size of the binary values have to be small enough to fit together on the same FILT. This is where using Reference Storage could help. Reference Storage would allow you to the reference which is smaller than the number it refers to.

What if you used all of the techniques at once? The easy storage would contain the big complicated numbers. The reference storage would assign smaller numbers to those big numbers. And the sharing storage would make those numbers share space on a single FILT. These three methods (used together) allowed mad-cow to make a storage system capable of holding the entire first book of the Harry Potter series.

DTEC can be used to modify FILT's ctype: when PHOT or BRAY is within the DTEC's range, DTEC copies the spectrum into a line of directly adjacent FILT blocks, if any are present.

LDTC can also be used to modify FILT's ctype: when it detects PHOT, BRAY, or even FILT itself, it will copy the spectrum only into a line or dot of FILT directly opposite the detected element. Because of how precise yet versatile LDTC is, LDTC is quickly taking over DTEC in most FILT based electronics.

FILT serialization

Serialization is a fancy word for taking real world analog data and converting it to a series of low precision numbers. Serialization in TPT is done by putting the proper detector next to some FILT and setting it to the right mode. The detector will detect its surroundings and write its findings into adjacent FILT in binary. Cracker1000 made a wonderful tutorial about how to set up serialization in one of the saves below.

Decoration Color Changing

When CRAY fires through FILT, the deco color of the particles change to match the color of the FILT. BIZR also changes its deco color to the color of FILT when it passes through it. This proves very useful if you want to create something with a specific color.

Extra

Photons are very similar to BRAY. They can go through FILT and are acted upon through that FILT in the same way. There is one distinct difference however. That difference is that PHOT is an energy particle and as such, it is capable of stacking on top of itself up to the particle limit. It also has the bonus of being undying when it's life is set to 0. If you put a whole bunch of photons that all have their own wavelength into the same pixel, and if you take advantage of some DRAY, FRAY, or just DTEC, then you can read the top value on the stack of photons and discard the PHOT. The next PHOT is revealed and you can do the process again. Using this method you could have as much storage as you want in a single pixel. When coloring FILT using the deco tool you will find that the color of the FILT isn’t as bright as anything that was colored the same way. The FILT will appear a fair amount darker than its surroundings. When you put a bray through it, it brightens briefly matching the deco color you painted it with.

Notable Saves

A thermometer using FILT.
A spectrum analyzer, which can detect the color of incoming photons.
A tutorial about setting and manipulating BRAY values with FILT.
A tutorial about serializing all environment variables into FILT spectrum and back.
Lesson 2 of subframe lessons, on FILT.

See also

TPTEye - a free, open-source tool for working with FILT and other spectrum-related elements.