Suggestion: Integrated continous music

Started by InCreator, Sat 22/04/2006 15:09:56

Previous topic - Next topic

InCreator

While betatesting, I came onto this idea:

I have lots of music in my game, almost in every room a new track plays. But it's quite weird that in puzzles where you have continously move from room to room, music is always reset to track start. So basically, you'll be hearing a start of a track all the time.

I believe (recall) that there's some functions to determine current position of mp3/ogg song... But I doubt that my l33t scripting skills are enough for this.

But it would be very nice for AGS to remember where last song was playing before room changed - and continue to play when same room is entered. Remember all songs if they're loaded once (not the songs, but their play/stop positions).

And it would be all as a single option from general settings - "continous music".

Would it be difficult to implement? Anyone other finds it useful?

strazer

#1
Quote from: InCreator on Sat 22/04/2006 15:09:56But it's quite weird that in puzzles where you have continously move from room to room, music is always reset to track start.

It shouldn't. Once you have started a music track, it should loop continuously until you stop it.
But if you start it again in the enter event of each room with
  PlayMusic(1);
the music track will play from the beginning.
Do this instead:
  if (GetCurrentMusic != 1) PlayMusic(1);

You could also use the built-in "Play music on room load" textbox in the Room settings pane. I think it won't restart the track, but I'm not sure?

You're basically asking for the PlayMusic function to automatically not restart the track if it's the same track that's already playing, right?

Edit:

Okay, seems I have misunderstood you. Sorry.

Dr. Scary

Quote from: InCreator on Sat 22/04/2006 15:09:56
I have lots of music in my game, almost in every room a new track plays.

I think he's talking about different tracks in each room.
It's not really any harder than to store the result from GetMP3PosMillis() each time you leave the room and just call the variable back with SeekMP3PosMillis when you enter the room again. One variable for each room is needed and a couple lines of code.

If you want to get fancy you can hook it up to the system timer so that you will create the illusion that the music keeps playing even when you are not in the room.
(But then you have to punch in the length of each track in the code unless there is a secret way of getting AGS to check that for you?)

InCreator

I DID mean separate tracks. If a track is 3 minutes long, and you spend < 30 seconds in a room, you'll never get to actually hear the track. Which makes the background music somewhat pointless.

That's why I'm suggesting integration. Sure, it could be scripted - but why add a load of script to every room just for so simple thing?

Gilbert

#4
I'd say script it, rather than making it a feature, the script isn't that hard anyway. To tidy stuff up and make scripting easier just do it in Global Script, with an array taking the room number as parameter to hold the song positions, it shouldn't be hard.

I doubt whether it's VERY useful if it's made as a feature (I prefer the musics to restart everytime, but that's just personal preference), moreover since the different supported music formats have different natures and capabilities (for example, currently you can play from anywhere corrected to milliseconds for sampled musics like MP3 and OGG, corrected to beats for MIDI and corrected only to patterns for the MOD family; worst of all, playing from the middle of MIDI or MOD can mess up big time, because of the possibility of skipped control events and such, so it's recommended for these files to be played form the middle only if you know there won't be such problems in the files), should this feature be made possible only for MP3 and OGG music? Or should it be one-function-suits-all-formats but acts different according to file formats? Or, should multipleÃ,  different functions should be introduced to handle different formats?

fovmester

Quote from: Gilbot V7000a on Mon 24/04/2006 06:59:50
I'd say script it, rather than making it a feature, the script isn't that hard anyway. To tidy stuff up and make scripting easier just do it in Global Script, with an array taking the room number as parameter to hold the song positions, it shouldn't be hard.

Better yet, make a module out of it and distribute!!

Pet Terry

I like the idea (and I think Apprentice II had something like this), though I don't think it needs to be a feature in AGS, mostly for the reasons Gilbert said. It works great with mp3 and ogg with crossfading, but with midis and modules it just wouldn't sound good.

So my suggestion is, ask SSH to make a module for this. :P
<SSH> heavy pettering
Screen 7

SSH

Funnily enough, I just read this thread for the first time.

So, basically this would store the current music position every time you leave a room and restore it every time you come back. Would you always be using the room editor's "Play music on room entry" function, or would you sometimes use PlayMusic? Would ti always be on entering the room? Do you want to remember what track was playing in each room too, in case this changes while in a room? When you come back to that room, you might sometimes want the original track and sometimes a new track...

Complicated!
12

Gilbert

Yeah, the problem is, when you want something universal for general usage it's quite complicated (unless teh module has some restrictions for the user).

If you only script for a particular game's usage (where you can unify your settings) it's not that hard.

Gregjazz

Quote from: Petteri on Mon 24/04/2006 11:48:39
I like the idea (and I think Apprentice II had something like this), though I don't think it needs to be a feature in AGS, mostly for the reasons Gilbert said. It works great with mp3 and ogg with crossfading, but with midis and modules it just wouldn't sound good.

So my suggestion is, ask SSH to make a module for this. :P

Yup, I already did exactly this for the music in Apprentice II. :)

I actually arrived at the idea the same way you did, InCreator--the beginning of the background music is just so overplayed, and sometimes people don't even get to hear cool parts towards the end of the song.

I could dig up the code from App2 and post it here... not sure that'd be too helpful since it's so easy to do.

I remember that I had a big array that would hold the position of the songs for each room. Then I would save the position of the song in the global on_event (player leaves room) function. I made my own PlayMusic function that just would add the step of seeking the stored position. Then simple, it's all automated, all you have to do is remember to call your own PlayMusicEx function rather than the normal PlayMusic function.

SSH

Quote from: Geoffkhan on Tue 25/04/2006 09:03:11
Quote from: Petteri on Mon 24/04/2006 11:48:39

So my suggestion is, ask SSH to make a module for this. :P

Yup, I already did exactly this for the music in Apprentice II. :)


So where's my name in the Credits? ;)
12

Gregjazz

Quote from: SSH on Tue 25/04/2006 09:11:01
Quote from: Geoffkhan on Tue 25/04/2006 09:03:11
Quote from: Petteri on Mon 24/04/2006 11:48:39

So my suggestion is, ask SSH to make a module for this. :P

Yup, I already did exactly this for the music in Apprentice II. :)


So where's my name in the Credits? ;)

Well see, I actually went into the future and downloaded your "continuous music" module (and brought back a version of AGS that was module-compatible)... so if you want your name in the credits I'm going to have to go back into the past to add your name. The only problem is that through a series of complicated events, I left the time machine in the future, in which case I'd have to go back (or forward?) to retrieve it, but I can't do that because the time machine is in the future... so looks like a no-go, sorry. :)


SMF spam blocked by CleanTalk