ingame karaoke help [input needed]

Karaoke & Over Flow
Tf2.FestersPlace.com:27019
User avatar
Flynnstone
Posts: 884
Joined: Fri May 08, 2009 4:25 pm
What is 3hirty p1us 4orty?: 4

Re: ingame karaoke help [input needed]

Post by Flynnstone » Sun Jun 05, 2011 3:06 pm

Supernova wrote:It's actually used in the iPhone browser as well, or at least it should be considering WebKit was originally created by Apple. It was only open-sourced later.
Nope its a fork of KHTML.
http://en.wikipedia.org/wiki/KHTML
Who's this Bloke guy?
Image

User avatar
BBloke
Posts: 7483
Joined: Mon Jun 09, 2008 11:42 pm
What is 3hirty p1us 4orty?: 4
Contact:

Re: ingame karaoke help [input needed]

Post by BBloke » Sun Jun 05, 2011 11:41 pm

The /vol command persists via mysql database setting per steamid. No cookies set just a db call made per song played. if I could find a player that used time parameters for playing we'd be golden.
Image
" 'Mother' is the name for God on the lips and hearts of all children."

User avatar
Supernova
Posts: 1530
Joined: Fri Mar 14, 2008 8:43 pm
What is 3hirty p1us 4orty?: 4

Re: ingame karaoke help [input needed]

Post by Supernova » Mon Jun 06, 2011 9:37 pm

The difficulty comes in synchronising the streams, even once you tell somebody's player to start at time T you would need to compensate with a guesstimate at how long it would take the client to fetch and sufficiently cache the stream.

It's quite difficult to do without some client-server interaction :(
Image

User avatar
__fell
Posts: 1545
Joined: Sun Dec 20, 2009 10:07 am
What is 3hirty p1us 4orty?: 4
Location: Bristol

Re: ingame karaoke help [input needed]

Post by __fell » Mon Jun 06, 2011 10:08 pm

maybe if you could somehow have start time T determined by real world time, ie client side..

just need to link up to the atomic clock and we're golden (i think a variance of +/-0.3 ms is acceptable) :P
Image

User avatar
BBloke
Posts: 7483
Joined: Mon Jun 09, 2008 11:42 pm
What is 3hirty p1us 4orty?: 4
Contact:

Re: ingame karaoke help [input needed]

Post by BBloke » Mon Jun 06, 2011 11:10 pm

Thats a nice idea but I think you also have to compensate for network latency per client which is something different too but negligable if you consider everyone is generally within 200ms or so.
Image
" 'Mother' is the name for God on the lips and hearts of all children."

User avatar
Flynnstone
Posts: 884
Joined: Fri May 08, 2009 4:25 pm
What is 3hirty p1us 4orty?: 4

Re: ingame karaoke help [input needed]

Post by Flynnstone » Mon Jun 06, 2011 11:12 pm

Oh i dont know fell, we've got such a choir going it might throw the harmonies out of whack altogether.
Who's this Bloke guy?
Image

User avatar
Supernova
Posts: 1530
Joined: Fri Mar 14, 2008 8:43 pm
What is 3hirty p1us 4orty?: 4

Re: ingame karaoke help [input needed]

Post by Supernova » Tue Jun 07, 2011 11:58 am

BBloke wrote:The /vol command persists via mysql database setting per steamid. No cookies set just a db call made per song played. if I could find a player that used time parameters for playing we'd be golden.
The sourcemod plugin contains the following lines:

Code: Select all

cookie_offs_l = RegClientCookie("karaoke_offset_lyric", "Sets the offset for Karaoke mod.", CookieAccess_Public);
cookie_offs_m = RegClientCookie("karaoke_offset_music", "Sets the offset for Karaoke mod.", CookieAccess_Public);
cookie_volume = RegClientCookie("karaoke_volume", "Sets the volume for Karaoke mod.", CookieAccess_Public);
You can specify your own music and lyrics offset and volume for your own client, and the /vol command calls this:

Code: Select all

SetClientCookie(client, cookie_volume, vol_);
Is this actually something on a database rather than a client-side cookie?

Anywho, after some thinking, if we found a flash player that could be started with a specified number of milliseconds or seconds into the song and with a custom volume then it would be possible to synchronise the following (given some tinkering, I'm not even sure what language the source plugin is, looks like an offshoot of c++ or something that gets parsed into c++):
a.) everybody's song starting at the same time
b.) restarting the song at the correct time when vol changes

The playSong function takes a client id parameter and reads the client's preference for volume, then constructs the url to send to the background HTML page. It would be possible to add a few other parameters into that page including a unix timestamp and a song offset. If those were used to say "at this timestamp the song should be at this time" then it could be used to synchronise. If we knew that a client would take perhaps 3 seconds to load the page then 7 seconds to cache enough of the song to play (i think the current karaoke mod says "starting in 10 seconds" so that might be ok) then we could run some JavaScript on the motd page that pre-caches and then starts playing at the correct offset once the epoch time is reached.

That would hopefully fix both of those problems with maybe a day or two's work incl. testing (I have no experience with sourcemod whatsoever).

..

A much simpler fix would be to add a thing saying "You can't change the volume while a song is playing!" response to the /vol command :D
Image

User avatar
Supernova
Posts: 1530
Joined: Fri Mar 14, 2008 8:43 pm
What is 3hirty p1us 4orty?: 4

Re: ingame karaoke help [input needed]

Post by Supernova » Tue Jun 07, 2011 12:04 pm

Infact, this *should* do the above little fix:

At the top of the function cmd_volume:

Code: Select all

    if (song_url[0] != '\0') {
        ReplyToCommand(client, "\x03[Karaoke]\x01 Please try changing the volume when there is no song playing!");
        return Plugin_Handled;
    }
Image

User avatar
Supernova
Posts: 1530
Joined: Fri Mar 14, 2008 8:43 pm
What is 3hirty p1us 4orty?: 4

Re: ingame karaoke help [input needed]

Post by Supernova » Tue Jun 07, 2011 12:38 pm

I've also been trying to figure out how to stop songs being played if they will run over the map change. The problem is, the time until map change might be less than the song duration but the map could still be running (remember avanti running on and on and on and on and on because somebody is still holding the intel).

It might not be such a useful fix after all.
Image

User avatar
BBloke
Posts: 7483
Joined: Mon Jun 09, 2008 11:42 pm
What is 3hirty p1us 4orty?: 4
Contact:

Re: ingame karaoke help [input needed]

Post by BBloke » Tue Jun 07, 2011 1:51 pm

Maybe I should have posted this before now. I may have done way in the past but one major issue with the pre-buffering is it caused server and/or client crashes if memory serves me well enough. I removed pre-buffering because of it.

It would be very handy for further development to have a SWF player that can handle time much like YT. That would give more scope to play with.

Is karaoke taking over the world?!
Image
" 'Mother' is the name for God on the lips and hearts of all children."

Post Reply