Original Post
hi
Im working on a topdown (world seen from above, not isometric view) tile scroller for a little online game/chat thing. very simple.. no match even for me :-)... but still I have a problem :-(.
speed!.. and I think its probably due to my lame blitting.
I use OpenPTC (a nice little library, which wraps up DirectX, also referred to in flipcode''s Rendering a portal engine - series), which basically gives me a pointer to a linear framebuffer (640x480x256). I then use a library function to copy that into a library-managed directx backbuffer, and another which performs the flip etc.. my tiles are 32x32, 20x15 fills a screen.. I redraw the screen on every frame.. when I scroll one pixel per frame, it looks nice but scroll VERY slow.. oki I then tried scrolling 3 or 5 pixels per screen.. the world is moving quickly but I doesn''t look nice.. it looks like the framerate is too low to fool the eye.. I tried optimizing my blit routine, tried setting PTC to copy direct to vidmen.. PTC should not cause the problem cuz all the demos that comes with it are fast enough.. and if I use only a 320x200 window on the screen it renders remarkbably faster.. so I''ve come to the conclusion that its my blit routines which sucks big time.. I have thought implementing RLE sprites.. but should that really be necessary in these days? I mean its only a simple 2d tile scroller.. should it not be possible to update a 640x480 8 bit display in realtime? GTA does it in 24 bit..
here''s my blit routine:
for (y1 = 0; y1 < height; y1++ )
{
for (x1 = 0; x1 < width; x1++ )
{
fx = x+x1;
fy = y+y1;
if( (fx>=0) && (fx<640) && (fy>=0) && (fy<480))
where[((fy << 9)+(fy << 7))+fx] = *image;
image++;
}
}
the if is the clipping.. the scrolling relies on it
where is a pointer to my frame buffer.. I use the shifting instead of (640*Y)+X - although I saw no speed up after I implemented it.
image is a pointer to the tile data (32x32 bytes)
can anyone help?
pleeeeeeeeas? :-)