Page 1 of 1

Theorical question about the planes

Posted: Fri Dec 18, 2015 12:13 pm
by alko
how to fast draw compressed images ("-1" in gfx.res) on the planes for real-time animation consisting of 2 or 3 frames ?

Re: Theorical question about the planes

Posted: Fri Dec 18, 2015 1:05 pm
by Stef
There is no way of doing real time fast compressed video.
Even without compression the bandwidth alone is not fast enough to allow fullscreen animation at 20 FPS.
You need to enlarge blank period if you want fast and large animation and so reduce the vertical resolution or you need to reduce the animation resolution (something as 160x128) to get 20 FPS without touching blanking.

Re: Theorical question about the planes

Posted: Fri Dec 18, 2015 4:30 pm
by alko
I do not need a very fast frame rates.
at least to update image does not slow down the gameplay, and that is not visible process of updating pictures.

Code: Select all

main()
{
....
while(1)
{
update_game();
fon_anim();
}
}


static void fon_anim()
{
fon_anim_count++;
if(fon_anim_count==5)
{ 
VDP_drawImageEx(BPLAN, &image1, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, ind), 0, 0, FALSE, TRUE);
//ind += fon1.tileset->numTile;
}
if(fon_anim_count==10){ 
VDP_drawImageEx(BPLAN, &image2, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, ind), 0, 0, FALSE, TRUE);
//ind += fon1.tileset->numTile;
}
if(fon_anim_count>=15)fon_anim_count=0;
}

Re: Theorical question about the planes

Posted: Fri Dec 18, 2015 4:34 pm
by cero
To do it slow, and not have partial updates show, you need to double buffer. Which means: both planes will be used for your animation, nothing left for your game but sprites.

Re: Theorical question about the planes

Posted: Fri Dec 18, 2015 7:46 pm
by alko
if do not use compression then picture is updated faster, but the lag is still there.

Re: Theorical question about the planes

Posted: Sat Dec 26, 2015 4:28 pm
by alko
however, mirroring planes useful in the development of top-down games for generate terrain.

for example:
Image

Re: Theorical question about the planes

Posted: Sat Dec 26, 2015 6:03 pm
by Stef
Of course it is :-) It's why tilemap are always optimized to handle flipped tiles whatever is the compression parameter.

Re: Theorical question about the planes

Posted: Mon Dec 28, 2015 12:33 pm
by alko
how to fast fill a PLANE of the array identical pictures (for example 32*32 or 64*64 each picture) directly from VDP-RAM :?:

Re: Theorical question about the planes

Posted: Mon Dec 28, 2015 2:36 pm
by Stef
Not sure to understand what you mean, fast fill tilemap ? Or fast fill tile data ?

Re: Theorical question about the planes

Posted: Tue Dec 29, 2015 8:20 am
by alko
let us suppose have a picture img1 (size 32*32)
if to do

Code: Select all

int i;
int j;
for(i=0;i<10;i++)
{
for(j=0;j<8;j++)
{
VDP_drawImageEx(BPLAN, &img1, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, ind), i*4, j*4, FALSE, TRUE);
}
}
then it turns out that every time the image is decompressed from the ROM in the VDP-RAM.

Re: Theorical question about the planes

Posted: Tue Dec 29, 2015 11:29 am
by Stef
alko wrote:let us suppose have a picture img1 (size 32*32)
if to do

Code: Select all

int i;
int j;
for(i=0;i<10;i++)
{
for(j=0;j<8;j++)
{
VDP_drawImageEx(BPLAN, &img1, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, ind), i*4, j*4, FALSE, TRUE);
}
}
then it turns out that every time the image is decompressed from the ROM in the VDP-RAM.
Indeed. An image is composed from a TileSet (set of tiles) and a Map (tilemap), here what you want to do it just updating the tilemap in the loop so you can just start by uploading the tileset once then updating the tilemap :

Code: Select all

int i, j;
Map map*;

// upload TileSet of image in VRAM (unpack tileset first if needed)
VDP_loadTileSet(img1.tileset, ind, TRUE);
// load the palette
VDP_setPalette(PAL1, img1.palette->data);
// unpack the map once so we don't do it as each setMap(..) call
map = unpackMap(img.map, NULL);

for(i=0;i<10;i++)
{
  for(j=0;j<8;j++)
  {
    // wait for VSync
    VDP_waitVSync();
    VDP_setMap(VDP_PLAN_B, map, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, ind), i*4, j*4);
  }
}
And that is !

Re: Theorical question about the planes

Posted: Tue Mar 08, 2016 5:36 am
by alko
is possible to set visible or invisible plane ?

Re: Theorical question about the planes

Posted: Tue Mar 08, 2016 8:37 pm
by Stef
Err no... You have to modify the tilemap and set it to transparent tiles only :-/