Muds Wiki


Of concern to the design of FANSI 2.0 is that the standard is compatible with a large number of MUD clients, and further that players without compatibility are not drastically effected. Users without FANSI capability (in one or more ways) should still able to distinguish the basic shapes and colors of the FANSI artwork seen by them, in most cases being able to make out the subject matter of the artwork being viewed by them. This is accomplished through a variety of methods:

  • Users with MXP support, but no support for xterm's 256 colors, will have the MUD server convert xterm colors to equivalent MXP colors.
  • Users with no support for 256 colors will have the MUD server downconvert the 256 colors to the standard 16 ANSI colors.
  • Users lacking support for some or all of the extended IBM/OEM characters will have them converted into equivalent looking standard ASCII characters.
  • In the situation where a user simply has chosen not to turn on a font with IBM/OEM characters (or are unable to do so), but are able to view the ISO 8859-1 extended characters, the server will use this additional character set to better match IBM/OEM extended characters to similar looking equivalents.
  • A FANSI compatibility test should be taken by users in order to determine their exact FANSI capabilities.

FANSI Compatibility Test[]

To determine each user's level of support for FANSI, a series of color tests should be performed in the starting room or chargen (character generation) of the MUD, and anytime thereafter at the user's request. The test should roughly follow this flow:

Ask the user to select their client from a list, or to select "Other" for a client not on the list. This is necessary because some clients have certain extended characters they cannot view correctly, and each client has a different set of configuration instructions. Output a series of instructions on a per-client basis that assists the player in configuring their client for optimal FANSI support. (Up to date per-client instructions are available on the Clients page.) Determine if the user's client supports extended IBM/OEM characters by asking them to view a FANSI picture and input something about that picture (such as a word or number in it.)

If a user's client does not support extended IBM/OEM characters, determine if it supports ISO 8859-1 extended characters (by performing a similar test as above.) Determine if the user's client supports XTERM's 256 colors by performing a similar color test. (For example, show the user two red ANSI squares and one orange XTerm 256 square, and then ask them to input what they see). If the user does not support XTERM's 256 colors, determine if their client supports MXP colors. (See the MXP section below for more information on how to display MXP colors.)

Inform them of their FANSI compatibility, including any deficiencies determined from the tests or simply from their client choice, and then configure the MUD to output to their character accordingly.

IBM/OEM Code Page 437 Extended Characters[]

FANSI supports the use of 151 "extended ASCII" characters, from the IBM/OEM (code page 437) font.

151 "extended ASCII" characters, from the IBM/OEM (code page 437) font

The ASCII values for these characters are:

  • 1
  • 3 through 6
  • 14 through 26
  • 28 through 31
  • 127 through 254

This can be implemented in MUD clients either through a font containing the symbols above at the ascii values above (such as the "Terminal" font available in Windows), or by using any fixed-width font for the non-extended characters (ASCII values 32 through 126), and then a same size fixed-width font containing appropriate Unicode replacement values for these extended characters (such as Courier New.) See the IBM/OEM Implementation page for code for a Unicode replacement array.

MXP As An XTerm 256 Replacement[]

Clients without support for XTerm's 256 colors, but support for MXP (MUD eXtension Protocol) should have MXP <COLOR> tags output to them from the MUD server in replacement of XTerm 256 color terminal commands. The <COLOR> MXP tag can be truncated to the following:

<C (foreground hex color)>(text)</C>
<C B=(background hex color)>(text)</C>

The back and foreground hex color is the same color hex code provided in the previous color table.

As per MXP specifications, the tags should be prepended with:

<ANSI escape code>[1z

and appended with:

<ANSI escape code>[3z

For example: <ANSI escape code>[1z<C #FFCA0D>Hello world</C><ANSI escape code>[3z

One last consideration, the characters in (text) may contain certain characters which could be interpretted incorrectly by a client as an MXP tag or something else. These characters should be replaced with their equivilant HTML entities. The following substitutions should be made on the (text) string:

  • < replaced with &lt;
  • > replaced with &gt;
  • & replaced with &amp;
  • " replaced with &quot;

This is a partial implementation of only one small aspect of MXP, which is all that is required for FANSI 2.0 support. See the MXP website for more information about MXP's many additional features.

256 Color To 16 Color Conversion

Users without clients capable of the 256 XTerm colors or MXP should have all of the 256 XTerm color codes downconverted into the standard 16 ANSI color codes before being sent to them. Because bright background colors are not allowed in standard ANSI, the background should be converted to the bottom 8. Algorithms exist to perform such downconversions. An example of such is available on the 256 Colors Implementation page.

If a user's client cannot properly display some or all of the IBM/OEM extended characters, the MUD server should convert those characters into similarily shaped standard ASCII characters. If the user views the ISO 8859-1 extended characters instead of the IBM/OEM extended characters (something determined by the FANSI Compatability Test, described previously) these characters can sometimes be used as better substitutions than standard ASCII characters, and in many cases match perfectly with extended characters in the IBM/OEM set.

The implementation of these functions in PennMUSH is available on the Implementation pages of the fANSI website.

External Links[]