[SDL] WalkMap

David Olofson david at olofson.net
Mon Nov 3 15:30:00 PST 2003

On Monday 03 November 2003 23.53, Alessandro Ardolino wrote:
> If I need a walkmap for my game,
> it's better store it as an array,
> or as a simply bitmap?

Well, that depetds. What kind of info do you need to store? How big is 
the map? What's the resolution of the walk map? (Tiles or pixels.)

A bitmap is harder and slower to access - except when the map is so 
big that an array of bytes or larger elements wouldn't fit in the 

That said, if you're only checking a few or a few tens of pixels/tiles 
every frame, don't worry about this. Just do it the easiest way.

If the map becomes too big and/or you end up using it a lot more than 
you expected, it's trivial to change, as long as you keep the low 
level code in one place, in inline functions, macros or something.

At that point, you might also want to consider a structured walk map 
of some sort. You could use something like sorted trees of rectangles 
or polygons, which also has the advantage that you can implement very 
fast search algorithms for bullet trajectory checking and stuff like 

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---

More information about the SDL mailing list