kids encyclopedia robot

Chr facts for kids

Kids Encyclopedia Facts

In computers, a chr file is a special type of file. It's often used for graphics, like characters in 3D games or images for old video game systems. It can also store sets of characters, like letters and numbers.

chr Files in NES Game Development

`chr` files were very important for making games for the NES. This was a popular video game console from the 1980s.

How chr Files Are Used

Game developers used `chr` files to draw small pictures called "tiles." These tiles were always 8 pixels wide and 8 pixels tall. To create bigger graphics, like backgrounds or characters, developers would piece many of these tiny 8x8 tiles together. Each tile could only use 4 different colors at a time.

What's Inside a chr File?

A `chr` file stores information as long lines of "bits." A bit is the smallest piece of data, either a 0 or a 1. Imagine a very long string of zeros and ones.

For example, a small part of a `chr` file might look like this:

  • 000000000011000011110001...

When the game system reads this file, it splits these long lines into two equal parts. Let's call them String 1 and String 2.

  • String 1 = 0000000000110000...
  • String 2 = 0000000000000000...

These two strings work together to tell the computer about each pixel in an 8x8 tile. They go in order, row by row, then column by column.

The color of each pixel is decided by looking at the bit from String 1 and the bit from String 2 at the same spot. Here's how it works:

String 1 bit String 2 bit Color Number
0 0 0
1 0 1
0 1 2
1 1 3

The `Color Number` (0, 1, 2, or 3) doesn't mean a specific color like red or blue. Instead, it tells the game which of the four chosen colors to use for that pixel. The actual colors are picked by the programmer when they write the game's code. So, the `chr` file stores the pattern of the pixels, not the actual colors themselves.

kids search engine
Chr Facts for Kids. Kiddle Encyclopedia.