Media Managers

For feedback on the game code and design. Feedback on server rules and playstyle belong in Policy Discussion.
Post Reply
User avatar
vista
Joined: Tue Apr 15, 2014 4:28 pm

Media Managers

Post by vista » #12177

Media manager system
Media managers
What are they?
They exist in every client in the world as a datum and act as a handler between the game and the Windows Media Player instance that resides in the interface. They have two important vars - url and startTime, which they send to the WMP instance every time the media manager's update_music() proc runs.

What calls update_music()?
There are two different cases - either we enter a new master area, triggering the hook OnMobAreaChange, which in turn calls our update_music() proc, or we are in an area where there is already a media source, and it becomes active or changes songs, calling it's own update_music() proc, which in turn notifies all clients in it's own master area to call their update_music() proc.

What happens when update_music() is called?
The client queries the current area for an active media source. If it exists, it gets it's targetUrl and targetStartTime variables, assigns their values to url and startTime, and calls send_update(). send_update() opens a link, which contains these variables as parameters, in the pane in which the WMP instance resides, this calls the JS function SetMusic which modifies the WMP instance's variables to match the sent data.

Can badmines fuck with the media manager?
They can mass modify the variables of the media managers to point to a specific URL and do a proccall on every client for send_update (SQDL!), but when clients enter a new area, the music/sound will cease. Fuckery is not recommended at the moment.

Media sources
What are they?
They are pretty much the controllers of what players hear in the media source's master area. Because of their property to force clients to play any sound file upon entering a specific area, they can be used to replace maintenance / space ambience, streaming resources means that the burden on the game's RSC filesize will be lower, should the ambience system be switched to a media source-based system. Media sources are technically machinery, which means they can be easily spawned by both mappers and admins alike. A simple varedit can change which file, at what volume from which millisecond to play.

What's the connection between master areas and media sources?
Every master area has a media_source variable, it starts off as null. However, if a media source is spawned inside a master area, the media source will, through it's update_media_source() and disconnect_media_source() proc, either associate or disassociate with the master area it is in. A newly spawned media source will not displace a media source that is already inside the area. If a media source leave the area (e.g. the jukebox gets moved), the clients will get notified of this through an update_music() call and cease playing music.

Where are they implemented?
The jukebox. The jukebox gets it's playlists from a generated JSON data(?). The base media URL returns the playlists in a list. After selecting the playlist to play, it plays the next song, based on the selected play mode (shuffle, repeat one, play once). The URL it queries is the following media_base_url + /?playlist= + playlist_id (resulting in, for example: http://vista.bananabox.biz/media/?playlist=rock), which returns a list of objects, each object being a playlist item. The variables of each song are calculated from the ID3 tags of the songs.

Any pitfalls?
Yes, there is one small problem on /tg/ - in order to preserve hotkey mode, the interface gets reloaded on every mob mind/client transfer, the music playback will cease when transferring from one mob to another or ghosting.
User avatar
paprika
Rarely plays
Joined: Fri Apr 18, 2014 10:20 pm
Byond Username: Paprka
Location: in down bad

Re: Media Managers

Post by paprika » #12186

>replacing dumb ambient noises with awesome background dead space tier dark ambience in maint and shit

my immersions are moving on their own.
Oldman Robustin wrote:It's an established meme that coders don't play this game.
kosmos
Joined: Tue Apr 22, 2014 2:59 pm
Byond Username: Kingofkosmos

Re: Media Managers

Post by kosmos » #13314

I lean towards keeping the current system, and using midis for music instead of high-quality mp3-files. I've always liked the retro-feel of SS13's sound environment and an admin's well-placed midi makes a very nice touch to some situations.
It just wouldn't feel like SS13 to me anymore if the midis would be changed to "real" .mp3's.

Except if there's a rule set that all jukebox-music and ambient music would be instrumentals, chiptune-based or otherwise fit the retro feel (FTL soundtrack and such).
Post Reply

Who is online

Users browsing this forum: No registered users