[SDL] Creeating MAPS with SDL
david at olofson.net
Wed May 21 01:26:01 PDT 2003
On Wednesday 21 May 2003 05.27, eDU! wrote:
> Is there any place where i could read information about
> makeing maps with SDL?
*Making* maps, or just rendering them?
smoothscroll does both, BTW. Very basic integrated map editor.
> I want to know how does this work... my idea
> is to create a map, with tiles, in 2D. With perspective. Like the
> look of Ultima Online, or Hellbreath.
Maybe that's an idea for another scrolling example...?
Anyway, the biggest difference between plain 2D and isometric views is
that the latter has non-rectangular tiles. The most common solution
is to make them diamond shaped instead; something like this:
'#' are opaque pixels, while '-' are transparent. You'll have to use
colorkeying or alpha channels for this.
Yep, this is one case where you should use RLE acceleration and one
surface per tile. RLE acceleration makes blitting with colorkey and
alpha channels pretty much as fast as plain rectangular blitting. In
the case of alpha, only the pixels that are actually blended (ie not
transparent or opaque) are expensive. Opaque pixels are rendered just
as fast as in plain rectangular blits.
However, clipping RLE encoded is (relatively) expensive, and you'll be
doing a lot of it if you blit from a single tileset image, so use one
per tile. (Chop them up at load time or something.) Pass SDL_RLEACCEL
to SDL_SetColorKey() or SDL_SetAlpha() to enable RLE acceleration.
Next, you'll have to render every other row of tiles offset by half
the width of a tile. The height of one row is half the height of a
Well, that's about it, I think...
//David Olofson - Programmer, Composer, Open Source Advocate
.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`-----------------------------------> http://audiality.org -'
--- http://olofson.net --- http://www.reologica.se ---
More information about the SDL