Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Fury on April 14, 2010, 02:20:05 pm
-
Don't you love it when you have just the animated effect you want to use already in mediavps or in your own mod, but don't you hate it when you can't reuse it as-is because the animation progresses either too fast or too slow? The solution? Make it possible for any one animated effect to have more than one eff-file.
To make this possible, probably the most convenient way would be add something like $Filename: as optional argument in eff-file. For example, you have myeffect.eff containing lines
$Type: DDS
$Frames: 50
$FPS: 25
You want to reuse this effect, but lower FPS further. So instead of needing to copy and rename those frames, you create an additional eff-file containing lines
$Type: DDS
$Filename: myeffect
$Frames: 50
$FPS: 15
and save the new eff-file as myeffect2.eff and refer to it as myeffect2 in tables.
Problem solved, no need to duplicate same animated effect many times over if you have need to alter FPS values for different purposes. Over time, this can potentially save a lot of overhead in packaging assets.
-
Excellent idea. :yes:
-
I agree.
You often want a portion of the effect only, or the effect played backwards, or just the a certain frame to be hold on for a longer/shorter time.
I suggest replacing the EFF format with something closer to the IFL format. "IFL" stands for Image File List.
It's a simple textfile, like EFF, which contains a list of the filenames of all frames, plus a duration behind the filename.
That way we could create a few general effect animations and use them in multiple EFFs/IFLs.
Example:
You create an animation with 50 frames.
"blue_flare_0000" " - "blue_flare_0049"
Now you want to use this effect for your warp-in effect. It should be shorter, so you don't need all the frames.
Your IFL might look like this:
warp_in_effect.ifl
Type: DDS
Frames: 25
Loop: false
"blue_flare_0000" 0.5
"blue_flare_0002" 0.5
"blue_flare_0004" 0.5
"blue_flare_0006" 0.5
"blue_flare_0008" 0.5
[...]
"blue_flare_0048" 0.5
And now you can use the same effect for your warp-out effect, but it should be a tiny bit slower:
warp_out_effect.ifl
Type: DDS
Frames: 25
Loop: false
"blue_flare_0048" 0.65
"blue_flare_0046" 0.65
"blue_flare_0044" 0.65
"blue_flare_0042" 0.65
"blue_flare_0040" 0.65
[...]
"blue_flare_0000" 0.65
Later you might want a pulsing star effect in the background:
bg_star_lp_effect.ifl
Type: DDS
Frames: 10
Loop: true
"blue_flare_0000" 0.5
"blue_flare_0001" 0.5
"blue_flare_0002" 0.5
"blue_flare_0003" 0.5
"blue_flare_0004" 0.5
"blue_flare_0005" 0.5
"blue_flare_0004" 0.5
"blue_flare_0003" 0.5
"blue_flare_0002" 0.5
"blue_flare_0001" 0.5
-
That sounds really useful. :)
-
would there also be a possibility to be able to link the eff's speed to ship speed? this is one of the things that Machina Terra would be grateful for :)
-
That sounds interesting, however there isn't much room for speed changes.
30 fps is optimal for an effect. More fps hardly improve the animation.
However, once you have below 24, your the animation will start to stutter a little bit.
Well, some effects still look ok with 20 fps and in some rare cases even setting 5 fps can make sense.
The only way to achive the effect you're looking for would be to switch between EFFs/IFLs, or make them dynamic and access them via LUA.
Lets say you have a 40 frame animation.
You'd use all 40 frames for your slow.ifl, skip every second frame for your medium.ifl (20 frames) and only use every fourth frame for your fast.ifl (10 frames).
That way you could get away with the frames that are already in memory, always have 30 fps and still speed up and down your effect. :)
Maybe - I have actually no idea - this could be done with LUA and texture replacement already.
You'd have to waste a lot of memory though with the current EFF system. Each effect would require it's own frames.
-
Well, as much as I like the filename idea, I don't know how possible or practical it would be to specify a file and frametime for every frame...
-
I see your point.
It's a bit tedious, but on the pro side, we could display a black frame for seconds. Maybe that doesn't sound like much, but in the end this could save us a lot of memory.
To make the creation of the IFLs easier, not setting any duration value should be the same as setting the standard value. I suggest 30 fps.
That way you only need to add the numbers if you either want to have some kind of special effect or optimize your effect interms of memory usage.
Writing all filenames is tedious as well... but there are so many benefits that I honestly don't mind.
After spending hours on an effect I think I can spare 2-5 minutes to write this effect file.
-
The reduction in memory usage when using, for example, two IFLs that share frames, would certainly make this desirable.
-
i wouldnt mind just having access to frame order. for example lots of shivan ships just ramp up and down again witht heir glowmaps. to save memory you only need one ramp up, then reuse the frames backwards for the second half of the animation.
$Type: DDS
$Frames: 10
$FPS: 25
$Frame Order: (0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1) ;;frame indexes
the idea here is to promote frame reuse to save memory, it would also allow moders to add more variation to the animation or a longer sequence without making a huge number of frames. take it a step further you could make it possible to define different sequences for different conditions:
$Type: DDS
$Frames: 10
$FPS: 25
$Frame Order:
+normal: (0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1) ;;frame indexes
+maxenginepower: (5,6,7,8,9,8,7,6)
+disabled: (0,1,2,1,2,0,1,2,1)
+afterburner (8,9,8,7,8,9,6,9)
-
Why not have something that is somewhere in between and allows the best of both. Start with the current eff format but expand it with options. Something like this:
Type: DDS
Frames: 25
Loop: false
Default frame duration: .65 ; nothing specified = current eff default
#Files ; optional. If not specified all frames are used
"blue_flare_0048"
"blue_flare_0046"
"blue_flare_0044"
"blue_flare_0042"
"blue_flare_0040", 0.5 ; length of this frame only
[...]
"blue_flare_0000", 0.5 ; length of this frame only
Heck you could even add something like
"red_flare_0020", .75
"red_flare_0021", .75
"red_flare_0022", .75
"red_flare_0023", .75
"red_flare_0024", .75
To do a red pulse in the middle of the blue.
-
i think what i posted would work better. the eff really doesnt need to know the file name, just the index within the file name (the _xxxx part). internally its all passed as a pointer to the first frame with an offset*sizeof(). it also takes a lot less time to type up. if you want a frame to play longer, just put it in a frame order entry twice.
$Frame Order: (0,1,2,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1)
-
The eff may not need to know the filename, but bmpman does.
That being said, nuke's frame order thing sounds far more useful.
Although, some of it could be simplified by introducing a +rewind option, that would cause the eff to automatically rewind after having played from 00 to the last frame, and a keyframe option that would allow you to do fun stuff with that.
Actually, I believe keyframes are already supported as part of the process that allowed the replacement of interface anis with effs. Flaming_Sword knows the details.
-
Well, the whole point of the filenames was to be able to mix frames (i.e do we really have to waste memory on black frames within an animation?) and to cover Fury's suggestion.
It's more flexible than being stuck with a single effect name.
-
well you could use
The eff may not need to know the filename, but bmpman does.
i dont think its a good idea to mix naming conventions though, i kinda like that the eff file name matches the bitmap name, which is then followed by an underscore and the actual index. bmpman knows to look for files named effname_0000 - effname_nnnn where n is the number of frames -1 (padded with 0s). it really makes it easy to to find all the files in the directory structure while working. in other words i kinda like it the way it is. :D it also has the added bonus of not breaking existing mods.
Although, some of it could be simplified by introducing a +rewind option, that would cause the eff to automatically rewind after having played from 00 to the last frame, and a keyframe option that would allow you to do fun stuff with that.
the idea of +rewind seems like it would make a nice shortcut, but i only gave the up/down ramping idea as an example of something that an index list could be used for. you could also play subsections of the animation in different patterns to make several different effects. if the idea of event driven animations is used then you can stack 4 or 5 different animations under one eff, all using the same pool of frames. i dont know what keyframing could do that index lists cant. it also seems very easy to setup (and you dont need to list a bunch of file names).
Well, the whole point of the filenames was to be able to mix frames (i.e do we really have to waste memory on black frames within an animation?) and to cover Fury's suggestion.
maybe an index value of -1 to indicate a blank frame, a simple placeholder that eats up time and shows nothing. fury's other suggestion was mainly to allow you to adjust the parameters of an existing eff, sort of like a modular table.