Non-number Multidimensional Array: Best way?
Philip Swartzleonard
starx at pacbell.net
Tue Dec 4 07:24:16 EST 2001
I'm using a multidimensional array to store the map data for this
'rougelike' project i'm working on, and i'm wondering if the best way to go
about doing it is Numeric (Assuming i can find the docs for the 'pyobject'
part...), or raw python lists, or something else.
Right now, my 'Map' (bad name, maybe) class is a 'list of lists' mess
that i don't completly understand, and the elements are static 'copies' of
derivitives of the class 'tile' (that is, there are really only a few tiles
that exist in another module, and each element is a reference to one of
those... important b/c the tiles have complicated initilization (i.e. gl
display lists), and are then unchanging). In the future, however, every
class will have to be it's own instance of a 'cell' class or similar, to
handle contaiment. Another problem is that i will need to deal with LOTS of
these things, and they will get quite large (i'm at 25x25 now and it's not
very big %D)
Right now the main function is to draw a region of itself, by calling
the draw function of all of it's constituants. This is a little
complicated, as it must set the GL matrix to the appropriate translation
before calling each element.draw() function. I THINK the complex slicing
goodies in numeric will help with this, and keep my brain from frying on
list looping :). I also have the origin set as the lower left corner (south
west?), but this dosen't matter at this time, it's just what evolved :)
Any ideas are appreciated. (Will be? :)
Sorry for the incoherence factor :)
--
Philip Sw "Starweaver" [rasx] :: <nothing>
More information about the Python-list
mailing list