   Optimize Rendering Routines
  I''m getting ready to release my first commercially available game, but my min requirements are way higher than i want my target pc to be. The problem seems to be in my world rendering routine.As of now, I am rendering 16x10 40x40 size base tiles. Then I am adding around 30 objects on top of the tiles (don''t cover them completely). Then I add the player sprite and about 6 monster sprites. Then about 80 40x80 wall tiles. I do not blit base tiles under the wall tiles because they are covered completely.I am using DX6 and standard Blt() function.This runs fine on my 500mhz system, but my target is about 200-300mhz system and it runs WAY too slow on those systems...What kind of optimizations can I make to speed things up drastically??Thanks 
  Store your tiles in video memory if you''re not already doing it. Also, what color depth are you using ? 16 bpp is obviously faster than 32 bpp. ;  Yeah i''m using 16bpp. I know this is a stupid question, but how exactly do you asure that your images are getting stored in vid memory instead of system memory? and Does this have any downfalls? ;  System memory is slower because it has to send the data to the video card as compared to having the data already there. When I worked with DD6, I remember having to create the surfaces in video memory first. If the call failed, then create it in system memory. If that failed, then return an error because the surface could not be created. The docs will tell you which calls to worry about.   ---Brent Gunning | My Site;  Try power of two sized images. Even in 2d these can speed up rendering by quite a bit (noticably so on older systems). This may be quite a bit more work than you intended though.. ;  Yup.Video: DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORYAGP: DDSCAPS_NONLOCALVIDMEM | DDSCAPS_VIDEOMEMORYSystem: DDSCAPS_SYSTEMMEMORYThose go in the ddsCaps.dwCaps of your DDSURFACEDESC* that gets passed to CreateSurface()Many graphics cards can only Blt() between local video memory surfaces, some can also Blt() between non-local (AGP) and local surfaces. Those Blt()''s are usually always performed in hardware at very fast rates.If you''re Blt()ing between system and system, usually that''ll be performed using the CPU rather than the graphics card!If you''re Blt()ing FROM video TO system, it''s often done using the CPU and is also extremely slow.If you''re Blt()int FROM system TO video (or AGP), it''s still quite often done using the CPU and is still slow(ish).AGP -> System, and AGP -> video is also slower than video to video, but still fairly quick.Downsides?1) There''s usually less true video memory than there is AGP memory.2) There''s usually less AGP memory than there is system memory3) You need to make sure you restore the graphics data in lost surfaces (caused by Alt-Tab etc) properly. System memory surfaces let you get away with that.Generally though, as much as possible all Blt()''s should be between video memory and video memory. After that (when you run out of video memory for your surfaces), AGP memory, before finally using system memory.You could also use asynchronous Blt''s so you aren''t sat around for each to complete (I forget the completeness of that within the DX6 DD APIs though).If you''re doing anything with surfaces where you need to Lock() the surfaces regularly to fiddle with individual pixels, you should preferably keep those surfaces in system memory then Blt() them up to video memory surfaces whenever necessary. --Simon O''Connorex  -Creative AsylumProgrammer &Microsoft MVP