Any way to keep sound playing when playing video

Started by Jess McD, Mon 30/05/2022 05:34:42

Previous topic - Next topic

Jess McD

I successfully built a working proof of concept for an FMV game (tahnk you forum users!).  I'm using photos as backgrounds, captured character sprites from green screen video, and have a movie file playing for every key interaction.  The problem I'm having is that every time a movie plays the music (mp3 format) stops, and starts from the beginning of the file when the movie exits.  This really breaks the feel/flow of the game whenever an interaction/conversation occurs.  This is the last big obstacle I have to overcome before I can move on to developing the game I have in mind.

Does anyone know of any way to keep the in game sound playing while AGS plays a video?  I'm open to plug-ins, modules, or whatever suggestions anyone has.

If not, does anyone know of any other game development software that is well suited for developing FMV adventure games?

Vincent

#1
In the default "PlayVideo" function in Ags there are some flags where you can set the audio of the video to mute. In this way you can make the music play as background while the video is playing without interruption.

Quote
FLAGS can be one of the following:

0: the video will be played at original size, with AVI audio
1: the video will be stretched to full screen, with appropriate
   black borders to maintain its aspect ratio and AVI audio.
10: original size, with game audio continuing (AVI audio muted)
11: stretched to full screen, with game audio continuing (AVI audio muted)

Quote from: Jess McD on Mon 30/05/2022 05:34:42
If not, does anyone know of any other game development software that is well suited for developing FMV adventure games?

Isn't very suitable for point and click (at least in my opinion compared with Ags), although you can do those too, but on Unity you can do such great things also if you want build FMV games

eri0o

The flags are the way to go. There's also a Direct3D plugin which I think allows doing a bit more with Video playback - but will limit the game to Windows platform in the short term.

Vincent

Quote from: eri0o on Mon 30/05/2022 12:39:23
The flags are the way to go. There's also a Direct3D plugin which I think allows doing a bit more with Video playback - but will limit the game to Windows platform in the short term.

The Direct3D plugin is totally recommended because it allow to play a video without pausing the game unlike the standard function of Ags.

Jess McD

Thank you!  I'll look into the Direct 3D plug-in first.

All the dialog and sound effects are in the movie files, and silencing the movie and playing the audio as a separate file could lead to lip sync issues, but I'll keep it in mind as a plan B to test if D3D doesn't work.

Thanks again,
Jess

Vincent

I would only exclude the music in the videos and leave only the effects and dialogues because those two things probably don't need to continue playing when the video end, maybe you can just play the music outside the video and leave the rest inside. Btw I look forward to see your FMV game, good luck!

eri0o

I would try at first without the plugin, and then if the flags are not enough to get the sound the way you want to, go to the Direct3D plugin.

If I understood, the desire is to have the sound to go on while the video plays, is this correct? Is it not possible to pause the music, play the video and then unpause? Pause is a thing in AGS 3.6.0.

Jess McD

The goal is to simultaneously play the background music (mp3) and the video (with it's audio as well).  That way the player can enter a room, interact with the environment, have a conversation between 2 characters, etc with the conversations and some interactions conveyed through video without the music ever having to stop.  I never want the audio from the video file to be silent.  I could put music in the video files, but the transitions in/out of video would be jarring.

eri0o

I understand, just wanted to say you ARE going to be met by limitations and have to compromise in things sooner or later, so I believe this is a good thing to design around it. Overall you always have two options, brute force, meaning taking a time penalty coding to achieve what you want, or embrace limitations in the design. I've been doing the brute force approach for a long time so I can tell you, if you can embrace the limitations, you are going to progress faster, and finish more projects.

Jess McD

Absolutely!  I ran into a handful of things working on the test build and found workarounds or just other ways of doing things to get what I wanted.  I've got a couple things to try now, definitely at least going to try the D3D plugin.  If I can't get AGS to behave the way I want I'll just alter my sound design to minimize the impact.  With this one exception of the way AGS handles video it's perfect for creating the game I have in mind.  And with my crude proof of concept working, most of my difficult coding is complete, so after figuring out how I want to handle audio it's mainly going to be a matter of getting my story and content assembled!

Thanks again both of you for the suggestions!

Crimson Wizard

#10
Quote from: Jess McD on Tue 31/05/2022 02:17:33
The goal is to simultaneously play the background music (mp3) and the video (with it's audio as well).

Unfortunately, if *that* is the goal, then the Direct3D plugin won't help, because it does not play any sounds. It simply does not support any audio output.

It could have been a better first solution to fix this in the engine and let play both sound from the game and video at the same time. That might be a trivial thing to do.
(That of course won't fix the issue that the video is always covers and blocks the rest of the game, including game GUI, if that matters).

If using plugin, that would require expanding plugin further and, for instance, connect to SDL2 audio, since 3.6.0 engine now uses SDL2 that possibly may be shared between engine and plugin.

Quote from: Jess McD on Mon 30/05/2022 05:34:42
If not, does anyone know of any other game development software that is well suited for developing FMV adventure games?

To be honest, I do not know what classifies as a FMV game exactly (what features it must have), but you also may check out Ren'Py, it's a visual novel engine, and afaik can play videos too.


EDIT
I made a test build based on 3.6.0 which allows to keep both game and video sounds. I think it's okay to add to 3.6.0, as the changes are quite trivial.
https://cirrus-ci.com/task/5318930892849152
(the download links are under "Artifacts" header)

The new option for both sounds is 20 (so 20 for playing video in original size, 21 for making video fit the screen).

SMF spam blocked by CleanTalk