Another week well spent on SEGA System 16B development. One hardware feature I added this week is sprite scaling. This one is very interesting because it isn't that common but from a hardware point of view, it's rather "cheap" to implement.
S16B can only scale down as much as a 0.5 factor. It goes from 1x to 0.5x in a total of 32 steps and the way it's done is by simply summing up a number. Let's see how it works for the sprite height.
If you didn't have to scale the sprite, you would just paint all lines. If you wanted to scale it down by 0.5, you would draw every other line. But how do you do it if you want to scale by something between 1 and 0.5?
The trick is to set the scale factor as an integer (0 to 31 in S16B). Each time you draw a line you accumulate that integer up. If it goes above a certain value (32 in S16B), then you skip the line and you remove that value from the sum. Then continue with the next line.
For example, suppose the scale figure is 24. On your first line, you start fresh at 24 and draw the line. For the next one, 24+24=48, it is over 32, so you skip the line and take the accumulator to 48-32=16. The next line is 16+24=30, so you draw it. The next one would be 30+24=54, you skip it and adjust the accumulator to 54-32=22. And so on.
It is a process that only involves simple arithmetic and achieves an awesome result
Where was this used? Well, in many places. Just to name a few in Altered Beast
-The boss size-up animation
-The beast eyes in the intro
-The wolves become a power-up sphere
-The power smoke when you kick
-The bubbles
-Some hit sprites are shown at a fixed scaled down size
Note that it cannot scale up, so the boss animation squeezes a large sprite into a smaller one, not the other way around.
If everything goes well, we should have a few System 16B games for an update next week.
See you there!
Español
Otra semana bien invertida en el desarrollo de SEGA System 16B. Una característica de hardware que agregué esta semana es el escalado de sprites. Este es muy interesante porque no es tan común, pero desde el punto de vista del hardware, es bastante "barato" de hacer.
S16B solo puede reducir la escala hasta un factor de 0,5. Va de 1x a 0.5x en un total de 32 pasos y la forma en que se hace es simplemente sumando un número. Veamos cómo funciona para la altura del sprite.
Si no tuviera que escalar el sprite, simplemente pintaría todas las líneas. Si quisiera reducirlo en 0.5, dibujaría cada dos líneas. Pero, ¿cómo lo haces si quieres escalar en algo entre 1 y 0,5?
El truco consiste en establecer el factor de escala como un número entero (de 0 a 31 en S16B). Cada vez que se evalua una línea, acumula ese número entero. Si supera un cierto valor (32 en S16B), omite la línea y elimina ese valor de la suma, en caso contrario la pinta. Luego continúa con la siguiente línea.
Por ejemplo, supón que la cifra de escala es 24. En la primera línea, comienza en 24 y la dibuja. Para la siguiente, 24 + 24 = 48, está por encima de 32, por lo que se salta la línea y lleva el acumulador a 48-32 = 16. La siguiente línea es 16 + 24 = 30, así que la dibuja. El siguiente sería 30 + 24 = 54, la omite y ajusta el acumulador a 54-32 = 22. Y así seguiría.
Es un proceso que solo involucra aritmética simple y logra un resultado asombroso.
¿Dónde se usó esto? Bueno, en muchos lugares. Solo por nombrar algunos en Altered Beast
-La animación en la que el jefe se hace gigante
-Los ojos de la bestia en la introducción
-Los lobos se convierten en una esfera de potenciadores
-El poder del humo cuando pateas
-Las burbujas
-Algunos sprites de impacto se muestran en un tamaño reducido fijo
Como no se puede aumentar de tamaño, la animación del jefe comprime un objeto grande en uno más pequeño, no al revés.
Si todo va bien, deberíamos tener algunos juegos del Sistema 16B para una actualización la próxima semana.
¡Te veo allí!
GeorgeSpinner
2021-07-23 05:30:12 +0000 UTCCasey Watkins
2021-07-18 20:14:20 +0000 UTC