News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

The great animation debate.

Started by kevin, February 05, 2006, 01:16:37 PM

Previous topic - Next topic

LemonWizard

I was looking into how some consoles (Snes, nes, gameboy advanced) run pallettes and sprites, and I even used a GBA dev kit, to create a few simple demos to test on my actual gba hardware (GBA SP) using an XBOO cable and a build of The Xboo app to transfer rom images of less than 256 KB to my gba.


Basically the way the gba does it is that it creates a pallette in video memory...

Which I think is kind of efficient if images are made up of similiar colors that way if you change one color in the pallete you can dynamically change the look of graphics without having to have hundreds of different images of the same graphic with different colors.

Not really feasable in the case of playbasic atm. But the reason I mentioned this is so I can elaborate on an idea I have.



What if you allowed playbasic to cycle through an animation buffer, and capture a pallette, and then give the pallette a name.
Basically you'd be extracting the pallette for an image.


Something along the lines of :

Switchanimpal (Imagesource, imagedestination, #frames up to, startframe, endframe) Optional?

And for loading animation images..

Myanim=loadanimimageset("foldername")
(Loads the animation image from a folder

OR

Myanim=loadanimimagestrip("Filename"), height, width, transparent color RGB( x, x, x)

set animtransparent() Rgb(x, x, x) ;this would set the transparent color for that animationset

Basically the idea behind these two would for the first one, it would intelligently go through a folder and put together images based on folder index or file index... and stop .. etc. maybe not as easy.

The second one would just load an animation from an image strip, and it would count the frames automatically based on height and width, and automatically calculate the image size etc.

Then

setanimspeed myanim, fps
play anim myanim
stop anim myanim

Also, is there a way we can create sprites that use the animation reference ...

such as

mysprite=newsprite(100, 100, myanim)
setspriteanimFPS 30 ;sets the instance of the animation image for this sprite to 30


or manually.

stepanim myanim ;these would increment the animation instance by one frame
jumptoframe myanim, frame# ;this would jump to a specific frame in the animation instance
playuptoframe myanim startframe#, endframe# ;this would start the animation instance , and play from startframe to finish frame and then return to the last default setting

setdefaultmode myanim, 1
setdefaultmode myanim, 2
setdefaultmode myanim, 3
setdefaultmode myanim, 4, startframe#, endframe#
setdefaultmode myanim, 5

1-Play one frame in synch with the setfps of playbasic
when reach end of frames, restart from index of 0 in instance of animation frames
2-Play one frame in synch with the setfps of playbasic when reach end of frames, reverse order of frames and play through in reverse
3-Play random frames, in a random order (maybe good for particles, or other things?)
4-Play only the frames defined from start to finish
5-staticmode don't play any frames, allow user to increment or step frames manually.


anyways, those are my ideas..maybe even..

blend=createblendedanim(animation1 source, animation2 source, blending/drawmode)
(it would auto calculate the height and width of the final image.. maybe do something like alpha blending two animated images, for special effects in one single animation.)

Those are just some of my ideas.
It helps to know what playbasic is already able to do ^^

kevin


     I don't really see the connection with palette mapped images and frame animation.   Palette mapping makes effects such as colour cycling easier, such as the classic waterfall effect comes to mind.

     In terms of the image construction, then in the specific purpose engine it makes sense to use the whatever data formats suits the effect.  For example, by re-ordering or pre-processing the images pixels, you can make certain effects faster.  Because often in specific (single purpose) routine some calculations become irrelevant and can be removed.     That's all well and good, but PB is generic engine.   

     Originally palette mapping was a necessary,  there was time when chr map & planar were also.   Today through we have chunky pixel formats (16 ->32bit).    The classic 8bit frame buffer stuff is really not supported anymore.    Much like some old resolutions are disappearing  (320*200 for example)   So the only way to implement it is through have palette mapped to chunky conversion.        Generally Palette mapped image has less data, but more memory access.   So the slower the memory or the smaller the cache, the more costly it'd be..   

      A form palette mapping would be possible in 1.64 platform, but that's about it.

LemonWizard

Oh I see.
that's pretty interesting.
So what about those impelentations to do with sprites incorperating an animation set I suggested?