Posted by the god
Dentin on Jul 06, 2012.
MSP Protocol Used by Alter Aeon
Alter Aeon uses a fairly minimal MSP implementation, consisting primarily of the
"
off" keyword, the "
U="
option, the "
V=" option, and a new, nonstandard
"
R=" option.
Alter Aeon's MSP is intended to be used in download mode, and soundpacks are
generally not provided as a unified download. If your client doesn't support the
"
U=" option, you may run into issues.
When MSP mode is enabled, a "
U=" download path is
always immediately sent. For example:
!!SOUND(Off U=https://www.alteraeon.com/soundpack/wav_v1/ X=2.0)
(Note that the "Off U=" startup sequence may occur at any time, and clients should
handle repeats transparently.)
This startup sequence sets the default sound url and gives the MSP version number.
The X tag is the version of MSP supported. Version 2.0 and higher implies that
the server supports the "!!SOUNDCTL()" negotiation command.
When a sound is to be played out, a minimal MSP string is sent, with an extra,
non-standard "
R=" option. If your client does
not support the "
R=" option, the option should be
silently discarded. If your client does not silently discard unknown options,
it is broken. (Seriously. Get a new client.)
The original Zuggsoft MSP spec can be found at:
http://www.zuggsoft.com/zmud/msp.htm
While this is the reference specification used by many clients, it should be
noted that the spec is extremely old, limited, and has a number of unspecified
cases. This document attempts to address some of those issues, as well as
more clearly define Alter Aeon's usage of MSP.
Manual Enable of MSP Mode
The commands 'set msp on' and
'set msp off' can be used to manually enable or
disable MSP mode on Alter Aeon.
Note that the 'set msp' commands also work at the
main login menu. Prior to selecting '1' to enter
the game, you may 'set msp on' or
'set msp off' to change MSP mode. This allows
MSP to be properly configured prior to login.
Automatic Enable of MSP Mode
On initial connect the server will send the Telnet sequence:
IAC WILL TELNET_MSP
Where
TELNET_MSP has the value 90, as per the
Zuggsoft MSP spec.
At any time, clients may send:
IAC DO TELNET_MSP
IAC DONT TELNET_MSP
to enable or disable MSP mode.
Non-Standard MSP Extension - Audio Versioning
The "
R=" option is used by Alter Aeon to
indicate a sound version with each audio file. This is a non-standard
extension, and is probably not supported by most mainline clients.
Clients shall silently discard this option if they do not understand it.
Client Usage: Clients shall cache downloaded sounds, and keep version
information for each sound. If the version found in an
"
R=" string does not match exactly the cached
version, the sound shall be re-downloaded. The version information need
not be numeric, and should be matched exactly.
Examples:
!!SOUND(spell/dispel.wav R=5)
!!SOUND(spell/chimes.wav R=6)
!!SOUND(spell/sanctuary.wav R=19)
Implementation note - if a sound is deemed out of date, it is acceptable
(but not required) to play out the cached/out of date version of the sound,
and start the update download in the background. Downloads take time to
complete, and this allows at least some audio to be played out while the
updated version is in transit.
Implementation note - if clients wish to allow user overloaded sounds, they
may ignore the version information and download process. We recommend that
the server specified, downloaded audio cache be kept completely separate
from the user-specified audio, with the user-specified directory structure
matching the server specified directory structure.
This allows the client to search the user-specified directories for the
custom audio first, with the server directories as a fallback. It preserves
the integrity and versioning of the server sounds, and allows the user to
easily add, remove, or change custom sounds in the user specified directories.
MSP Implementation Note - Audio Preloading
The "
V=" option with an argument of
'
0' is defined as 'play out the sound at
zero volume'. Since no audio is played out, this can be used as a
'preloader' to fetch missing data prior to when it is needed.
For this reason, the "
V=0" option is used by Alter
Aeon to indicate audio preloading. When the "
V=0"
option is present, clients should search the cache and verify that the sound is
present. If the sound is not present, or if the version information does not
match, the sound should be re-downloaded for future playout.
Remember that the "
V=0" string indicates zero
volume. No audio shall be played out, even though downloading may be triggered.
Examples:
!!SOUND(move/step2.wav V=0 R=19)
!!SOUND(misc/muchbetterat.wav V=0 R=19)
!!SOUND(misc/email.wav V=0 R=25)
Non-Standard MSP Extension - Simultaneous Audio
Alter Aeon does not use the "
P=" option for
determining sound priority. If the server sends a sound, it expects that
sound to be played out, simultaneously with other sounds (or with other
copies of the same sound) if necessary.
It is recommended that MSP implementors only use the "
P="
option to interrupt playout if the option is explicitly sent by the server, for
compatibility with older servers which may use the tag to interrupt long-playing
audio clips. If the "
P=" tag is missing, simultaneous
audio clips should be played simultaneously and mixed prior to playout. (See
the implementation note below for advice on mixing and compression.)
Example:
A player walks into a room with two aggro mobs. The following three sound
commands are sent by the server in extremely quick succession:
!!SOUND(move/gravel3.wav R=19)
!!SOUND(combat/hit2.wav R=19)
!!SOUND(combat/hit2.wav R=19)
The client should play out all three sounds simultaneously, summing them together
for final output. Note that the hit2.wav sound should be played out twice.
Implementation Note - because a single sound may be played out repeatedly in quick
succession, it is recommended that the client limit the number of times that a
single sound can be played simultaneously to 3. This can occur in extremely
large groups, or with large notification blocks, where the notification sound
is played once for every line.
In the above example, a double playout of hit2.wav is fine, but if there were
four attempted simultaneous playouts of hit2.wav, the sound should only be played
three times. Further attempts to play hit2.wav should be ignored until previous
playout of hit2.wav was completed.
Most Alter Aeon sounds are short and the audio field is sparse, so this condition
should trigger rarely, and will likely not be noticed by most players.
MSP Implementation Note - Audio Summing and Compression
It is recommended that simultaneously played audio shall be linearly summed,
with overflow compression and soft clipping at extreme levels.
The official Alter Aeon client uses a highly compressed soft clipping scheme
for summed audio that amounts of a six part piecewise linear
function. This function is fairly easy and quick to implement in software, and
should cause no performance issues on modern machines, even if written in normal
unoptimized C code.
Input range 0 to 16383
Output range 0 to 16383 - compression factor 1.0
Input range 16384 to 32767
Output range 16384 to 20479 - compression factor 4.0
Input range 32768 to 65535
Output range 20480 to 24575 - compression factor 8.0
Input range 65536 to 131071
Output range 24576 to 28671 - compression factor 16.0
Input range 131072 to 262143
Output range 28672 to 32767 - compression factor 32.0
Input range 262144 and up
Output range 32767 - compression factor infinity
This scheme gives a maximum compression level of 18 db should a large number of
very loud sounds be played out simultaneously, while limiting crackling and other
ugly sounding distortion typically caused by hard clipping.
MSP Implementation Note - Line Mode and Spoofing
Care should be taken by the server to make !!SOUND() data unspoofable. Server side
filtering is recommended so that the "!!SOUND(" string cannot be sent except by the
MSP handling code in the server core.
The Alter Aeon implementation will always put an MSP !!SOUND() tag on its own line.
The data will not be interleaved in other data. The Alter Aeon implementation
cannot be spoofed by players due to server side filtering.
MSP Implementation Note - Unknown Options
MSP clients should ignore unknown options found in the MSP string. Future updates
to this document may rely upon older clients ignoring new options.