Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (546)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  How to add cutscenes to your game  (Read 6944 times)
0 Members and 1 Guest are viewing this topic.
Offline MrDodo

Senior Newbie





« Posted 2012-06-17 10:31:47 »


Hello people,


I am making my first steps into java game developing, and I have kind of a prototype of a game. I wanted to add a small intro video (and cut scenes in the future) before the menu and the game launches, and I am finding that is not easy.
I have read about JMF, and about javaFX and Xuggler to add a video file... but everything looks quite complex, and not everybody looks happy with their solutions.

So, my question is, how do you add cutscenes to your games? Of course if it is something simple/small I can directly animate the frames, as I do with sprites, but I guess that's not the solution for comples/long cutscenes. To be able of add a video file and play it before the game, or en between will be awesome...

I don't want to re invent the wheel and I want to solve this as easy as possible! I guess most of you have wanted to add some cutscenes or intros to your games...


Thanks a lot!

Offline princec

JGO Kernel


Medals: 360
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2012-06-17 10:43:24 »

Note remarkable lack of video in Java based games. This is because... Java video has been stunningly ignored for the past decade. It is not at all trivial to try and do. If this is your first foray into Java game developing I'd simply give up on this particular thing now and carry on with the rest of your game, which will probably have you pulling your hair out anyway. Come back to it when the game is finished!

Cas Smiley

Offline MrDodo

Senior Newbie





« Reply #2 - Posted 2012-06-17 11:15:15 »

Thanks a lot Cas, I will follow your advice!

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #3 - Posted 2012-06-17 11:38:44 »

Hi

Look at FreeCol, it uses a cutscene. There is an attempt of providing build-in video support in JogAmp, it uses FFMEG and libAV under desktop environments, something else under Android. Please ask Sven to explain to you how to use it, rather post your question on the official JogAmp forum. Best regards.

Edit.: Someone here succeeded in using JMC (from JavaFX).

Edit2.: In the worst case, you can try to use a command to run the player.

Offline Cero
« Reply #4 - Posted 2012-06-17 12:00:42 »

There are quite a lot of threads here about this topic, most started by me.

Like Cas said, its a very sad part of Java - so only come back to this topic if you really really need video.

I'm using VLCJ.

Offline MrDodo

Senior Newbie





« Reply #5 - Posted 2012-06-17 13:53:05 »

Hey Cero, yes I have read your threads about this, and that's how I know it is hard.

Well the point it is that I really need cut scenes... I was making a point and click adventure, so the cut scenes were supposed to be a very important part. But if it is to difficult to make it work, well, I have another projects in mind, so I can start making another videogame that don't need any video.
And let's see if in the future I want to make the point and click adventure in java or not!


Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #6 - Posted 2012-06-17 13:56:30 »

Maybe you will be okey with other kinds of "cutscenes", where you just make the players/characters walk in you window, playing something like a real-time rendered video Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Cero
« Reply #7 - Posted 2012-06-17 14:23:56 »

Hey Cero, yes I have read your threads about this, and that's how I know it is hard.

Well the point it is that I really need cut scenes... I was making a point and click adventure, so the cut scenes were supposed to be a very important part. But if it is to difficult to make it work, well, I have another projects in mind, so I can start making another videogame that don't need any video.
And let's see if in the future I want to make the point and click adventure in java or not!

Of course there are many popular point and click without video... But I can understand that you want video in story based game.
Basically VLCJ works. Its just a little hassle to include everything for every platform. But VLC works on every platform, and its very reliable.
Only minor problem is, which might disappear soon, that VLCJ is still GPL, which forces your whole sourcecode to be GPL.
Even if that happened, nobody cares about source code anyway...

Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2012-06-17 15:02:29 »

So that rules out VLCJ for two reasons then.


I just decided to give it a shot: using VLC (not VLCJ) to play the audio in realtime, and streaming the video frames to 1 file, which is continuously overwritten. VLC takes care of the syncing of video/audio. The only thing the Java app has to do is poll the dump-file, read it, and display it.

Obviously the disk I/O becomes the bottleneck, so to playback HD @ 25fps, I needed the dump-file to be on a RAM-disk.

It's only 150 lines of code:
http://pastebin.java-gaming.org/54a6b0d341c
It could be a lot shorter, but I decided to use 3 threads: one for I/O, one for decoding, one for displaying. This resulted in smoother playback. It effortly played back any media file I threw at it.

Because Java's ImageIO.read is rather slow for PNG and JPEG, I used BMP for the dump-file for best performance. javaw.exe used about half the cpu cycles vlc.exe used, which to me seems good enough.




According to the commandline options, we can provide function-pointers, so VLC can simply call a C function, providing the pixels, which we can copy/map into a texture, or an awt image. To me, this seems like something you can code in a rainy afternoon, so why are we all giving up on 'java video' ?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #9 - Posted 2012-06-17 15:16:13 »

Erm... could you give me a Java 6 version?  Grin

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #10 - Posted 2012-06-17 15:17:14 »

Erm... could you give me a Java 6 version?  Grin
It's full of dependencies anyway, so in the current state it's useless. The requirement of a ramdisk adds insult to injury, don't waste your time on it Smiley

It would be acceptable if Windows natively supported the creation of ramdisks. I'm using ImDisk (freeware) to create a 8MB ramdisk that holds the file. It's still inefficient, as it simulates a NTFS partition, which adds quite a bit of overhead, so it's never going to be as fast as IPC (inter process communication).

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #11 - Posted 2012-06-17 15:18:14 »

Erm... could you give me a Java 6 version?  Grin
It's full of dependencies anyway, so in the current state it's useless. The requirement of a ramdisk adds insult to injury, don't waste your time on it Smiley
Yeah I know. I didn't even wanted to use it for anything. But I really like the idea. Craciest Idea evaaar Cheesy

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 75
Projects: 15


★★★★★


« Reply #12 - Posted 2012-06-17 15:23:24 »

Xuggler looks like a good choice for Java video. Xuggler and FFmpeg are both LGPL (unlike both VLC/VLCJ which are GPL), seems easy enough to setup and have seen it used in a few big Java projects (JPCSP, Wakfu, jMonkeyEngine3, etc).
Offline SimonH
« Reply #13 - Posted 2012-06-17 15:30:52 »

I think it's possible in applets, I did a quick test for an applet/js/ytplayer combo which isn't too bad -
See it here.
I believe it's possible to hide the player controls but I didn't get that far!

People make games and games make people
Offline davedes
« Reply #14 - Posted 2012-06-17 15:39:53 »

You could use Illustrator/InkScape as your animation software and create SVG files. There are a number of SVG parsers out there, and Slick even has a couple SVG animation tests that work quite well.

Alternatively you could write your own "timeline" and design your own animation through code -- moving images with easing, fading in/out text, etc. over time.

What kind of intro are you going for?

Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #15 - Posted 2012-06-17 15:54:51 »

I think it's possible in applets, I did a quick test for an applet/js/ytplayer combo which isn't too bad -
See it here.
I believe it's possible to hide the player controls but I didn't get that far!
I got a horrible user experience from that applet Smiley

When I hit [space], it played the movie for 1 second, then it showed me the black screen again, telling me to hit [space]. I tried keeping [space] pressed, but that didn't make it play fully either.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #16 - Posted 2012-06-17 16:26:22 »

I think it's possible in applets, I did a quick test for an applet/js/ytplayer combo which isn't too bad -
See it here.
I believe it's possible to hide the player controls but I didn't get that far!
I got a horrible user experience from that applet Smiley

When I hit [space], it played the movie for 1 second, then it showed me the black screen again, telling me to hit [space]. I tried keeping [space] pressed, but that didn't make it play fully either.

Strange. It is working for me, even though Adobe flash support on linux is... well.. heh Cheesy *dontwantstosaybadwords*

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Cero
« Reply #17 - Posted 2012-06-17 16:56:24 »

So that rules out VLCJ for two reasons then.

Well the creator is actually flexible on the license and if you really have a problem with GPL he might change it.
Not sure what your other reason is.

I'm using VLCJ actively, integrated in my engine, works great. Using it for cut-scenes.

Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #18 - Posted 2012-06-17 16:58:27 »

So that rules out VLCJ for two reasons then.

Well the creator is actually flexible on the license and if you really have a problem with GPL he might change it.
Not sure what your other reason is.

I'm using VLCJ actively, integrated in my engine, works great. Using it for cut-scenes.
Is it even possible for the creator of VLCJ to make the licence something else than GPL? I know he himselfs writes that, but VLC is GPL, now how does he want to do that?

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Cero
« Reply #19 - Posted 2012-06-17 17:00:16 »

but VLC is GPL
it ain't, anymore. It's LGPL now.
So Mark Lee said to me its probable that he is going to change VLCJ's license too

Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #20 - Posted 2012-06-17 17:02:19 »

but VLC is GPL
it ain't, anymore. It's LGPL now.
So Mark Lee said to me its probable that he is going to change VLCJ's license too
Oh, thats good. I may use VLCJ later too, if it is LGPL, I really like it. But I dont need to, currently anyways, cause I'm not having much story in my game right now (And I'm not too god in making movies anyways Wink )

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline davedes
« Reply #21 - Posted 2012-06-17 17:15:26 »

Has anyone successfully tested VLCJ on Mac/Linux? Last time I tried building from source I got a lot of unexplained linking issues.

Offline Cero
« Reply #22 - Posted 2012-06-17 17:21:33 »

Has anyone successfully tested VLCJ on Mac/Linux? Last time I tried building from source I got a lot of unexplained linking issues.

Well you know, its not that easy.
The idea is to have VLC installed and VLCJ links to this "vlib".
However thats complete crap right there, since you cannot force a user to install VLC or expect that they have it installed.
So what you do is, ship everything you need with your game and link it yourself, like private JVM.
So I have a vlib folder, similar to the lib folder.
1  
System.setProperty("jna.library.path", "vlib");

and in the vlib folder you need to have specific files like libvlc (per platform) and the codecs. (of course only codecs that you are allowed to redistribute and use, meaning theora and ogg - not ALL codecs)

So its copy work - but once done, it works.
I haven't tried that hard to get it to run, but all you have to do is to copy from the installed folder on a mac and on linux, the files that you need.
On linux I just couldn't find those all that quickly so I couldn't try it yet.
Mac is officially supported by VLCJ and Linux should be even less of a problem. Since VLC works so good on it.

Offline MrDodo

Senior Newbie





« Reply #23 - Posted 2012-06-17 17:38:32 »

Well guys, thank you very much for the help... this is really an awesome community!


I think I will just not do videos for the moment - I will keep programming and, on the end, when I know more java and I have a semi finish game, then I will confront the video issue, probably with the help of vlcj, that sound quite good.



Offline jonjava
« Reply #24 - Posted 2012-06-17 18:15:32 »

<a href="http://www.youtube.com/v/3RGORttEnzA?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/3RGORttEnzA?version=3&amp;hl=en_US&amp;start=</a>

Offline Cero
« Reply #25 - Posted 2012-06-17 18:48:24 »

<a href="http://www.youtube.com/v/3RGORttEnzA?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/3RGORttEnzA?version=3&amp;hl=en_US&amp;start=</a>

I know this guy - he doesn't like JRPGs
Go figure...
I love MGS4. I watch 20 hours of cutscenes for a decent story giving context to gameplay.

As you have more story you need more exposition.
The more it is the harder it is to do simply ingame.
Also 2D and 3D are totally different stories. A 2D game doesnt even offer the option to convey complex scenes ingame, even if you wanted to script it all.

I could say more... but I could write a whole paper.
Imo story-telling is, to me, the most important part of a decent immersive game. (Actually to all media: movies & books alike. Even music should strife to have meaningful lyrics, or none at all.)
Of course I say this while games like COD, Farmville, Wii Sports are top-selling; but hey Final Fantasy games aren't doing too bad.

But even in games where unique gameplay plays a predominant role, story and characters make it great: Portal 2 would be boring without story and characters
I only think highly of games which had much emotion context...
Thats why people say FF7 is the best game ever - everyone has sincerely touched by it. And they can still recall those feelings.
And all those shooters already look the same now, forgettable; Remembering back, it will all be a blur.

I also directly disagree with his philosophy that gameplay should stand on its own - I'm just not a fan, I need to care, I have no ambition without emotions.
Would like to point to Deadly Premonition aka Red Seeds Profile: Many say its utter crap and many say it brilliant. It has a horrible gameplay and a great story and characters.

Offline jonjava
« Reply #26 - Posted 2012-06-17 19:19:49 »

Well the point is cutscenes != storytelling. I agree with that. I don't know if the guy likes JRPG's or not, but he goes on to say that dialogues in RPG's are fundamentally different from cutscenes. For instance, dialogues in RPG's usually give you choices along the way ( This is a good thing ).

The issue with cutscenes is that it disconnects you from the game. Instead of being part of the story, you're sitting on the sidelines observing it.

I suggest skipping cutscenes altogether and focusing on storytelling. In general, this means playing out a scripted scene in the game engine/world where you're still in control of your character. Simple and effective and a lot better than cutscenes imho.

Smiley

[EDIT]: Storytelling in video games can be so much more than simple 1 dimensional movie effects.

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #27 - Posted 2012-06-17 19:23:59 »

... MGS4 ... a decent story ...

Buh?  Huh

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Cero
« Reply #28 - Posted 2012-06-17 19:29:13 »

The issue with cutscenes is that it disconnects you from the game.
This remains true of course.

In general, this means playing out a scripted scene in the game engine/world where you're still in control of your character. Simple and effective and a lot better than cutscenes imho.
You can certinaly try in a 3D game. in 2D, I dont see how you would do that, without sacrificing complex scenes.

Overall it is possible... Egoraptor also says that if things happened to you directly, the impact is much greater.
However, at least for now, I'm not as arrogant as to believe I could change story telling in games in a way the industry has never thought about and innovate it and stuff. Therefore I lack game making experience; and story telling experience for that matter.


Guess you didn't play MGS1-3.

Offline davedes
« Reply #29 - Posted 2012-06-17 19:42:18 »

You can certinaly try in a 3D game. in 2D, I dont see how you would do that, without sacrificing complex scenes.
Certainly it wouldn't be much harder than creating a FMV from scratch. I'm not sure what world you live in where animating FMV cutscenes (especially higher poly 3D scenes) is easier than programming some simple game logic.

1  
2  
3  
4  
5  
6  
if player enters cutscene zone
    trigger music
    add letterbox / vignette / effects
    limit/prohibit player movement outside of the zone
    play story voiceover
    run NPC AI

Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

atombrot (20 views)
2014-08-19 09:29:53

Tekkerue (21 views)
2014-08-16 06:45:27

Tekkerue (21 views)
2014-08-16 06:22:17

Tekkerue (12 views)
2014-08-16 06:20:21

Tekkerue (19 views)
2014-08-16 06:12:11

Rayexar (55 views)
2014-08-11 02:49:23

BurntPizza (37 views)
2014-08-09 21:09:32

BurntPizza (27 views)
2014-08-08 02:01:56

Norakomi (35 views)
2014-08-06 19:49:38

BurntPizza (64 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!