Game Development Community

Comments requested on cinematic system

by David House · in Torque Game Builder · 03/11/2005 (10:20 am) · 5 replies

I felt like messing around with the C++ code over the past day or so and came up with a new C++ object that handles 'cinematics'. What I'm talking about is controlling sprites in a very simple manner. Like in an old-school RPG where the game takes over the player and moves them around. With this you can create intro sceens, cut-sceens, etc. Right now I just have the C++ object and some scripts in place, but eventually I'd like to build an editor for it to make it easier to use. But I wan't some comments first before I proceed.

Anyway, follow this link for an example of my main menu screen for my game fruitstack. You will see some jokes flying in from the left and right. That is all done through the cinematic object:
http://www.wizkidfunhouse.com/resources/mainmenu.avi

Here is the code that I had to add to the fruitstack game:

// create cinematic for the jokes
	$cinema = new fxCinematic2D( "myCinema" ) { scenegraph = t2dSceneGraph; };
	$cinema.addEvent( "AddActor", "0", "joke1", "joke1ImageMap" );
	$cinema.addEvent( "AddActor", "0", "joke1ans", "joke1AnsImageMap" );
	$cinema.addEvent( "AddActor", "0", "joke2", "joke2ImageMap" );
	$cinema.addEvent( "AddActor", "0", "joke2ans", "joke2AnsImageMap" );
	$cinema.addEvent( "PlaceActor", "0", "joke1", "-40 0" );
	$cinema.addEvent( "ShowActor", "2", "joke1" );
	$cinema.addEvent( "MoveActor", "3", "joke1", "-30 0", "3" );
	$cinema.addEvent( "StopActor", "6", "joke1" );
	$cinema.addEvent( "CopyActorPos", "6", "joke1", "joke1ans" );
	$cinema.addEvent( "ShowActor", "8", "joke1ans" );
	$cinema.addEvent( "HideActor", "8", "joke1" );
	$cinema.addEvent( "HideActor", "12", "joke1ans" );
	$cinema.addEvent( "PlaceActor", "15", "joke2", "40 0" );
	$cinema.addEvent( "ShowActor", "15", "joke2" );
	$cinema.addEvent( "MoveActor", "16", "joke2", "30 0", "3" );
	$cinema.addEvent( "StopActor", "19", "joke2" );
	$cinema.addEvent( "CopyActorPos", "19", "joke2", "joke2ans" );
	$cinema.addEvent( "ShowActor", "21", "joke2ans" );
	$cinema.addEvent( "HideActor", "21", "joke2" );
	$cinema.addEvent( "HideActor", "25", "joke2ans" );
	$cinema.start();

The way this works is that you add 'events' to the cinematic object. These events are basically calls to script functions. So the first parameter is the name of the script function to call. The second parameter is the time when that event should be executed ( in seconds ). The other parameters are simply passed on to the script function. The .start() call at the end starts the cinematic in motion.

As an example, here is the AddActor function that I have defined in script:

function AddActor( %cinematic, %scenegraph, %name, %imageMap )
{
	%actor = new fxStaticSprite2D( %name ) { scenegraph = %scenegraph; };
	%actor.setImageMap( %imageMap );
	%actor.setPosition( "0 0" );
	%actor.setSize( "20 20" );
	%actor.setVisible( false );
	%cinematic.registerObject( %name );
}

The cinematic object also handles getting rid of the objects when its done ( as long as you call the registerObject method above ).

So, what are your thoughts? Is this usefull?

I want to include some cool out of the box functions like I have above, but you can always create your own. Also, I want to build an editor around this so its easier to create the events in the right order, etc.

Comments?

#1
03/11/2005 (10:29 am)
Link to the avi should be:
http://www.wizkidfunhouse.com/resources/mainmenu.avi
#2
03/11/2005 (10:33 am)
I think it's very useful.

But I must bludgeon you for your jokes.
#3
03/11/2005 (1:16 pm)
Heh. Actually I got the jokes from Yaholigan. They were from some kids. Of course, given the nature of this game, its probably very appropriate. But they are a little cheezy, huh?
#4
03/11/2005 (2:59 pm)
I like it.

Is adding the functionality to T2D as easy as adding a source file and header file to the project and recompiling?
#5
03/11/2005 (7:46 pm)
Yep. Very simple to add. Just a couple of source files to the T2D project, then recompile. I didn't change any other objects to make it work, so it should be easy to keep it updated with new versions of T2D.