   A better way of templating tiles
  HI!About a week ago, I have made like 46 tiles (64x64) for my sidescroll game. Now I have over 200 tiles. My problem is how to template such a huge amount. Before I used Photoshop''s guide feature but that was about 30 tiles in total so there was never a problem making guides with multiples of 64 but now that it''s over 200, it is a big problem. Not that I''m being lazy, but is there any program that can do the templating for me so that it''s not much of a hassle (espacially now that my semester is ending). THANKS IN ADVANCE!! 
  please define "templating" ;  HI leiavoia!Templating means to divide a certain number of bitmaps into equal sizes (my tiles are all in 64x64 dimensions) and you put them all in just one bitmap. In my case, I have now over 200 tiles. I need to templatize them so that I don''t have 200 separate bitmaps in my game (THAT''S BIG!!) so all I have is one bitmap that includes all those 200 tiles and I just wrote a particular code in my program that extracts a certain tile from the template. It''s that effective than having separate bitmaps except of course if you just have less than 10 bitmaps then probably it''s not worth templating. I hope I didn''t sound confusing. ;  What''s wrong with having 200 bitmaps? Why is that worse that having 1 bitmap 200x the size? If you are using a 3D API to animate the tiles.. then I get your point, but the cost of binding textures is not that great, as long as the texture is resident in texture memory. Then again... 200 64x64 ones fit in a single 1024x1024 texture (in fact... 256 do). In general, it should be fairly straigtforward to automate the process of putting them all onto one texture. You just see home many there are... take the square root of that number... do 64x that number... and round up to the nearest power of 2... then that''s your texture size... then just tile them by blitting them all into one big bitmap (or whatever is appropriate for your API). A simple bit of modulo arithmetic will make sure they tile, and make addressing them with a single index straightforward. ;  That really isn''t that many.  In Civ3, there were 81 tiles per base tile transition.  They didn''t have tiles per se, but rather a ''tile'' was the transition between it''s corners.  There were about a thousand base tiles (more once the expansions came out) and then there were overlays on top of them.They grouped them into a gridded layout in the bitmap files. ;  HI again!Thanks for the feedback guys. Basically I''m just starting out a sidescroll game and I''m just using DirectDraw for that. Now for dmounty, certainly I chose to templatize my tiles so that I''ll only be using one surface only. Not only that, but it will save my time on initializing every surface supposed that all my tiles are separated. Since you guys seem to be very adept at this, any suggestions of alternative ways for organizing my tiles? Oh! since I''m just starting out and going all solo in this, 200 is really many to me. THANKS!! ;  well memory concerns are not a big deal these days when we measure RAM in GB and the minimum for most people is 128MB and even that is kind of low. I say program the way that feels clean and simple. "Templating" is a messy way to do it and IMHO will probably not save you much space. Also, the game needs to use some kind of graphic surface for each tile you place, so when you go from template -> surface you are wasting a lot of copy/paste overhead i''d think, could be wrong.Now i have about ~100 tiles in my game right now, and prbably will have many more before it''s done. They are all seperate files. They are all PNG images and compress very well. Some of the files are less than 100 *bytes*. Most of my 64px tiles are around ~8k. Do you think that''s a lot? I don''t. I''d recommend just keeping them as seperate files and forget the template jazz. They are easier to update and distribute that way as well. ;  Your 100 byte file may be a lot larger than that on your disk depending on the minimum file size on your drive.  Those small files may be taking up a lot (by a factor of 10 or 20 or more) more disk space than if you put them together.  PNG compression works as well on big files too. ;  Speaking in terms of image file compression, your compressed image files get uncompressed when placed onto a memory surface. So no matter if you use bmp, jpg, gif, or png... although they have different file sizes, a 32x32 image of any file format will use the same amount of memory as any other 32x32 image file once it is loaded to a memory surface for use in a game. As for using templated images or tilesets as I call them, it is mostly preference AFAIK. I myself prefer to keep same size/type tiles in the same file because it is easier for me to manage, but I am sure there are arguments against this as well. The only minus to keeping multiple tile images in a single file would be that some graphics cards change the surface memory to be a power of 2 sizes (32,64,128,512...) which could be a waste of valuable resources depending on the desired vs actual surface size. But for the most part, I believe it is all preference. As for an easy way to tile a bunch of individual tiles into a single file, you can easily write a program to load image files from a directory and blit them to a single file in the way that you choose or do the opposite as in take a single file and break it into multiple image files.  Evillive2E-Mail