PDA

View Full Version : Techniques for movies in games...


Phil Steinmeyer
09-30-2006, 02:18 PM
OK, I've got a simple, crude system I'm using now to show some mini-movies that animate my help screen. Basically, I do a jpeg of the first frame, then have a utility that diffs each frame with it's predecessor, crops the part that has changed, and saves it as a palettized PNG. The result is that I have 3 clips, at 1 at 190 x 190, and 2 at 244 x 152, with about 35 frames each, compressing to about 125K each. It's good enough for this help screen, but...

I'm thinking about running more, longer, bigger movies on my main setup screen. I've got a bunch of game modes/mini games, and might run a full movie of each as the user has his mouse hovered over it and/or has it selected. If so, the movies would likely be ~320 x 240 (so ~ 2-3x the area of the other ones), and I'd have 8 of them, and something like 60 frames of animation each. That would be about 4MB using my old system. It's enough to make me consider improving it or switching to alternatives.

I could either improve my home-rolled solution, or consider switching to something else.

I'm mainly concerned about Windows - can probably ignore the Mac and other markets for this.

As for 'something else':

I know James at Reflexive used Flash for some of his games. I'd be interested in the technical difficulty and cost of this. If it depends on Flash being installed, that could be ok - I could fall back to a still frame for the ~5% of users without Flash.

I've used Bink before (from RAD Game tools), and it's excellent, though now priced at $6K. They also have an older, 256 color technology (Smacker), that's $4K.

Possibly there's a way to easily hook into Windows Media Player's decompressor? Or some other thing that's built into Windows/DirectX for this purpose?

And of course, there's improving my home-rolled solution.

Thoughts/experiences out there?

IIRC James S. discussed his Flash experiences at more length somewhere, but I can't find it. A link would be great.

digriz
09-30-2006, 03:36 PM
Have you considered the flic format (.flc, .fli)?

It's free and easy to do. It basically creates a delta between the next and previous frames. I think it should be a lot more efficient than the current method you're using.

have a look here.... http://woodshole.er.usgs.gov/operations/modeling/flc.html
and here... http://www.compuphase.com/flic.htm

It's not as good as the radgametools stuff; i'm a big fan of bink :) but flic doesn't cost $6K

You will probably need to make your own player and possibly compressor but the technique is fairly easy to understand.

Hope this helps.

luggage
09-30-2006, 04:38 PM
We use http://www.f-in-box.com/. Works well, nice demo version available for download as well. I play the flash file then copy it across to a standard texture. I can then scale, rotate, texture it onto polys, etc.

Phil Steinmeyer
09-30-2006, 06:22 PM
Are there any license/patent/copyright issues with using the FLC format?

luggage
09-30-2006, 06:30 PM
Hope not! First time I used it was for Risk and Battleships for the PC - it's been around for a long time. The file format is very well documented too so I couldn't imagine there'd be a problem.

1EyedJack
09-30-2006, 11:36 PM
James wrote about using flash in Big Kahuna Words here:

http://forums.indiegamer.com/showthread.php?t=5125

Sol_HSA
10-01-2006, 01:40 AM
fli/flc files can be easily generated from various source formats (not only targa) using the free 'Dave's Targa Animator' (DTA); some download links can be found at for example

http://www.programmersheaven.com/download/3236/download.aspx

I wrote fli/flc player source looong ago, sources available at:

http://iki.fi/sol/zip/txtfli2.zip

..the target renderer there renders to text mode or DOS 13h mode, but the fli/flc player 'core' is completely target media independent.

FLI is fixed at 320x200, but FLC can be of any resolution. FLC also introduces some more useful encoding blocks, so FLI is pretty pointless at this point.. both formats are 256 color paleted formats, and although it's possible to change the palette after every frame or so, I doubt any encoder does that.

I know that there are FLH and FLX formats as well for 16- and 24bit color modes, but I've never seen any specs or any actual FLH or FLX files in the wild.

The sources are public domain.

The only portability issue I'm aware of is that the code performs non-aligned 32bit reads, which is a no-no on ARM based portables.

[edit].. I've also written deluxe pain animator player, with sources similarily available, if anyone's interested =) DPA format is, however, so horrible that it would probably be wiser to keep the animation as separate image files than use that format..

jetro
10-01-2006, 03:28 AM
There's also the PNG-based MNG (player library: libmng (http://www.libmng.com/)).

woo
10-02-2006, 07:00 AM
Is theora (http://www.theora.org/)overkill? I guess I'm just used to TGB that has some of this stuff already ready already :)
-Andrew Douglas
http://theoreticalgames.com

badjim
10-02-2006, 01:22 PM
I have Purebasic and Blitz3d and they can both have commands for playing movies(mpeg's, avi's etc). They do it using DirectShow in Windows and Purebasic does it with Quicktime on the Mac.

Purebasic would be a better choice of the two because Blitz3d can't make .dlls and makes .exes over 1MB, a tad OTT for a movie player.

Or you could look up DirectShow on MSDN, (or Quicktime on Apple) and roll your own.