PDA

View Full Version : Storing a tiled map



Nightmare_82
14-05-2003, 05:06 PM
Hi!
I've made a graphic engine for my roleplay game with the powerdraw components and it works very fine.

But I have one problem : I'm creating a tiled map and every tick I draw each small tile. I want to store the whole map in one Picture or Backbuffer but I don't know how. Can you help me ?

For your information : Each tile is in the same bitmap and the size of each one is 32x32.

LP
16-05-2003, 03:15 AM
Storing it in large bitmap won't speed things much. You'd better order up rendering calls so you first draw all tiles which are the same image / pattern. i.e. if you have a field of (1,1), (2,1), (1,2), (2,2) and the first and the last tiles are the same image (preferably pattern too), you'd first draw these tiles. PowerDraw does buffering which accelerates things.
- Lifepower

Nightmare_82
16-05-2003, 08:23 AM
Are you sure that storing the tiles in a big bitmap won't speed it up?
I have a zooming function and when I scale the card down, the FPS go down to 20...
But when I draw a big bitmap, it's very fast.
The speed is also slow when I always draw the same tiles.
Can you tell me how I can create a big bitmap from small patterns? I want to test it.

LP
17-05-2003, 05:54 AM
Well, you'll have to write image data onto TAGFImage either using Pixels property or locking/unlocking the specified texture. Still, I wouldn't recommend it... it's just a waste of video memory. For reference, how big tiles are you rendering? What texture format and video mode do you use? I'm sure you're having a performance hit somewhere... for our project we used to render 32x32 tiles and it ran pretty fast... what's the FPS of Water example supplied with PowerDraw?

- Lifepower

Nightmare_82
17-05-2003, 11:41 AM
The water example has 280 FPS.
All the tiles have the size 32x32 and my resolution is 1024x768 with 16 bit.
The texture format is D3DFMT_A8R8G8B8.
In my game you can zoom from 50% up to 200%.
But when scale < 70 or 80% the FPS go down fast. Before I used bigger tiles(64x64) and the game ran much faster. So I thought a big image would solve the problem.

If you have time, you can download the game with soure code on
http://mitglied.lycos.de/crazyhunter2/download/cobal4.ace
The Engine is in the unit UPowerDrawEngine.
Thanks for your help so far!

Nightmare_82
17-05-2003, 12:20 PM
Ok, I've solved the problem. Thanks for your help!
When I draw the same tiles successively, FPS ist still fast enough when I scale the map down.