Act! (In-engine cutscene player and editor)

Posted By: The_Clyde

Act! (In-engine cutscene player and editor) - 06/14/10 20:22

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 grin
http://ifile.it/iam3k62/Act.zip
Posted By: CetiLiteC

Re: Act! (In-engine cutscene player and editor) - 06/14/10 20:40

It's interesting and working so far I think. I'm looking forward to the editor...
Posted By: Hummel

Re: Act! (In-engine cutscene player and editor) - 06/14/10 21:01

Animation and movement speed are both fps dependend. Thats a prob I also have had when I tried creating cutscenes...
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 06/14/10 21:25

Thats why I based everything on the ticks you get from time_frame... instead of on frame number- so its a bit strange that that happens? confused

Could you describe the specific problem you've been having?
Posted By: Hummel

Re: Act! (In-engine cutscene player and editor) - 06/14/10 22:11

try to limit the fps to something low and compare the behaviour
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 06/14/10 22:42

Tried different framerates and found what you were talking about- I can resolve this simply enough, though. I probably won't post a new version until I make the editor and I'll make sure to cover this by then!
Posted By: Germanunkol

Re: Act! (In-engine cutscene player and editor) - 06/15/10 09:44

this is a very cool idea... hope you finish it!
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 06/21/10 04:59

editor is basically working, though i still gotta add a couple of things before i can feel ok about posting a version laugh
should be ready for alpha release today or tomorrow!

EDIT: those things have been added
It'll see ya in the morning! wink
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 06/21/10 20:20

Okay heres what I've got of the editor so far-

It is completely capable of producing a cutscene including model animations, sounds, and camera movement. The only thing is that loading an existing scene, modifying it, and then saving it can be a bit wonky at this time.

http://www.clydeshaffer.com/clydeshaffer/downloadables/Act.zip

How to use this:

Open editor.c in SED and run it.
In the first dialog box that appears you choose a level file in which to create your scene.
In the second dialog box you can open an existing scene or click cancel to start from scratch.

The controls are a little weird so far- so I'll work on straightening them out later.
To move objects around on the XY plane (relative to the camera) just left-click and drag. If you hold down shift you will instead move objects around on the camera-relative YZ plane.

Right-clicking and dragging on objects will rotate them on their Z-axis (PAN)
Holding down shift and ctrl would rotate tilt and roll respectively.

Middle-clicking on an object will allow you to enter an animation name and then with the mousewheel you can scroll through the animation.

On the bottom of the screen is the timeline, measured in sixteenths of a second.
You can use the "U" and "I" buttons to scroll back and forth in time. "O" and "P" will scroll your view of the timeline.

To create a keyframe press K while an object is selected. This will create a cue for that object starting at the current time with its position recorded. Then you can move the object around and animate as you like as described above- and set the endpoint of the animation on the timeline with the "U" and "I" buttons.

When you are done positioning your object and time, press the space bar to confirm the cue.

If you hit S- you can create a sound cue by entering the sound filename. This will cause that sound to be triggered when playback reaches the current time.

If you have an object in the level with the WED name "CAMERA" you can also control the camera in the cutscene. With the camera object selected you can create keyframes for it just as any other object- but during playback the camera will be attached to this object.
Pressing "C" while editing will snap the camera object to your current view position.


Yes these controls are terrible :| so I will definitely be working on adding panels and other GUI elements to make the process much easier!
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 06/21/10 22:42

As some proof this system works- heres a quick example of (sort of) game with an integrated cutscene!

http://www.clydeshaffer.com/clydeshaffer/downloadables/WhatISaMan.zip

---------
Act I:
In which Warlock and Palace Guard discuss what a man is, and Palace Guard forgets his line for a moment! laugh
Posted By: Blink

Re: Act! (In-engine cutscene player and editor) - 06/22/10 01:15

Brilliant!!! i like it a lot!!!! i wish it was for A6 as well. i have done a similar thing with cutscenes in my project, but not this clean. good job Clyde!
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 06/22/10 08:03

Thanks Blink! After I get the A7 version to where I want it to be, I might create an A6 playback script since I think this is something GS has been in need of for quite some time... it would be like I'm contributing it retroactively!

At the same time, it'd be real nice if this could also net me A8 Pro wink
since the AUM contest was the initial inspiration... but I'm glad to be working on something that can be useful to everybody as well! ^_^

Thankfully I have all of July to work on much-needed editor GUI improvements.
Posted By: Blink

Re: Act! (In-engine cutscene player and editor) - 06/23/10 02:56

good luck, i hope you win!
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 06/23/10 19:23

Today I did a rough design of UI changes I plan to make



It's gonna look a bit better than this since I'll be using Photoshop to make the actual buttons. This was just a quick doodle in MS Paint grin
Posted By: Helghast

Re: Act! (In-engine cutscene player and editor) - 06/24/10 08:13

nice stuff you got going on here! I might give this a try sometime soon when my Toolkit is finished for testing grin

Is this going to be an entry into the contest btw?

regards,
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 06/24/10 08:28

Indeed it will be! laugh I was initially brainstorming tool ideas as a result of the contest but then realized that this was a tool I'd like to make for Gamestudio, to create a similar functionality to Valve's cinematic scenes in their engine.

Also here is a preview screenshot of the interface as I'm working on it and adding buttons and functionality and whatever-



So far I've got the buttons in there for the commands I'd already added- for saving, creating keyframes, adding sounds, scrolling along the timeline, etc.

At the same time I'm also working on improved editing functionality, such as selecting cues to move back and fourth on the timeline, or delete them, or just edit them a little.
Posted By: lostclimate

Re: Act! (In-engine cutscene player and editor) - 06/25/10 00:35

hmmm, i worked on one of these a while back, stopped after a few days unfortunately, due to my crap planning:

if you ever want check it out:
http://www.youtube.com/watch?v=7d3s7Fry-AQ

maybe it'll give you some ideas, of course its very primitive so i doubt it.
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 06/25/10 01:46

I liked how you've got the editing arrows like in WED and Blender... I've got an arrow model I made for that sort of thing so I'll try implementing that later.

Also the lines indicating object paths seem like a good idea as well. I should add a toggle button that does that-
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 06/26/10 03:51

UPDATE! grin

It's the latest build of the editor, the latest playback script to include, and even a player application to test scenes outside of a game laugh

http://ifile.it/09oytm8/Act.zip

I've added a nice GUI with editing buttons in similar style to WED or MED-
and also you can now click and drag on cues on the timeline to adjust their position along the timeline. You can even right-click on cues to delete them.


Posted By: HeelX

Re: Act! (In-engine cutscene player and editor) - 06/26/10 06:41

I wanted to test this thing out and I am very disappointed that native camera support is not available. Please add camera support without having esoteric "camera objects" in the scene. I just wanted to fly with the camera in certain position and take a "snapshot" of the current view as camera keyframe. Moving via WASD and E/Q (for lifting upwards/downwards) would be a plus, please also add controls of how the camera.arc and the roll can be changed (e.g. via y/x for the roll and r/f for the arc). Tooltips would be nice or (if you think this is over the top) write at least a readme.txt that explains the interface. A demo level with some simple prerecorded sequences would be a plus, too. When I start either the player/recorder and click cancel in the first dialog, the engine freezes, though.

Best regards,
-Christian
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 06/26/10 10:14

Really? It shouldn't freeze- it should just close... but I have been noticing some weird behaviors from file_dialog anyway.

Taking a snapshot of the current view is already possible... (I suppose I could have explained the button guide better)

You can easily take a "snapshot" of the current view as a camera keyframe with the existing functions- The 'move camera to view' button grabs the camera object and places it at the current location and orientation of your view. The 'lock camera to view' button does the same thing but toggles on and off.

The "select camera object" makes the camera the currently selected object. Once the camera is selected and locked to the view you can make camera keyframes as easily as with any other object except that you're moving the camera with the view controls.


Currently a camera object is not actually needed for playback, only for editing camera movements... and the camera object doesn't have to be anything in particular- it just has to have the WED name set to "CAMERA".

I should be able to work out "native camera support" by next week or so though...

---

Also a demo level with multiple prerecorded sequences might be a good idea- though since I'm going to be messing with the file format to add in things like camera.arc and particle effects and triggering functions... I'm gonna wait until *after* I mess with the file format to create a bunch of demo scenes laugh

Around the same time as doing that I'll probably make the documentation as well.
Posted By: JazzDude

Re: Act! (In-engine cutscene player and editor) - 06/29/10 22:57

Very useful and much-needed cutscene player. I hope you do adapt this to A6 in the future for those of us that prefer c-script. It would be especially useful for adventure games.
Posted By: Blink

Re: Act! (In-engine cutscene player and editor) - 06/29/10 23:11

your adventure games are great Rod, and cutscene player would really be a great addition.
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 07/04/10 02:02

Current todo list:
Camera stuff
-Spawn camera object in editor
-Editing for camera.arc
-WASD controls for view movement
Tooltips
XYZ editing arrows on selected object
Lines to illustrate movement paths
Keyframes that activate functions
Show sound length in timeline (turning out to be really tricky)
A6 player script

Feel free to make suggestions! =D
Posted By: Blink

Re: Act! (In-engine cutscene player and editor) - 07/04/10 04:31

i am excited, an A6 version is on the way?????!?!?!?! wow, my A6 will finally get another cool tool!
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 07/04/10 04:37

It also seems like A6 users will get the extra boon of a particular feature being somewhat more powerful...

Since the execute function uses the C-Script interpreter, C-Script users will be able to activate their own script functions.

The lite-C version of execute, on the other hand, only allows access to engine variables and functions.
Posted By: WretchedSid

Re: Act! (In-engine cutscene player and editor) - 07/04/10 09:11

Maybe you want to look into this function? http://www.conitec.net/beta/engine_getscript.htm
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 07/24/10 22:28

Good news everyone!

The CAMERA object has now been integrated into the editor, so that you don't have to add it manually in WED anymore.

I've also added WASD (and Q and E) controls for moving the camera.

Sounds are now represented on the timeline at their actual length, but for now this is done by actually playing the sound and timing it... so if you use a sound that is very long (not a great idea anyway) you'll have to wait for it to end.

You can also move keyframes along the timeline by clicking and dragging with the left mouse button, and delete them by right-clicking.

I'm also working on XYZ editing arrows similar to those found in MED, Blender, and most other popular modeling programs. These will allow you to drag on the arrows and restrict movement/rotation to the selected axis.

Furthermore, I managed to dig up my copy of A6! (I had switched to A7 in that era before I had my own computer tongue ) Once I finish the features that require changes to the file format and the player I can get to work on the A6 player.
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 08/01/10 01:27

Download link is updated
http://ifile.it/o27z91k/Act.zip

Pretty much just where I am right now as of the last progress post.

Enjoy!
Posted By: Blink

Re: Act! (In-engine cutscene player and editor) - 08/01/10 02:07

awesome!!!! I cant wait to play with this. What a great tool!
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 08/05/10 22:39

Here's some example content. They're the same files I used for the Youtube video.
http://ifile.it/iyfust3/example.zip

Some better documentation is coming soon, and perhaps even a tutorial video if I can find my microphone.
Posted By: The_Clyde

Re: Act! (In-engine cutscene player and editor) - 08/10/10 14:18

It seems that I had *started* fixing camera issues in the last update but had not finished.

http://ifile.it/flu4kse/Act.zip

Camera control is fixed now. I also have updated the playback script to fix bugs that I found while working on my Supercat project.
Posted By: 4thwarden

Re: Act! (In-engine cutscene player and editor) - 09/09/10 20:52

Thanks for the tool! This could be very useful for us! Have a nice weekend!
Posted By: alibaba

Re: Act! (In-engine cutscene player and editor) - 06/02/12 17:53

Does this still exists?
Posted By: nfs42

Re: Act! (In-engine cutscene player and editor) - 06/03/12 01:11

http://www.opserver.de/coni_users/web_users/pirvu/au/demo/zips/act.zip
Posted By: alibaba

Re: Act! (In-engine cutscene player and editor) - 06/03/12 10:48

Ist this the most recent version?
Posted By: nfs42

Re: Act! (In-engine cutscene player and editor) - 06/03/12 12:12

I've never seen a newer one.
Posted By: alibaba

Re: Act! (In-engine cutscene player and editor) - 06/03/12 17:48

Okay, thank you very much laugh
© 2024 lite-C Forums