Theorical question about the planes
Moderator: Stef
Theorical question about the planes
how to fast draw compressed images ("-1" in gfx.res) on the planes for real-time animation consisting of 2 or 3 frames ?
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Theorical question about the planes
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.
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
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.
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
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
if do not use compression then picture is updated faster, but the lag is still there.
Re: Theorical question about the planes
however, mirroring planes useful in the development of top-down games for generate terrain.
for example:
for example:
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Theorical question about the planes
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
how to fast fill a PLANE of the array identical pictures (for example 32*32 or 64*64 each picture) directly from VDP-RAM
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Theorical question about the planes
Not sure to understand what you mean, fast fill tilemap ? Or fast fill tile data ?
Re: Theorical question about the planes
let us suppose have a picture img1 (size 32*32)
if to do
then it turns out that every time the image is decompressed from the ROM in the VDP-RAM.
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);
}
}
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Theorical question about the planes
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 :alko wrote:let us suppose have a picture img1 (size 32*32)
if to dothen it turns out that every time the image is decompressed from the ROM in the VDP-RAM.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); } }
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);
}
}
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Theorical question about the planes
Err no... You have to modify the tilemap and set it to transparent tiles only :-/