... or rather, not finding cast members quickly.

The project I am working on has a map of the world at several levels of detail with each level being twice as detailed as the level below it. The first level has the earth cut up into two 2048x2048 images, the second level has four 2048x2048 images, and so on. Once you get to level 7, the image set is not complete (currently it only covers only BC, Canada).

If you are at level 7 and move to an area not covered by that level's image set, it jumps to a lower level until it can find an image. The images are named like: level_row_column, where row and column are dervied from the camera's position (longitude and latitude). The code to check to see if an image exists at the current position on the current level is as follows:

testmember = member(string(curlevel)&"_"&string(currow)&"_"&string(curcol))
if testmember <> void then
   curimage = testmember.image
else
   --jump to lower level and try again
end if

When the member being sought after exists, the above runs in under a millisecond, when the member does not exist it takes 80 milliseconds to not find it. While this is still fast (given that it has to search through 1000's of members), it unfortunately leads to a verry noticable slow down as I need to check for several members per frame.

I have a couple of solutions, but each has its drawbacks.

1. For each level, compile a look-up table to determine which images exist at that level. Drawback: due to the number of images involved, this look-up table would be huge, and memory is very tight in this program already to the number of large images being moved in and out of memory all the time.

2. Access the members, using the numerical version of member() i.e. member(membernum,castnum). This has the added advantage of actually being faster when the image exists as well. Drawback: The images are sorted by level into different casts, but are not guarrenteed to be sorted correctly within those casts. I think they are, but there are thouands of images to check.

Ideally, I'd like a method of determining whether a castmember of a given "name" exists and have failure returned a lot faster than it is using member(name). I'm probably going to go ahead with option 2, but if any of you out there have any other ideas, I'd love to hear them.

Thanks in advance,

Kevan Dettelbach
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[email protected]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to