Karoshi MSX Community
05 de Julio de 2021, 07:48:45 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 [2] 3 4 ... 6
  Imprimir  
Autor Tema: Evitando la "Regla del 5º Sprite" (antes "Snippets")  (Leído 37532 veces)
0 Usuarios y 1 Visitante están viendo este tema.
ARTRAG
Visitante
« Respuesta #15 : 04 de Octubre de 2006, 09:56:17 am »

You see, if you need more than 10 sprites, copyng up to 128bytes each time can be heavvy.

PS
collision detection ?
you mean 5h sprite
En línea
Jon_Cortazar
Administrator
Karoshi Forum's God
********
Mensajes: 2777



WWW Email
« Respuesta #16 : 04 de Octubre de 2006, 10:02:21 am »

You see, if you need more than 10 sprites, copyng up to 128bytes each time can be heavvy.
Nah, transferring 128 bytes RAM to RAM it is not that heavy  Wink

Citar
collision detection ?. you mean 5h sprite
Yeah, sorry Cheesy
En línea

Jon Cortázar Abraido (aka El Viejo Archivero)
RELEVO Videogames
[Dioniso: La cafeína está haciendo su trabajo; yo espero hacer el mío.]
[pitpan: Me sigue pareciendo más productivo jugar al SNAIL MAZE que seguir esta discusión.]
jltursan
Karoshi Forum's Guru
*******
Mensajes: 1516


¿Que es lo que has aprendido hoy?


WWW Email
« Respuesta #17 : 04 de Octubre de 2006, 11:00:21 am »

If I've understand both routines, you can merge them adding to the Viejo's cycling the 5th sprite detection as you don't need to shift the data if the bit flag is not set; this way you can save some work. Roll Eyes
En línea

Doom dee doom dee doom
ARTRAG
Visitante
« Respuesta #18 : 04 de Octubre de 2006, 11:11:09 am »

Huh
if the 5th sprite flag is not set, my code does not cycle, you only copy the used part of the SAT from ram to vram


It should be interesting to see under which conditions the two approaches
(LDIR and two step RAM->VRAM transfer) are equivalent and
when one is better of the other.
(a part from RAM consumption  Smiley
En línea
Jon_Cortazar
Administrator
Karoshi Forum's God
********
Mensajes: 2777



WWW Email
« Respuesta #19 : 04 de Octubre de 2006, 11:25:47 am »

Note that the routine must be really fast in VRAM transfers because a *good* flickering routine is one that works at full fps to make the flickering less noticeable. I think both are ok. Wink
En línea

Jon Cortázar Abraido (aka El Viejo Archivero)
RELEVO Videogames
[Dioniso: La cafeína está haciendo su trabajo; yo espero hacer el mío.]
[pitpan: Me sigue pareciendo más productivo jugar al SNAIL MAZE que seguir esta discusión.]
jltursan
Karoshi Forum's Guru
*******
Mensajes: 1516


¿Que es lo que has aprendido hoy?


WWW Email
« Respuesta #20 : 04 de Octubre de 2006, 02:44:50 pm »

Citar
Huh
if the 5th sprite flag is not set, my code does not cycle, you only copy the used part of the SAT from ram to vram

Not your routine, Viejo's one.

Citar
a *good* flickering routine is one that works at full fps to make the flickering less noticeable

..and of course with the lesser number of sprites flickering.

Anyway, with the rotating technique, if you have, for example 8 sprites in a row (from a total of 10 sprites):

FRAME 1: 0 1 2 3 4 5 6 7 8 9 ; sprites 4 5 6 7 are hidden, 8 9 not used
FRAME 2: 1 2 3 4 5 6 7 8 9 0 ; sprites 5 6 7 8 are hidden
FRAME 3: 2 3 4 5 6 7 8 9 0 1 ; sprites 6 7 8 9 are hidden
FRAME 4: 3 4 5 6 7 8 9 0 1 2 ; sprites 7 8 9 0 are hidden
FRAME 5: 4 5 6 7 8 9 0 1 2 3 ; sprites 8 9 0 1 are hidden

AFAICS shifting only one plane every frame could produce some heavy flickering on some sprites, I mean that in the above example, the initially hidden sprites 4 to 7 will remain hidden till four frames later when all four sprites will render visible; so in the worst case a sprite could remain hidden for 4 frames and in the less severe one, is hidden only 1 frame.

I think that if the attribute table is dump not every plane (adding 4 every frame) but every 4 planes (adding 16) you can achieve the fastest rotation speed and so minimize the flickering rate.


En línea

Doom dee doom dee doom
ARTRAG
Visitante
« Respuesta #21 : 04 de Octubre de 2006, 11:40:49 pm »

my routine, if the 5th sprite flag is not set, does not cycle

read the asm

Código:
    in  a,(0x99)
    ld  (_vdps0),a

    jp  z,_end
   
    bit 06h,a
    jp  z,3f           

....

Código:
3:
    ld  a,SAT & 255
    out (0x99),a
    ld  a,SAT/256 | 64
    out (0x99),a

    xor a
    ld  (_curr_plan),a

    ld  hl,_sprt
    ld  c,0x98
    ld  a,(_n_sprt)
    ld  b,a
    otir
   
1:
    ld  a,208
    out (0x98),a   
    xor a
    ld  (_ready),a

_end:       
    ex  af,af'
    exx
    ei
    ret

it means that it does not cycle if there is no 5th sprite,
you can trust me if you do not see it

about your example there is a mess between sprite planes and sprite numbres

say that you display 10 sprites

A B C D E F G H I L

and that

A B C D E F G H are on the same line and are on planes 0 1 2 3 4 5 6 7,
while I & L are elsewhere on planes 8 9

the initial association sprite/planes looks like this
A B C D E F G H I L
0 1 2 3 4 5 6 7 8 9

step 1)
E F G H are hidden by A B C D, (I & L are visible), S0 -> 4
my routine rearranges the sprites like this:

E F G H I L A B C D
0 1 2 3 4 5 6 7 8 9

step 2)
A B C D are hidden by E F G H, (not by I & L that are elsewhere), S0->6
my routine rearranges the sprites like this:

A B C D E F G H I L
0 1 2 3 4 5 6 7 8 9

and so on.

As you can see the routine works perfectly, only the sprites that should disappear actually disappear
and their flickering frequency is 25Hz, i.e. the best you can get on MSX1 and 8 sprites on the same line

[edit]
Now I see your point, you was referring to the Viejo's solution, with fixed increment of the offset
Sorry I misunderstood, I tougnt you was referring to the offset guided by S0,
Yes, the problem you mention can occur with the Viejo's solution.
[/edit]
« Última modificación: 05 de Octubre de 2006, 01:21:21 pm por ARTRAG » En línea
jltursan
Karoshi Forum's Guru
*******
Mensajes: 1516


¿Que es lo que has aprendido hoy?


WWW Email
« Respuesta #22 : 05 de Octubre de 2006, 12:01:45 am »

Uh?, I know that your routine don't rotate the sprite planes, I'm talking about the one used by Viejo's forthcoming game, "Infinity". Here's the main loop of his routine :

Citar
Código:
flickering_offset=0

.flicker_routine
create the mirror from SPRITE_ATRIBUTES1 into SPRITE_ATRIBUTES2
final_adress=SPRITE_ATRIBUTES1+flickering_offset
send to vram (spratr) from FINAL_ADRESS the amount of 40 bytes
flickering_offset=flickering_offset+4
if flickering_offset=40 then flickering_offset=0
end

Maybe I'm wrong; but I think that it's possible to reduce the flickering just modifying the value added to offset.
En línea

Doom dee doom dee doom
ARTRAG
Visitante
« Respuesta #23 : 05 de Octubre de 2006, 12:10:53 am »

both routines rotate the sprites, one cyclically (his), one guided by the VDP S0 (mine),
apart this aspect (that is the sole true difference from the point of view of the final effect),
his code rotates the sprites with a duplication of the sprite attributes in RAM,
my code rotates the sprites with a two step ram->vram copy.
Those latter are unessential details related to the implementation, not to the algorithm


[edit]
Now I see your point, you was referring to the Viejo's solution, with fixed increment of the offset
Sorry I misunderstood, I tougnt you was referring to the offset guided by S0,
Yes, the problem you mention can occur with the Viejo's solution.
[/edit]
« Última modificación: 05 de Octubre de 2006, 01:23:35 pm por ARTRAG » En línea
WYZ
Visitante
« Respuesta #24 : 05 de Octubre de 2006, 01:27:36 pm »

I think my method is the best:

- Rotate the screen 90º instead of rotate sprites.

Then is possible to see 32 sprites in the same horizontal row without flickering at all. Cheesy
En línea
jltursan
Karoshi Forum's Guru
*******
Mensajes: 1516


¿Que es lo que has aprendido hoy?


WWW Email
« Respuesta #25 : 05 de Octubre de 2006, 02:41:38 pm »

Citar
Now I see your point, you was referring to the Viejo's solution, with fixed increment of the offset
Sorry I misunderstood, I tougnt you was referring to the offset guided by S0,
Yes, the problem you mention can occur with the Viejo's solution.

Right; but anyway I've been thinking about it and there're some other hidden problems. As I'm getting curious about the display quality I'll try to implement every solution posted here together in a sprite demo. I want to see the routines working on screen  Smiley

Citar
I think my method is the best:

- Rotate the screen 90º instead of rotate sprites.

Then is possible to see 32 sprites in the same horizontal row without flickering at all.

Indeed! Cheesy
En línea

Doom dee doom dee doom
Jon_Cortazar
Administrator
Karoshi Forum's God
********
Mensajes: 2777



WWW Email
« Respuesta #26 : 05 de Octubre de 2006, 04:08:22 pm »

I think my method is the best:
- Rotate the screen 90º instead of rotate sprites.
Then is possible to see 32 sprites in the same horizontal row without flickering at all. Cheesy
W00t?, and having just 4 sprites in each vertical column?... that would be far worse!!!  Cheesy Cheesy Cheesy
En línea

Jon Cortázar Abraido (aka El Viejo Archivero)
RELEVO Videogames
[Dioniso: La cafeína está haciendo su trabajo; yo espero hacer el mío.]
[pitpan: Me sigue pareciendo más productivo jugar al SNAIL MAZE que seguir esta discusión.]
ARTRAG
Visitante
« Respuesta #27 : 05 de Octubre de 2006, 04:55:15 pm »

Citar
Now I see your point, you was referring to the Viejo's solution, with fixed increment of the offset
Sorry I misunderstood, I tougnt you was referring to the offset guided by S0,
Yes, the problem you mention can occur with the Viejo's solution.

Right; but anyway I've been thinking about it and there're some other hidden problems. As I'm getting curious about the display quality I'll try to implement every solution posted here together in a sprite demo. I want to see the routines working on screen  Smiley


Do not forget to update the SAT in RAM at each interrupt and set _ready = 1
If you do not set _ready = 1 at each interrupt the routine does not work

IMHO you could remove the _ready test, it is actually usefull only in my program

let me know the results of the comparison!

PS
naturally my solution is the best Grin Grin Grin
(sometime)
« Última modificación: 05 de Octubre de 2006, 04:58:22 pm por ARTRAG » En línea
WYZ
Visitante
« Respuesta #28 : 05 de Octubre de 2006, 11:19:12 pm »

I think my method is the best:
- Rotate the screen 90º instead of rotate sprites.
Then is possible to see 32 sprites in the same horizontal row without flickering at all. Cheesy
W00t?, and having just 4 sprites in each vertical column?... that would be far worse!!!  Cheesy Cheesy Cheesy

ooops!! Then aply the above mentioned methods Grin
« Última modificación: 05 de Octubre de 2006, 11:20:45 pm por WYZ » En línea
burguera
Visitante
« Respuesta #29 : 05 de Octubre de 2006, 11:40:47 pm »

Ups... and what about rotating the screen 50 times per second? One hand to rotate the screen, the other for the joystick... I'm sure no flickering would be seen by the user ;-)
En línea
Páginas: 1 [2] 3 4 ... 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!