by EvanBlack » Thu Oct 13, 2011 8:24 am
I solved it by using two arrays to store the tiles Actor* 's, an odd and even arrays.
With the isotiles being small and using a resolution of 800x600, I have to use a 35x35 tile array to fill the entire screen.
If I lower the resolution then I can lower the actor count. But I want to be able to use the higher resolution also.
The problem with the node number and clone index thing, I am not really sure what I would do. The clone index is static, while the nodes are dynamic, semi-random. There is a formula to know exactly which clone will have what node at any given time, but im not a mathematician and I couldn't figure out that formula. Also, the node map can be up to 4 Million Nodes.
The clones move from one side two the other two simulate a never ending map, but their nodes change based on direction. Like a 4 way treadmill.
I cut the search time in half and I no long am getting actors by x,y so I can now move function a bit more functional. Like keeping track of the objects on the tiles and destroying or moving them as necessary.
Im really going to try to limit the calls to destroy and create because anytime I can just move an object or tile to a new spot and just change the animation would be preferable.
But for now.. it works... Once I am all finished, everything working as it should, I will try to optimize my code even more and make functions and search times faster.
Right now its using up extra space in the memory it doesn't need. But they are just integer arrays, I will change them later.
I really need better sorted arrays though, I just don't know enough about them or how I could possibly do it, I even thought about a Binary Tree but it just doesn't make sense for this kind of search. The second thing I thought of was using more than 2 arrays, but I don't know the math involved to sort them. Right now I am using if(node %2 == 0) {store in even array}
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < ). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!