Caramelldansen

From ProjectWiki
(Difference between revisions)
Jump to: navigation, search
(What is this?)
(Technical Details)
Line 25: Line 25:
 
==Technical Details==
 
==Technical Details==
 
[[Image:Cdplayback.png|thumb|right|Playback go go go... ^^<br> also note 3 background layers]]
 
[[Image:Cdplayback.png|thumb|right|Playback go go go... ^^<br> also note 3 background layers]]
There are a few ways to do event recording, on [[Thds|thds]] i simply recorded the keypad inputs every frame for instance, but on this one wanted something a bit different. Firstly since it can be played on cards with different loading times and loading of the animation frames may take > one or more vblank intervals, simply recording keypress alone wouldn't stay in sync with the music reliably. Instead here decided to store all events like so:
+
There are a few ways to do event recording, on [[Thds|thds]] i simply recorded the keypad inputs every frame for instance, but on this one were numerous technical considerations that required something a bit different. Firstly since it can be played on cards with different loading times and loading of the animation frames may take > one or more vblank intervals, simply recording keypress alone wouldn't stay in sync with the music reliably. Instead here decided to store all events like so:
 
<source lang="c">
 
<source lang="c">
//Event enumeration
+
//Event enumeration table
 
enum {
 
enum {
ENVT_RESET,
+
ENVT_RESET, //Set all position values back to defaults.
ENVT_ROT,
+
ENVT_ROT,   //rotational angle
ENVT_ZOOM,
+
ENVT_ZOOM,   //image scale
ENVT_SX,
+
ENVT_SX,     //image scroll
 
ENVT_SY,
 
ENVT_SY,
ENVT_XC,
+
ENVT_XC,     //image centering (rotational center)
 
ENVT_YC,
 
ENVT_YC,
ENVT_FADE,
+
ENVT_FADE,   //fade to black
ENVT_FADEINC,
+
ENVT_FADEINC,//fade to white
ENVT_CHANGE,
+
ENVT_CHANGE, //select new animation loop
ENVT_FRATE,
+
ENVT_FRATE, //change framerate
ENVT_FADV
+
ENVT_FADV   //advance a single frame
 
};
 
};
  

Revision as of 07:27, 6 April 2009

Caramell Dansen Instant Movie Create... for NDS!!!

Contents

What is this?

Main menu...

After making the nyanroll and rickroll video players, wanted to make one more based on the Caramell Dansen series of videos. The result is Caramell Dansen Instant Movie Create, which adds a sorta GUI to the previous players and facilitates recording, storing all the real time effects, scene changes, and other datas. In this way it is possible to create sort of 'movies'. :D

Features:

  • Playback animation loops of various framerates up to 20 frames in duration
  • Special effects such as panning, scaling, rotation, fade to white/black,
  • Mp3 soundtrack
  • cute and colorful appearance (could be better however >_>)
  • Records user inputs and replays in exact timing as performed originally sync'd to the mp3
  • adjustable framerates full stop to 60fps, with single frame advance option
  • GUI using the touchscreen, ooo ahh :p
  • Power Management so closing the lid saves battery..
  • 12 point japanese font renderer with SJIS input rendered in mode5
  • Up to 3 backgrounds are used on engine A (the purpose of this was partly to test background management system)

The animation loop data were taking from various .flv animations on the youtube.. Really a shame since its loading them as bitmaps and yet they still end up with numerous artifacts from the .flv format. But i cannot draw well and meh it works. u_u

Where to get it?

Would like to add more dansen loops, make the GUI a bit less clunky, but since its not an extremely serious project this may take some time. here is what's working so far:

Technical Details

Playback go go go... ^^
also note 3 background layers

There are a few ways to do event recording, on thds i simply recorded the keypad inputs every frame for instance, but on this one were numerous technical considerations that required something a bit different. Firstly since it can be played on cards with different loading times and loading of the animation frames may take > one or more vblank intervals, simply recording keypress alone wouldn't stay in sync with the music reliably. Instead here decided to store all events like so:

//Event enumeration table
enum {
	ENVT_RESET,  //Set all position values back to defaults.
	ENVT_ROT,    //rotational angle
	ENVT_ZOOM,   //image scale
	ENVT_SX,     //image scroll
	ENVT_SY,
	ENVT_XC,     //image centering (rotational center)
	ENVT_YC,
	ENVT_FADE,   //fade to black
	ENVT_FADEINC,//fade to white
	ENVT_CHANGE, //select new animation loop
	ENVT_FRATE,  //change framerate
	ENVT_FADV    //advance a single frame
};
 
typedef struct _envt_t {
	int	time;	//in ms how far past start of song for this event
	u32	value;	//
	u16	type;	//event type
} envt_t;

Each event type possible is enumerated, and stored as 'type' along with a 'value' if necessary along with the 'time' offset in ms from the start of the mp3. The mp3 library can report the offset in ms so this works well. During playback the event's time is compared to the current mp3 time position and it does all events up till the current mp3 time. In this way even if vblanks are missed it will still stay exactly in sync with the mp3... ^_^

while(mp3time>envlist[envcnt].time) {
... //do all the different events
    envcnt++; //move on to the next event....
}

For the video loops had to do a bit differently from before. It stores up to 20 frames in RAM, when the animation sequence changes, it starts loading frames immediately as well as setting the playback speed (fps) and setting the current playback position of animation loop to frame 0. It then attempts to load a frame per vblank until the entire sequence is in ram. The videoUpdate function, will only play up to the max number of loaded frames sooooo, the result is a best effort animation loop loader.

Some notes: ø(._. )

  • Had to modify the font renderer just a bit to be compatible with C and not C++ styles. Would be nice to create a device driver within the devopt table so that stdio system may be used (ie: printf, putc calls etc) rather than font rendering specific calls.
  • Need moar animation loops to choose from
  • Might add slider control on the screen to adjust pan, rotate, zoom, centering movement speed.

More on all of this later...

Personal tools
irssi scripts
eggdrop scripts