View Full Version : tiles
05-18-2010, 03:07 AM
Would someone explain to me what a video tile is? It seems to be related to the size in pixels of a character box (IE 5x8, 8x8, etc). I see this term frequently in display objects form the propeller object exchange.
Hi bob, I'll have a go at a quick clarification since no-one else seems to have caught this.
Bit mapped screen displays need an area of memory to hold the data that becomes the image you see on the screen.
For example, 16 colours needs four bits ( binary values 0000 to 1111) to store in memory. This is per pixel, so for example
a screen display of 320x256 with 16 colours needs 320x256x4 or 327680 bits of memory which in 'real money' is 40960 bytes or about 40K of memory.
This memory is called a frame buffer.
The problem is, on a low memory platform like the propeller (or older 70's & 80's computers & games systems) this is WAY too big, and that is only to create a display which would be classed today as Very low resolution and low colour.
For example the propeller only has 32K of hub ram for your program, data and screen buffer.
However, as you have seen, the propeller can drive displays at these kinds of resolutions and colours... so How?
Here's the clever bit...
A tile can be thought of as a small section of the screen which follows the rules above, for example a 16x16 tile in four colours needs 16x16x4bits = 128 bytes or 1/8 of 1K of memory.
For many games, large parts of the screen are the same, for example grass or roads or paths or deep space or 20 identical aliens. This means we don't need to store ALL of the screen buffer, since much of it is the same.
If we break the screen into tiles of say 16x16 pixels, then the screen is really just a grid of 20x16 tiles, and for each tile in the grid, we need only store one number per grid square to tell us which tile to draw at that position.
Now, even if we use one byte per grid square on screen we need only 320bytes (20x16x1byte) to store the grid.
If we chose a maximum of (for example) 64 different tiles, we need 64*128bytes (or 8k) to store the tiles for the screen in memory.
BINGO you now have a 320x256 display using only a little over 8k as long as many of the tiles are the same.
Phew, hope you followed that http://forums.parallax.com/images/smilies/wink.gif
Search Propeller Forums (http://www.google.com/cse/home?cx=005038179529894410695:-i_2f0zjlbm&hl=en) easily thanks to StefanL38 (http://forums.parallax.com/member.php?u=47171)
05-25-2010, 03:54 AM
I just saw your reply. Thanks. What you describe is what I expected, and I did understand the description. Now I have to go find out why I didn't get an email from the system about your reply. Huh, I just noticed a box down below I should have checked if I want an email response. I'll assume operator error.
05-25-2010, 05:10 AM
I would add there being two types of tiles.
The older school type, found in early home computers were often referred to as "character graphics", where a table of characters is stored somewhere in the computer, RAM or ROM. The screen memory is composed of bytes, each one referring to one of the characters for display. This is seen on the Propeller on most all the non-Parallax text mode drivers. (8x8) Characters are typically one byte wide, and are either 4, or 8 pixels, depending on whether there is 1 or 2 bits per pixel to describe color.
I find the Parallax TV driver to be quite powerful in it's use of tiles. Setup on it is somewhat more difficult to get your mind wrapped around. Past that, the newer-school tiles are screen addresses, not just byte values. Additionally, due to how things all line up, both color and screen address can fit into a word. The Parallax driver has an array filled with sets of colors. There are 64 palettes possible. A screen array contains longs, similar to the bytes described above. Each long tells the driver which palette to use, and where the graphics data is in the Propeller RAM, or ROM.
While this method isn't as quick, or easy as a simple set of screen bytes would be, it does have the advantage of being able to use both RAM and ROM for the screen display. Text from the ROM costs the programmer very little!
Propeller Wiki: Share the coolness! (http://propeller.wikispaces.com/)
8x8 color 80 Column NTSC Text Object (http://obex.parallax.com/objects/550/)
Safety Tip: Life is as good as YOU think it is!
05-25-2010, 06:33 PM
Please read page 331 of http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/Hydra-Ch16Sample-v1.0.pdf.