Cinematics system for JME3

You don’t understand … I already use the tpf variable, what i mean with “not frame rate dependent” is that a 10 seconds cinematic will last 10 seconds on any hardware no matter what the frame rate is. BUT the frame rate must be at least an interactive frame rate that is about 25 fps).

The thing is…if the hardware is too low to run the cinematic at interactive frame rate, it won’t allow the user to play the game in the very first place…

What you need to know is : If the game can run on the hardware then the cinematics can run on it too.

danath said:
How do they do in most game if the computer doesn't specify to the game ? are they doing real time too ?

That's why there is always a hardware requirement on any game can't expect the game to run properly if your hardware does not meet those requirements...

Understood , thank you :slight_smile:

Hi and Merry Christmas ! :wink:

I got a very strange bug here ,

when i finish a cinematic the texture is deformed , sometimes it also happened in a middle of a cinematic let me show you :

What do you think it could be ?


private void createCameraMotion() {

CameraNode camNode = cinematic.bindCamera("topView", cam);

camNode.lookAt(youko.getLocalTranslation(), Vector3f.UNIT_Y);

camNode.setLocalTranslation(new Vector3f(0, 50, 0));

camNode2 = cinematic.bindCamera("aroundCam", cam);

path = new MotionPath();


path.addWayPoint(new Vector3f(youko.getLocalTranslation().x+3f,youko.getLocalTranslation().y,youko.getLocalTranslation().z+2));

path.addWayPoint(new Vector3f(youko.getLocalTranslation().x+3f,youko.getLocalTranslation().y+5,youko.getLocalTranslation().z+2));


cameraMotionTrack = new MotionTrack(camNode2, path);


cameraMotionTrack.setLookAt(youko.getLocalTranslation(), Vector3f.UNIT_Y);





private void initInputs() {

inputManager.addMapping("togglePause", new KeyTrigger(keyInput.KEY_RETURN));

ActionListener acl = new ActionListener() {

public void onAction(String name, boolean keyPressed, float tpf) {

if (name.equals("togglePause") && keyPressed) {

if (cinematic.getPlayState() == PlayState.Playing) {


} else {;





inputManager.addListener(acl, "togglePause");


public void Cinematique(){

guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");

final BitmapText text = new BitmapText(guiFont, false);


text.setText("Press enter to play/pause cinematic");

text.setLocalTranslation((cam.getWidth() - text.getLineWidth()) / 2, cam.getHeight(), 0);


cinematic = new Cinematic(rootNode, 5);




cinematic.addCinematicEvent(0, new AbstractCinematicEvent() {


public void onPlay() {






public void onUpdate(float tpf) {



public void onStop() {



public void onPause() {




cinematic.activateCamera(0, "aroundCam");

cinematic.addCinematicEvent(0, cameraMotionTrack);

cinematic.addCinematicEvent(0, new SoundTrack("Sound/Environment/Nature.ogg", LoopMode.Loop));

//cinematic.addCinematicEvent(0, new SoundTrack("Sound/Shiness-Theme.wav", LoopMode.Loop));

cinematic.addCinematicEvent(3, new SubtitleTrack("start", 3, "jMonkey engine really kicks A…"));

//cinematic.addCinematicEvent(5.0f, new SoundTrack("Sound/Effects/Beep.ogg", 1));

//cinematic.activateCamera(6, "topView");

cinematic.activateCamera(10, "aroundCam");

cinematic.addCinematicEvent(19, new AbstractCinematicEvent() {


public void onPlay() {




public void onUpdate(float tpf) {



public void onStop() {



public void onPause() {



cinematic.addListener(new CinematicEventListener() {

public void onPlay(CinematicEvent cinematic) {

// chaseCam.setEnabled(false);



public void onPause(CinematicEvent cinematic) {

// chaseCam.setEnabled(true);



public void onStop(CinematicEvent cinematic) {


// chaseCam.setEnabled(true);






//chaseCam = new ChaseCamera(cam, youko, inputManager);




Honestly at this resolution, hard to tell which one of the textures is distorted.

Only thing i can think of that could interfere with the rendering is the fade filter.

Try to disable it to see if it is causing the issue.

I solved the problem by changing the obj by a mesh.xml … i really don’t know what happened here >.>

Another Question , as you can see on my code i’m trying to load a music here :


cinematic.addCinematicEvent(0, new SoundTrack(“Sound/Shiness-Theme.wav”, LoopMode.Loop));


the loop isn’t working , what do you think i should do ?


Maybe there is an issue with the loop, I’m gonna look at it, but please Danath, remember what I told you about posting different post for different questions.

eww Sorry , i thought you wanted us to post every bug we encounter on your code , i’ll do another post next time :wink:

Yes I want you to post every bug you found of course!

But this thread is too long :p, so posting new posts is better, but don’t worry no harm done.

This was indeed an issue when you were using the constructor to set the loop mode, it’s fixed now in the latest svn.

Btw thank you for testing this Danath, your feedback is much appreciated.

Thanks you nehon ! It’s all my pleasure :wink:

A suggestion if i may :

If we could act on the time as we want we may save a lot of line of code let me explains :

For example we want 3 different cinematic to the frame 1 to the frame 70 i’ll do an addCinematicEvent to thoses frame .

I could have something like this :

Cinematic 1 in frame 0

Cinematic 2 in frame 20

Cinematic 3 in frame 50

Until there it’s what we do in the implemented JME3 Cinematic

But if for example i do something like this :


If(Button = Attack ) {; // and this cinematic would play directly to the frame 20 so the Second one i triggered


else if(Button = Magic) {;

}else {;


I’m pretty sure it would save a lot of line of code since we have to rebuild everytime a Motion etc…

I don’t get it…

What do you want to do exactly?

As you can see with this video there are a few motiontrack that is apply in the battle . They doesn’t depend of the timelime , what i’m saying is that it could be nice to stock a lot of cinematics from a frame to another and call them when we want without depending of the timeline

Why don’t you just use several cinematics…i don’t see your point.

What i’m trying to say is that it would be simpler for thoses who want to have cinematics on events to do something like that


cinematic.addevent("Event1); // no timeline parameter here





and then acting like that :


if (button.pushed ) {'Event’1)



And we have a motiontrack associated "Event1,2,3, etc… " and every motion track has his Waypath.

I tried to add severals cinematics and there is too much line of code that’s why i’m tell you that.

You know you can embed cinematics right?


Cinematic parentCinematic =new Cinematic();

Cinematic event1 =new Cinematic();

Cinematic event2 =new Cinematic();

Cinematic event3 =new Cinematic();

//init everything

parentCinematic.addCinematicEvent(0,event1 );

parentCinematic.addCinematicEvent(10,event2 );

parentCinematic.addCinematicEvent(15,event3 );

And you can reuse a MotionTrack for different cinematics.

so, about that jMP plugin? :slight_smile:

I would definitely need it… what is the actual development status?

Zero, you can go ahead and start if you need it.

damn i need it too >_<

Well i was really counting on GSoC for the editor…too bad we didn’t make it.

I don’t have the time to get into it, i’ll probably do it at some point, but it’s not gonna be soon.

If someone has the will to step in, I’ll gladly support him as much as I can.


before spending tons of time working on this just wanted to see the capability of Cinematics as far as reading a trace file for animation.

I have a file that goes like this (very small portion) - of course this could be translated later to Cinematics language

[java]time 1.32

move spatial 3 3 3 speed 3.34

time 3.43

rotate spatial 45 time 5.65

time 4.43

move spatial 4 0 0 speed 4.54

rotate spatial 34 time 4.34 etc etc[/java]

I know that Cinematics has an Cinematic event of type AnimationTrack. So is it possible (and efficient) to display the animation using Cinematics and how would I be able to model the spatial movement smoothly frame by frame?


I will eventually parse the file into Cinematics language that reads all the events consecutively in a similar loop (sorted by ascending - time)