Animation

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Animation

Post by Merk »

This is probably a Q for Kent:

I might be missing something, but I don't think I am. For my next game, I'm trying to include video. Actually, I'm trying to include a lot of it, so that the entire game animates from room to room. Basically, I can move the camera around through my world model and render to AVI. So, instead of using a still image to illustrate a room, I want to show an AVI which animates from the player's location in the prior room, moving into the new room, and stopping. For it to work, the animation would need to end on the last frame and stay there, until the player opts to turn or move into a new room. Then, a new animation loads, starting there, leading into the next spot, and stops.

So, here's the thing that doesn't seem to work. I can either tell Hugo to loop the AVI, or I can not. If I don't, then it goes away after the last frame, instead of freezing there. I get the feeling it's not currently possible to do that -- but is that a limitation of how Hugo plays the movies? And if so, would it be possible to add the ability? :) If not, I may be able to figure out a work-around. If it was possible to count for say, a couple of seconds (the animiations won't last long), I could replace the animation with a still image at the end. I don't know. Just kind of brainstorming.

If you want to see the AVI I was using to test, just email me. It's pretty cool (at least, I think it is). It's sort of an intro fly-in to the game's map. Once it players, I'd like for it to stop and freeze on the last frame.

Kent
Posts: 119
Joined: Fri Jun 27, 2003 12:10 pm

Post by Kent »

FB does this sort of, but not as extensively as I assume you're proposing. What I think you would do is make a JPEG that is identical to the last frame of your animation, same size, etc., and display it immediately after the movie plays.

Depending on the platform and video playback subsystem, there may be a black blink after the video finishes playing.

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Post by Merk »

I could live with a black blink. :) I assume that for it to work correctly, I wouldn't be able to use the "play in background" option, correct? That way, the program would stop until the clip was finished, then I could swap in the still image. That would probably work, although I might want to give users the option of disabling animations. :)

Kent
Posts: 119
Joined: Fri Jun 27, 2003 12:10 pm

Post by Kent »

Right--the engine will block until the video finishes playing unless the video is playing in the background, but in that case you won't have any indication of when it finishes.

The best balance is probably what you're saying: to allow players to optionally turn off those room-transition animations. (They can also, on any platform that currently supports Hugo video, i.e., my ports, hit Esc to cancel the currently-playing non-background video.)

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Post by Merk »

After I added up how large the files may be, I decided a CD-sized game isn't really a good idea (for an if-comp entry, no less). Plus, I'm not sure what AVI encoding formats (because there seem to be several) would be supported by the most number of people, without going for simple uncompressed. I may use animations in spots, but probably not to the extent that I had originally planned.

Kent
Posts: 119
Joined: Fri Jun 27, 2003 12:10 pm

Post by Kent »

Yeah, any substantial amount of animation will add quite a lot of size. There's really no way around it. There's also really no way around having to choose a codec, and there's no single right answer. I made a rec.arts.int-fiction post talking a bit about this. FB uses Cinepak; there are probably other better choices you might opt for depending on your target audience.

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Post by Merk »

I'll have to see if that's a default option in Bryce. There were several MPEG formats, Uncompressed, Divx 5.something... I'd probably have to ask several people to try demos of several types. I don't know much about, personally. :(

*edit*

It does have an option for "Cinepak Codec by Radius" -- I'll try that one. Thanks! By the way, what compression quality did you use? I'm trying the results at 80% first, but it takes about 8 hours to render the entire 6-second animation, so it'll be a while before I know the results. I guess I could try just three or four frames as a test.

Guest

Post by Guest »

What I did with FB is to render all the animations as uncompressed so that I would have a good master. Then I ran them through an encoder to produce the Cinepak AVIs.

Obviously this requires a great deal of disk space. The storage for everything in FB in uncompressed terms (including images, sound fx, dialogue, and movies) was 4 GB.

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Post by Merk »

Kent wrote:Right--the engine will block until the video finishes playing unless the video is playing in the background, but in that case you won't have any indication of when it finishes.
I figured it out! At least.... I figured it out for the Windows interpreter. If anybody is willing to test this with other interpreters that support JPG and AVI, I'd be most appreciative of your feedback. Basically, I'm able to overlap the video and the graphic, and the video seems to appear in front. When it finishes and goes away, the graphic in the background remains. Basically, it's exactly what you suggested to begin with, except that it works even with the animation playing in the background.

Assuming a window_class has been defined for graphics_window:

Code: Select all

run graphics_window.win_init
window
{
    color TEXTCOLOR, BGCOLOR
    cls
    video "GFXFILE", "avifile", 0, true
    LoadPicture("GFXFILE", "jpgfile")
}
run graphics_window.win_end
The only problem is, I can't halt the animation by re-drawing the window. Suppose the user moves to a different room while the animation is still going. Well, the new room JPG appears "under" the animation, and doesn't show up until the original animation is done. Now, if *every* room started with an animation, it wouldn't be a problem. The old animation is discarded (it seems) when a new one is started. So I guess maybe I could have a 1-frame animation, very small, that seeds every new room if I wanted to halt a previously-running animation. That might work. Kent, do you think there would be much overhead in doing that? I mean, playing a small, short, blank AVI? Will the AVI always appear in the front of a JPG, if the same size and in the same window?

BTW, thanks for the help!!

Post Reply