Results 1 to 4 of 4

Thread: Caching Tiles

  1. #1

    Caching Tiles

    Can anyone tell me if this is a good or bad way of approaching my tile based engine...

    I decompress images from my own image library file, and store each image in a TBitmap array. The tiles are all 64 x 64 or 32 x 32 16 bit.

    When I need to blit a tile, I simply get a pointer to the TBitmap and use that to blit to the DX surface.

    I have tested the client so far on about 30 PCs and it runs well, but I have hit a problem on 2 PCs where it fails while loading the image library into TBitmaps. The image library is only about 1Mb in size so far, so that isn't too big.

    Ideas / Comments please. I did wonder if a TBitmap used GDI memory?? Could that be the problem? Ideally I would prefer to store the raw pixel data and just blit that to the DX surface, but it needs s DeviceContext to blit, and I am not 100% sure how DCs work.
    http://www.c5software.co.uk (site is being developed at the moment)

  2. #2

    Caching Tiles

    I'm not sure what you're using DirectX headers(7,9a) or DelphiX, but the method you're currently using is good and not good

    TBitmaps will use windows GDI system memory, which isn't well suited for DirectX.

    The way I would do it in your case would be to decompress the images directly into DirectDraw surfaces in an array, the images being ideally stored in video memory.

    You will see a significant speed increase from using direct draw surfaces in video memory blitting to the back buffer/primary surface.

    Oh, the good bit about the method is that the images are compressed

  3. #3

    Caching Tiles

    Quote Originally Posted by Zanthos
    I'm not sure what you're using DirectX headers(7,9a) or DelphiX, but the method you're currently using is good and not good

    TBitmaps will use windows GDI system memory, which isn't well suited for DirectX.

    The way I would do it in your case would be to decompress the images directly into DirectDraw surfaces in an array, the images being ideally stored in video memory.

    You will see a significant speed increase from using direct draw surfaces in video memory blitting to the back buffer/primary surface.

    Oh, the good bit about the method is that the images are compressed
    Thanks I changed it today, and it seems to fix the crash that was occuring on some ATI cards. But I can't seem to get them to load into video memory?? I need to debug it to find out why, it can't be a memory size limitation as I am using 16Mb max in images so far.
    http://www.c5software.co.uk (site is being developed at the moment)

  4. #4

    Caching Tiles

    I'm presuming you're using this line for your surface caps:

    dwCaps := DDSCAPS_OFFSCREENPLAIN or DDSCAPS_VIDEOMEMORY;

    There may be forces at work which you can't control, which is the entire premise behind DirectX

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •