Really easy way-
Half your vars and speed rates then double the frame rate.
Make the game run far far smoother.
Really easy way-
Half your vars and speed rates then double the frame rate.
Make the game run far far smoother.
The problem i foresee with that is that it will effectively double the amount of processing power required (correct me if I’m wrong on that). I think I need to work out how to do the bitmap thing, although reading up about it, I dont understand at all what I’m being told to do with it.
Not directly related, but noteworthy:
for(var i9=0;i9<=_root.towerList.length;i9++)
Note that if the length of an array is, for example, 3, then the indices are 0,1 and 2. Your loop will execute for values of 0,1,2 and 3. Something everyone deals with when first using arrays and loops.
Next, how are you storing the A star data?
Wow what a rookie mistake that was… I was fairly new to flash before this, but a professional C++ developer still so should have known a lot better! I’ll put that down to being tired!
Once A* has finished, I store the found route in an array. and store this array in a routeCache. For example routeCache[5,5] = foundRoute; would give the tile with co-ordinates 5,5 the route ‘foundRoute’
The route array is fairly simple, each element on the array contains only the x and y co-ordinates of that part of the route, this corresponds to a tile on the map.
The actual A* part itself has the obvious open lists and closed lists (will be changing the open list to a binary heap now). But also contains data structures so that I can speed up the ‘existsOnClosed()’ function. The tile map is not huge, about 1000 tiles in total. I sped up the existOnClosed() function by adding a new datatype - flaggedOnClosed[][]. Each element on this array corresponds to a tile, and initially all values in this datatype are set to false. Whenever an element is added to the closed list the corresponding 'flaggedOnClosed[][] element is set to true. For example if tile 12,8 is added to the closed list, flaggedOnClosed[12][8] = true. Then when it comes to check whether an item (x,y) is on the closed list or not I can simply return flaggedOnClosed[x][y] rather than scanning through the whole closed list checking whats there. Most of my approaches now seem to be based around taking up a lot of memory in return for speed improvements :S
You mean bitmap rendering, yes it does have its uses and is faster as far as rendering goes.
It does have its draw backs such as if you want to scale a object, the pixels don’t make it look pretty at all which is where vector graphics shines.
Anyways why not try something simple for starters like http://www.8bitrocket.com/newsdisplay.aspx?newspage=6765
Thanks for the link, it looks a really valuable resource. Not being able to scale sprites is fine as I can just pre-make my sprites in different sizes if I need, but the thing I see being the problem is rotating sprites around 360 degrees. I tried this with AS2 and bitmaps and it looked just awful. Should I premake all my sprites facing in a large number of directions or will I not have a problem rotating these sprites in AS3?
Off to read that 8bitrocket site now, thanks very much for that
:: Copyright KIRUPA 2024 //--