About / FAQ

What is XTiles?

XTiles is a simple open-source, SDL-based library written in C++ intended for creating, manipulating and drawing old-school graphical tiles. It is currently being developed by me and me only, Fernando Aires Castello. To be able to develop using this library you need to have the SDL library installed too because XTiles is built on top of it.

XTiles is especially suited for generating simple two-color (background+foreground) graphics in roguelike games. You can simply use the characters from the default built-in ASCII tileset (based on IBM-ASCII), or you can also customize the entire tileset through the extremely simple API provided.

Why outdated tiles?

You might be asking yourself: "Why would I want to create pixelized tiles at runtime when I can just draw bitmaps with an image editor and load them with SDL, etc?" Well, read on.

I started development of XTiles simply because I love graphical tiles. I love old 8-bit games where everything that appears on the screen is made up of colorful tiles (such as in the ZX Spectrum). Also, I love making simple games with simple graphics. So this library tries to mimic a tile-based display which has a tileset (a set of tiles) and a color palette (a set of colors), and it can display any tiles from its tileset using any color from its palette, and every tile can have two colors (a background and foreground color) or each pixel of a tile can have a different color.
So, as you can see, this library is mostly intended for nostalgic and hobbyist game programmers, such as myself. I don't really care about efficiency or memory when making my retro games. So I don't care about generating every single screen pixel on the fly. I don't care about having to create graphics by writting endless strings like "10101111". I don't care about having to deal with the constraints of a limited set of tiles or colors. If you are like me then you will certainly enjoy programming with this library.

Since with XTiles you can generate every single graphical object of your game during runtime, there will be no external image files to load and players won't be able to see the game graphics outside of the game itself. And if you don't want to generate the graphics at runtime you can just generate them once, save the tileset to a file and then load the tileset using the built-in functions provided.

What can I do with it?

XTiles offers several functions and structures for creating, manipulating and drawing tiles on the screen. There are functions that allow you to: generate a default ASCII-based tileset, generate a default color palette, customize each tile in the tileset, customize each color in the palette, create bicolor tiles containning what I call "binary strings" (strings that contain only '0' or '1') and multicolor tiles containning pixel colors or palette indexes, draw tiles on the screen at any location, draw strings of tiles, save and load the entire tileset and palette to and from a disk file, among other useful functions. Tiles can be automatically aligned to an invisible grid when drawn, so you don't have to deal with that. Tiles can have two colors (a background and foreground color) or multiple colors, depending on what values are stored in the tile structure and what functions you use to draw them. Tiles have a size of 8x8 but can be stretched vertically and horizontally when drawn (the more you stretch, the more they will look pixelized). Tiles can be applied a "pixelated effect", which serves no purpose at all, but I found it looks pretty cool so I implemented it anyway.

For more information about how and what to do with XTiles, check out the "Tutorial" page.

Limitations

XTiles currently has some limitations. These limitations may or may not be addressed in the future. Who knows?

- Every tile structure contains only 64 pixel values.
- The tileset can contain no more than 512 tiles.
- The palette can contain no more than 256 colors.
- It can't handle transparency.

As an important note, XTiles only cares about creating and drawing pixels and tiles. It does not handle collisions between tiles, it does not deal with moving tiles around, and it can't play sounds or animations or generate 3D graphics. If you need to detect collisions or move tiles around you'll have to do it yourself until these functions get implemented in XTiles someday (if ever).

What do I need to get started?

You need to download the latest version of XTiles. You need to have SDL installed, too. You need a C++ compiler. This library is being developed and tested in Windows 7 using Microsoft Visual C++ 10. It hasn't been tested with other systems or compilers. So if it doesn't work for you, please let me know. Check out the "Downloads" page of this blog so you can find all XTiles related downloads to get started.

License and disclaimer

XTiles is "copyleft", which means it's free and I will never charge you for using it or whatever, I don't care. It is distributed "as-is", I'm not in any way responsible for whatever harm it may cause to you and/or your computer. In any case, if you'd like to give me credit for the library I'm OK with that.

How to contribute?

If you like XTiles, you can contribute to the project by reporting any bugs that you may find while using it and by sending me any suggestions for improving the library. If you'd like to request that a feature or function be included in future versions, please send me a message and if I get enough requests for that feature or function I'll work on it.