Many, many sprites and performance
by Rich Marinaccio · in Torque Game Builder · 08/12/2009 (5:53 pm) · 4 replies
I am going to be making a strategy game on a large hex map, and I'm trying to figure out if TGB can help me. I've run some simple feasability testing and I need some advice. I have read in the forums that you can only do hex maps with sprites in TGB.
I need a large hex map, 150*150 or 22500 tiles and I need the player to be able to zoom out to see a large part of it if not all of it. Just for kicks, I went ahead and simply added 22500 t2dStaticSprites using the same imagemap to the scenegraph in a regular grid formation. That's probably not the right way to do this, and as expected, the framerate after adding them all was about 1 fps. I also tried imagemaps of different sizes, and niether the size of the source bitmap or the destination size actually seemed to make a difference.
Normally, in a standard graphics library, blitting the same image around is not a big deal, especially if you don't need to update the information every frame. I figure there's got to be a better way to blit the same sprite all over the screen in TGB. Can someone enlighten me on how this is supposed to be done?
I need a large hex map, 150*150 or 22500 tiles and I need the player to be able to zoom out to see a large part of it if not all of it. Just for kicks, I went ahead and simply added 22500 t2dStaticSprites using the same imagemap to the scenegraph in a regular grid formation. That's probably not the right way to do this, and as expected, the framerate after adding them all was about 1 fps. I also tried imagemaps of different sizes, and niether the size of the source bitmap or the destination size actually seemed to make a difference.
Normally, in a standard graphics library, blitting the same image around is not a big deal, especially if you don't need to update the information every frame. I figure there's got to be a better way to blit the same sprite all over the screen in TGB. Can someone enlighten me on how this is supposed to be done?
#2
08/12/2009 (7:15 pm)
Oh really? I guess I've been reading that tile map contents do need to be square. If not, having two staggered tile maps might be a good solution. I'll see if I can get that working tomorrow. Thank you.
#3
08/13/2009 (9:16 am)
Your suggestion seems to work. The problem is that I can't use filtering, because the filterPad trick only works with square tiles. Theres a dark line between each hex row. That means I can't zoom the camera in and out. I'll have to have a 'zoom in' view and a 'zoom out' view I guess, made with different size imagemaps.
#4
08/13/2009 (9:52 am)
On the other hand, If I size my hexes correctly, I could use pieces of hexes in a single rectangular tile layer using rectangular image maps. I just need stop thinking outside the box and think back *in* it. Nyuk, nyuk.
Torque Owner Greg Beauchesne
Hex maps basically alternate their start points each row (or each column, depending on how your hexagons are oriented) and the tiles in a tile map need not be square. Therefore, you could use one tile map for your odd rows/columns, and the other (half a cell over) for your even rows/columns.