This led me to think about adding a cutscene animation mechanism.
I did some coding a year ago and had a basic system working, but then wandered off to do other things.
Recently, I've started fiddling with it again, but before expending any more effort I'd like to get some community buy-in.
This is not a mod, it is intended to work directly with the quest system.
As such, it wouldn't be available until after DFU version 1 is finished.
The code is available on Github.
The code should be copied into some folder under Assets/Scripts in your DFU project.
I created a Cutscenes folder.
Now for some testing.
Start DFU in the editor and load a saved game, preferably one in a peaceful area.
In the editor menus, there should be a new Cutscene Tester menu item in Daggerfall Tools. Click it to open the testing window.
Enter the text prop bob 183:0 time:0:6 in the Script text box and hit the 'Run' button.
You should see Bob's illustrious image in the center of the stage. After 6 seconds the clip should complete.
If you didn't see Bob, check the Unity console for error messages.
'prop bob 183:0' indicates you are defining a new model named 'bob' using texture archive 183 record 0.
If you haven't already done so, download the Daggerfall Imaging 2 tool from dfworkshop to view the base game textures.
Custom textures can be specified with a colon(:) followed by the *png file name, e.g. 'prop bob :MyCustomTexture'.
The 'time:0:6' is normally used to control the timing of a changing value. Here it is used to force a 6 second run time.
Bob is great and all on his own, but we really need to add some more stuff to the scene.
Add the line prop fire 210:0 x:40 y:35 to your script and hit Run again.
You should now see Bob standing next to a fire.
The 210:0 texture is a multi-frame animated texture.
If you didn't want the fire animated, you could have specified a frame number, e.g. '210:0:2'.
The 'x:40 y:35' bit is the coordinates to put the fire. Coordinates, and most other units, use a 100-based system for simplicity.
The lower left is x:0 y:0, the upper right is x:100 y:100.
All models default to a position of x:50 y:50 at the start, which is center of screen.
Values less than 0 or greater than 100 are allowed, and even advised when panning the stage/camera.
Normally, standing next to a fire gives a flickering light effect.
Change the script to the following:
Code: Select all
prop bob 183:0
prop fire 210:0 x:40 y:35
change bob time:0:6:24 tint:r90g90b60:r80g75b60
The optional third number of the 'time' property indicates the number of cycles to repeat something.
Here we are telling it to modulate Bob's 'tint' property 24 times over a 6 second period.
The color values of the tint property are RGBA values ranging from 0 to 100. Here we are specifying a range of yellowish colors.
You can specify 'white' or 'black' instead of an RGBA value.
Bob seems lonely, it's time for the player character to make an appearance.
Add additional lines to get the following script:
Code: Select all
prop bob 183:0
prop fire 210:0 x:40 y:35
change bob time:0:6:24 tint:r90g90b60:r80g75b60
actor pc pc2
change pc x:25 tint:a0
change pc time:2:5 tint:a0:a100 scale:70:100
change pc time:2:6:16 tint:r90g90b60:r80g75b60
Currently the only paper doll available is the standard PC paper doll. It's an unfinished feature.
'pc2' means fully armed and armored pc. Once completed, 'pc0' would be naked pc and 'pc1' would be clothed but unarmed.
The plan is to allow the script writer to specify other bodies/faces for actors and equip them.
The PC is initially invisible (tint alpha 0) but at the 2 second mark will start becoming visible and scale up into view.
The last line just adds the same flickering effect we used for bob. The flicker colors will mesh with the alpha of the prior statement.
Adding some background might be useful. Add the following lines at the beginning of the script:
tile wall 3 1 9:1 0:0 0:0 9:3
change wall tint:r30g30b30 scale:130
Code: Select all
-dim stone wall background
tile wall 3 1 9:1 0:0 0:0 9:3
change wall tint:r30g30b30 scale:130
-It's Bob! By the fire!
prop bob 183:0
prop fire 210:0 x:40 y:35
change bob time:0:6:24 tint:r90g90b60:r80g75b60
-The hero arrives...
actor pc pc2
change pc x:25 tint:a0
change pc time:2:5 tint:a0:a100 scale:70:100
change pc time:2:6:16 tint:r90g90b60:r80g75b60
The first texture, '9:1', is the fill-texture. Additional textures are added left-to-right. The '0:0' texture can be used as a blank placeholder.
The tiling unit is repeated 3 times (width), with a height of 1.
The wall is added at the beginning of the script so that it appears behind the other models.
Model display ordering can be changed over time by changing the 'z' property, where a value of 0 is the back-most model.
A change of music might be nice.
Add the line music song_13 somewhere in the script, it doesn't matter where, and run again.
The music identifier is from the DaggerfallWorkshop.SongFiles enum, which is shown in the testing window under the Run button.
If the song is 'song_none', the music volume will be muted.
Sound effects are handy. Add sound AmbientCrickets time:0:-0 volume:30 somewhere in the script.
Setting a range to the time property causes the sound to be looped. Without the time range the sound would only play once.
A negative time value means to count from the end. A time range of 0:-0 will play for the entire clip.
A cycles value can be added to the time property to repeat a sound at cyclic intervals.
To illustrate, add sound PlayerFootstepStone1 time:1:5:8 volume:60:0 balance:100 to the script.
You should hear some fading footsteps to the right starting at the 1 second mark.
By the way, the script is not case-sensitive unless specifying custom files. Typing 'playerfootstepstone1' would have worked as well.
We need some caption text for dialog, or to explain things to the player.
Add caption 1000 time:3 to the script.
Ordinarily, message 1000 from the associated quest script would be shown, but in testing that isn't available, so placeholder text is shown instead.
Text color can be changed using the 'tint' property.
Finally, it's nice to have some fade-in and fade-out when entering and leaving a scene.
Add change stagelight time:0:1 tint:a100:a0 and change stagelight time-0 tint:a0:a100 to the script.
'stagelight' is a model that is automatically created at the start. It is a normally invisible panel in front of the stage.
There is also the 'stage' model, which is the background the other models are attached to.
The stage is 3 screens wide and 3 screens high. The stage can be moved like any other model to create a camera panning effect.
Completed script
Code: Select all
music song_13
-darkened stone wall background
tile wall 3 1 9:1 0:0 0:0 9:3
change wall tint:r30g30b30 scale:130
-It's Bob! By the fire!
prop bob 183:0
prop fire 210:0 x:40 y:35
change bob time:0:6:24 tint:r90g90b60:r80g75b60
-Our hero arrives...
actor pc pc2
change pc x:25 y:50 tint:a0
change pc time:2:5 tint:a0:a100 scale:70:100
change pc time:2:6:16 tint:r90g90b60:r80g75b60
sound AmbientCrickets time:0:-0 volume:30
sound PlayerFootstepStone1 time:1:5:8 volume:60:0 balance:100
caption 1000 time:3
change stagelight time:0:1 tint:a100:a0
change stagelight time:-1:-0 tint:a0:a100
Properties:
time: in seconds, used to schedule the cutscene events. Negative values are counted from the end of the clip.
tint: alters colors of models and text
x, y: model placement
z: model ordering
xrot, yrot, zrot: model rotation
scale: model sizing
volume, pitch, balance: manipulates audio properties when playing sounds
Things to be added:
complete actors and actor outfitting
dealing with climate/season/day-night variation issues
visual effects (blurring etc.)
vocals: non-language specific human vocal sounds that can be played when captions are shown
possibly add perspective skewing on rotated models