Hey everybody!
I've been working on a way to include in-engine cutscenes in Gamestudio games. So far the only sort of video capability has been the use of space-consuming movie files (FMVs). With the tool I am developing you'll be able to create and play animation sequences that are rendered in A7 and read from text files containing animation information- which are much smaller than AVI's and the like.
PROJECT STATUS:
Currently I have just gotten the playback code working!
Next task will be to begin the scene editor...
HOW THIS WORKS:
The playback code loads a text file containing the animation information.
The cornerstone of this information is a data structure I call a "Cue", like those you'd follow if you were a stage actor.
Inside of a Cue is
- A WED entity name
- Start and end vectors for position
- Start and end angles
- Start and end vectors for scale
- An animation name
- The number of times the animation loops during the Cue
- The duration of the Cue
When a Cue is started, it will interpolate the parameters of the specified entity over time, ending after the given duration.
In order to allow multiple objects to start moving at once, Cues are contained in Keyframes. A Keyframe contains an array of Cues, and the start time of the Cues contained within.
A scene consists of an ordered list of Keyframes. When the total time passed in the scene has passed the start time of the next Keyframe in the list, all of the Cues inside that Keyframe are added to the group of active Cues. The active Cues are processed every frame and each is deleted after its duration has completed.
HOW TO USE THIS:
Since I still have to make the editor I'll just explain the sample program, sample scene, scene file format, and how to try out the playback functions in our own project.
The included program "test1.c" is actually just a few lines to load the level, load the scene, and then start the scene.
The sample scene will show a blue space rocket (from my retro contest entry) and Supercat, the player character from one of my older projects.
The rocket will first glide across the screen while spinning and shrinking. Then it drops straight down a bit- and then moves away from the camera while growing a little.
At the same time, Supercat will run from one side of the screen to the other- and then punch the air.
-
File Format-
The first piece of information in the file is the number of keyframes in the scene, followed by a new line, and then all of the Keyframes.
The first line of a Keyframe starts with the start time of the keyframe- in sixteenths of a second from the start of the scene. After this is the number (N) of Cues in the Keyframe.
The next N lines are each a Cue.
Separated by spaces, the information goes as follows.
- Start X, Y, and Z
- End X, Y, and Z
- Start Pan, Tilt, and Roll
- End Pan, Tilt, and Roll
- Start scale_x, scale_y, and scale_z
- End scale_x, scale_y, and scale_z
- Name of animation to play, or "none"
- Number of times animation is to be looped
- Duration of the Cue
Note that this order matches the listing above.
Also if the start and end values for a vector are all the same, or all set to 0, that vector will not be affected by this Cue. You can use this to have different Cues each affecting a different parameter of the same object, potentially at different rates.
Finally- the very last two Keyframes indicate when the scene ends. The end time of the second to last will be the end time of the scene, because as soon as it's loaded the *final* cue will take effect, because it is indicated by having both its start time and number of cues set to 0.
----------
To use the playback functions in your own project, you would simply include "drama.c" at the top of your code.
The commands are as follows:
loadScene(String filename) --> loads the scene from the given file into memory
playScene() --> plays the scene in memory
pauseScene() --> pauses playback of the playing scene
unpauseScene() --> resumes playback of the paused scene
AND AT LAST THE DOWNLOAD LINK
--Feel free to check out the program, and code and stuff
http://ifile.it/iam3k62/Act.zip