Array Tlist and leaks

BlitzMax Forums/BlitzMax Beginners Area/Array Tlist and leaks

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Haha, well let's hope he's more professional than me!

Edit: this problem was solved and I went for another solution.

I got a minor question. I'm using rather large grid cells now, think the size of a Zelda screen. So I figured that I'd give each object in a cell an X,Y polarity that indicates how close it is to an edge (-1,0,+1 for X and Y). This way I won't have to check the 8 surrounding screens (cells), but only the one the object is on, and possibly one above or to the sides, or if the polarity is in a corner, I check 4 screens in total. You can see the center 0,0 polarity of each screen here, drawn as a grey solid square.

(Image removed, serverspace troubles)

Now I got greedy, and thought why not use the polarity of the object I'm checking against aswell? If the 'Hero' has a top edge polarity, I only need to check 'Pythagoras' against objects in the screen above with a bottom edge polarity.

I basically have 3 sets of X,Y variables that I can use to produce a True or False to check for Pythagoras. Looks like this. Green is the allowed 'enemy' polarities (either 1 or 2 steps away), Blue is the relative screen coordinate (cell), and black would be the player standing in a corner.

(Image removed, serverspace troubles)

I have failed to produce a good formula for this, and the problem should be simple.


Now here's the question: Is the polarity thing completely retarded? Should I just grab the bull by its horns and skip polarity, and just check all 8 surrounding cells instead, but make them smaller to limit the amount of objects likely to be inside? This will consume more memory of course, and objects will change cells more often. How much does a TList cost in terms of memory?

I want to make something like 1000 objects and maybe have a playfield the size of 20*20 screens, or larger. Enemy population will be along the lines of Zelda.