Karoshi MSX Community
05 de Julio de 2021, 07:47:07 pm *
Bienvenido(a), Visitante. Por favor, ingresa o regístrate.

Ingresar con nombre de usuario, contraseña y duración de la sesión
Noticias:
 
   Inicio   Ayuda Buscar Ingresar Registrarse  
Páginas: 1 ... 4 5 [6]
  Imprimir  
Autor Tema: Evitando la "Regla del 5º Sprite" (antes "Snippets")  (Leído 37531 veces)
0 Usuarios y 1 Visitante están viendo este tema.
WYZ
Visitante
« Respuesta #75 : 28 de Octubre de 2006, 05:57:39 pm »

JL, no se a que se debe exactamente pero el método dinamico no funciona (al menos en BlueMSX y OpenMSX) si activas "sprites magnificados". 
En línea
ARTRAG
Visitante
« Respuesta #76 : 28 de Octubre de 2006, 06:38:31 pm »

@WYZ
open and blue have strange differences in the managemnt of the S0 register
actually "plane swapping" works on both, but the ennanced version main+detail
for example doesn't...
it could be a matter of errors in the HW emulation....
En línea
WYZ
Visitante
« Respuesta #77 : 28 de Octubre de 2006, 06:43:42 pm »

Yes,It seem to be as you said a HW emulation bug.
En línea
jltursan
Karoshi Forum's Guru
*******
Mensajes: 1516


¿Que es lo que has aprendido hoy?


WWW Email
« Respuesta #78 : 29 de Octubre de 2006, 10:13:46 am »

¿sprites magnificados?, ¿lo haceis modificando el código de la demo, verdad?. Ya es raro que no funcione, después de todo la diferencia entre ambos modos es únicamente que el VDP multiplica por 2 la altura del sprite a la hora de buscar solapamientos en el eje Y.
Tal como dice ARTRAG, debe de haber alguna inconsistencia en el tratamiento de los planos de sprite.

Btw, I like the "main+detail" method, very elaborated!. Although it requires some previous game planning about sprites ordering, it could lead to very good results Smiley. I'll be short of time this week; but I'm thinking on a new general method wich involves Y coordinates sorting.
En línea

Doom dee doom dee doom
ARTRAG
Visitante
« Respuesta #79 : 29 de Octubre de 2006, 10:25:46 am »

I have a working implementation of the main+detail method
but in order to make it work I passed to the ugly fixed cycling...
This is due to the fact that open and blue does not support
the 5th plane in S0 in the same way

Código:
void  satswap  (void){
   
    v99 = SAT & 255;
    v99 = SAT/256 | 64;

    if  (vdps0 & 64) {
   
        if (Q>=M) {
            Q=0;
            vcopy(0,M-1);     //  [0,M-1] -> 0
            }
        else
            {
            vcopy(Q,M-1);     //  [Q,M-1] -> 0
            vcopy(0,Q-1);     //  [0,Q-1] -> M-Q           
            }
        Q+=4;
        if  (P>=N)  {
            P=M;
            vcopy(P,N-1);     //  [P,N-1] -> M
            }
        else
            {               
            vcopy(P,N-1);     //  [P,N-1] -> M
            vcopy(M,P-1);     //  [M,P-1] -> M+N-P
            }
        P+=4;   
        }
    else
    {
        P = Q = 0;
        vcopy(0,N-1);
    }
    v98 = 208;

    ei();
}

for now I stay with this but the matter on how the 5th plane works in the real HW needs more investigation
and open and blue need a refinement (a bug fix I'd say) ....
En línea
jltursan
Karoshi Forum's Guru
*******
Mensajes: 1516


¿Que es lo que has aprendido hoy?


WWW Email
« Respuesta #80 : 29 de Octubre de 2006, 11:18:33 am »

Maybe we'll need to move this to MRC... Undecided
En línea

Doom dee doom dee doom
WYZ
Visitante
« Respuesta #81 : 29 de Octubre de 2006, 02:23:36 pm »

JL, si simplemente he cambiado:

Código:
        ld     a,(#f3e0) 
        or     #02     -> #03   
        ld     b,a       
        ld     c,#01     
        call   #0047   


Tambien, en algunas pruebas he notado que es mas rapido manejar sprites magnificados, de alguna manera es mas rapido de dibujar para el emulador. Intentaré hacer alguna test.
En línea
SEPPASEPPA
Karoshi Newbie
*
Mensajes: 24


Email
« Respuesta #82 : 29 de Octubre de 2006, 02:38:41 pm »

I have a working implementation of the main+detail method
but in order to make it work I passed to the ugly fixed cycling...
This is due to the fact that open and blue does not support
the 5th plane in S0 in the same way

Código:
void  satswap  (void){
   
    v99 = SAT & 255;
    v99 = SAT/256 | 64;

    if  (vdps0 & 64) {
   
        if (Q>=M) {
            Q=0;
            vcopy(0,M-1);     //  [0,M-1] -> 0
            }
        else
            {
            vcopy(Q,M-1);     //  [Q,M-1] -> 0
            vcopy(0,Q-1);     //  [0,Q-1] -> M-Q           
            }
        Q+=4;
        if  (P>=N)  {
            P=M;
            vcopy(P,N-1);     //  [P,N-1] -> M
            }
        else
            {               
            vcopy(P,N-1);     //  [P,N-1] -> M
            vcopy(M,P-1);     //  [M,P-1] -> M+N-P
            }
        P+=4;   
        }
    else
    {
        P = Q = 0;
        vcopy(0,N-1);
    }
    v98 = 208;

    ei();
}

for now I stay with this but the matter on how the 5th plane works in the real HW needs more investigation
and open and blue need a refinement (a bug fix I'd say) ....


The real challenge is on msx2, where you also had to sprite color tables;
so rotating the sprite planes is not so efficient.

I've done a routine that could handle a max of 16 sprites. In this scenario, i keep fixed the low sprite planes (0-3) and i start removing the higher planes starting from the plane 4  number and increasing it until i moved more than 8 sprites or i reach the vdp's s0 plane.

if (there_are_to_many_sprites)
{

    vdpplane = vdp(0) and 31
    for (i=4, sprcount=0;i>vdpplane && sprcount<8;i++,sprcount++)
    {
         vpoke sat+4*i,216  // remove the sprite
    }
}


When the vdp stop signalling 'too many sprites' i restore the missing sprites.

En línea
ARTRAG
Visitante
« Respuesta #83 : 29 de Octubre de 2006, 06:22:24 pm »

IMHO very bad and crappy strategy. I cannot see when and why it could be used...
you get lots of frames where the sprites are hidden or deleted !!
En línea
SEPPASEPPA
Karoshi Newbie
*
Mensajes: 24


Email
« Respuesta #84 : 29 de Octubre de 2006, 11:25:21 pm »

IMHO very bad and crappy strategy. I cannot see when and why it could be used...
you get lots of frames where the sprites are hidden or deleted !!

That's the point: it's not heavy, but far,far far from a good result.
What i need is a algo that does not rotate the planes because doing so involve also the rotation of sprite color attributes...
Any idea?
En línea
SEPPASEPPA
Karoshi Newbie
*
Mensajes: 24


Email
« Respuesta #85 : 30 de Octubre de 2006, 09:06:59 pm »

IMHO very bad and crappy strategy. I cannot see when and why it could be used...
you get lots of frames where the sprites are hidden or deleted !!

No, there is a misunderstanding, the time for disabled sprite neither greater or less than when using other methods.
for example assume that we have the same condition:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

frame 1: the vdp will report in s0 the value 8, then i will remove the planes from 4-7
frame 2: the vdp show the sprites 0-3 and 8-9-10-11 and will report the sprite 12 in s0, so i will remove sprites 8-9-10-11
frame 3: the vdp show the sprites 0-3 and 12 to 15 without reporting any problem, i will restore the situation in frame 1

So excluding the fact that the sprites 0-3 are fixed (because i WANT this, by design) every sprite block is showed for 1/3 of the entire time.
If we accept to work on a 8 sprite basis when removing the sprites the frames required to this situation are 2 so the result is the same of the other methods.

En línea
ARTRAG
Visitante
« Respuesta #86 : 31 de Octubre de 2006, 10:07:28 am »

Now I see, when you say "remove" you mean placing the sprite outside the
screen (e.g. y=212), not skipping its plane in the SAT when you update it.
Assuming you mean this, everything make sense, as rotating the SAT in
sprite mode 2 is absolutely cumbersome (512+128=640 bytes per frame).

BTW, the case you depicted is a bit "theoretical", in the sense that you cannot
be sure that removing 4 sprites before the one in S0 will guarantee that S0
is displayed... To be sure you should remove at least  S0-7 planes before S0
(and this can imply a HUGE flickering...)

In any case, removing sprites seems the sole valid option in msx2, as rewriting
the SAT and the colortable at 50Hz takes more than 1/3 of the full I/O
bandwidth (unless you do not have all the sprites with the same colors  Tongue )


BTW if I well understand your code, it can be rewritten like this:

if (there_are_to_many_sprites)
{
    vdpplane = vdp(0) and 31;
    maxplane = sat+min(4+8,vdpplane)*4;
    for (i=sat+4*4; i<=maxplane;i+=4)
         vpoke (i,216);  // remove the sprite
}

I do not see why you cancel exactly 8 sprites or less (?)

« Última modificación: 31 de Octubre de 2006, 03:48:41 pm por ARTRAG » En línea
SEPPASEPPA
Karoshi Newbie
*
Mensajes: 24


Email
« Respuesta #87 : 01 de Noviembre de 2006, 07:50:40 pm »

Now I see, when you say "remove" you mean placing the sprite outside the
screen (e.g. y=212), not skipping its plane in the SAT when you update it.
Assuming you mean this, everything make sense, as rotating the SAT in
sprite mode 2 is absolutely cumbersome (512+128=640 bytes per frame).

Yes.

BTW, the case you depicted is a bit "theoretical", in the sense that you cannot
be sure that removing 4 sprites before the one in S0 will guarantee that S0
is displayed... To be sure you should remove at least  S0-7 planes before S0
(and this can imply a HUGE flickering...)

Yes, Assuming i have  16 sprites on the same line aligned, the vdp will report 8.

So, removing only 4 sprites enable the vdp to display at least the sprite number 8-9-10-11 (because i hide the planes 4-7)

Of course the greater number of sprites (max = 8 ) you remove at every frame the higher the flicker frequency you achieve at the cost of a big number of sprites flickering.

In the above situation, removing 8 sprites at each frame will achieve a 25 fps flickering freq.


Basically the algorithm is this:

const nspr = 8;     // number of sprites to remove at each frame;

function int38h()
{
      if (i_have_to_many_sprites)
      {

            updatevramsat(plane_base_index, nspr);  // calling this will update y  pos to 216 starting   at plane_base_index for nspr planes
            plane_base_index+=nspr;  // number of sprites to remove at each frame
      }
      else
      {
            write_Sat_as_Is();   // write the sat without boring of sprite limits
            plane_base_index=0;
      }
}

So i will continue to remove chunks of nspr sprites until the vdp says "OK, no to many sprites". Really i use only the s0 reg to know the overflow situation;

In my specific situation i've added also the option to make the first 4 planes fixed, but this is only because i do not want the main charater to flicker.

If it's not clear feel free to reply to this.  Smiley
« Última modificación: 01 de Noviembre de 2006, 08:14:12 pm por SEPPASEPPA » En línea
ARTRAG
Visitante
« Respuesta #88 : 01 de Noviembre de 2006, 09:47:21 pm »

Try removing S0-7 sprites, as planes are numbered from 0
if you have 9 sprites in the screen, all in the same line, S0=8 and S0-7 =1

By removing 1 sprite, the 9th sprite will appear.

Pick the sprite to remove at random, or at lest in a way that the
removed plane is always different

If you have more that 10 sprites, at step 1 you remove 1 sprite, the 9th will appear, but S0=9
so next time you need to remove S0-7=2 sprites

Again pick the sprite to remove at random, or at lest in a way that the
removed planes are always different

and so on...

the trouble is that when the 9th sprite has a very low plane, you get a lot of flickering
sprites....
If you have only few objects (say 16-20) maybe it could be acceptable
(but IMHO far from good...as the lower is the plane of the 9th sprite, the higher is its "off" time)

A better method would be compare the Y of the sprite in S0 with the Y of the sprites of
plane before S0, and removing the first sprite you find on that line, but this involves extra
processing. Moreover you need, in the worst case, to compare up to S0-8 planes.


« Última modificación: 02 de Noviembre de 2006, 01:19:34 pm por ARTRAG » En línea
Páginas: 1 ... 4 5 [6]
  Imprimir  
 
Ir a:  

Impulsado por MySQL Impulsado por PHP Powered by SMF 1.1.21 | SMF © 2013, Simple Machines XHTML 1.0 válido! CSS válido!