Character encoding (Generation III): Difference between revisions

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
m (→‎Control characters: A little organization. I have designs on a somewhat more digestable table(s) if I ever get around to confirming the control characters outside of Ruby)
Line 221: Line 221:
==Control characters==
==Control characters==
* 0xFA and 0xFB both mark a prompt for the player to press a button to continue the dialogue. However, they will print the new line of dialogue differently: 0xFA will scroll the previous dialogue up one line before printing the next line, while 0xFB will clear the dialogue box entirely.
* 0xFA and 0xFB both mark a prompt for the player to press a button to continue the dialogue. However, they will print the new line of dialogue differently: 0xFA will scroll the previous dialogue up one line before printing the next line, while 0xFB will clear the dialogue box entirely.
* 0xFC is an {{wp|escape character}} that leads to several different functions.
* 0xFC is an {{wp|escape character}} that leads to several different functions (see [[#0xFC functions|below]]).
**When followed by 0x01, it will change the color of the text, depending on the byte following. This byte can be anything between 00 and 0F, with the available colors as shown below.
* 0xFD is an escape character for variables, such as the player's name or a Pokémon's name (see [[#0xFD variables|below]]).
**When followed by 0x02, the text will be highlighted, depending on the byte following. Valid bytes are identical to the ones specified above.
**When followed by 0x03, the text's shadow will have its color changed, depending on the byte following. This follows the same color table as listed above.
**When followed by 0x04, the text will be colored and highlighted. The byte immediately following determines the text's color, while a second byte afterward will determine the highlight color. Colors follow the same table as previously stated.
**When followed by 0x06, the text will change size, depending on the byte following. 0x00 will make the font smaller, while anything else will make the font the default size.
**When followed by 0x08 and another byte, it produces a pause in the text. The byte after 0x08 determines the length of the pause.
**When followed by 0x09, the game will pause text display, and resume upon pressing a button.
**When followed by 0x0C, it will escape the byte that follows 0x0C if it is a control character and print a new character. If the second byte after 0xFC is not a control character byte, that byte prints normally.
***When the third byte is 0xFA, "➡" is produced.
***When the third byte is 0xFB, "+" is produced (though in the Japanese games, within the [[Options]] screen, it produces "=").
***The other control characters do not produce any characters. In the English games, nothing is printed, while in the Japanese games, miscellaneous data appears to be printed.
**When followed by 0x0D, the text will be shifted by a certain amount of pixels, depending on the byte following this one. The effect wears off upon entering a new line.
**When followed by 0x10, music will begin to play. Music is specified by the two bytes following, in [[wp:Endianness|little endian]] format.
**When followed by 0x15, text will be rendered slightly larger and more spread out.
**When followed by 0x16, text will be rendered at the default size and spread.
**When followed by 0x17, music will be paused.
**When followed by 0x18, music will resume playing.
* 0xFD is an escape character for variables, such as the player's name or a Pokémon's name.
**When followed by 0x1, the player's name is displayed.
**When followed by 0x2, 0x3, or 0x4, the three buffers will be displayed. Text is assigned to one of three buffers using a variety of script commands.
**When followed by 0x6, the rival's name is displayed.
**When followed by 0x7, the game's name will be displayed.{{sup/3|RSE}}
**When followed by 0x8, the name of the villainous team will be displayed.{{sup/3|RSE}}
**When followed by 0x9, the name of the non-villainous team will be dsiplayed.{{sup/3|RSE}}
**When followed by 0xA, the name of the villainous team's leader will be displayed.{{sup/3|RSE}}
**When followed by 0xB, the name of the non-villainous team's leader will be displayed.{{sup/3|RSE}}
**When followed by 0xC, the name of the villainous team's legendary Pokémon will be displayed.{{sup/3|RSE}}
**When followed by 0xD, the name of the opposing legendary Pokémon will be displayed.{{sup/3|RSE}}
* 0xFE is a line break.
* 0xFE is a line break.
* 0xFF is a terminator, marking the ends of strings.
* 0xFF is a terminator, marking the ends of strings.


===0xFC functions===
When 0xFC is followed by...
*0x01, it will change the color of the text, depending on the byte following. The available colors are listed [[#Color values|below]].
*0x02, the text will be highlighted, depending on the byte following. The available colors are listed below.
*0x03, the text's shadow will have its color changed, depending on the byte following. The available colors are listed below.
*0x04, the text will be colored and highlighted. The byte immediately following determines the text's color, while a second byte afterward will determine the highlight color. The available colors are listed below.
*0x06, the text will change size, depending on the byte following. 0x00 will make the font smaller, while anything else will make the font the default size.
*0x08 and another byte, it produces a pause in the text. The byte after 0x08 determines the length of the pause.
*0x09, the game will pause text display, and resume upon pressing a button.
*0x0C, it will escape the byte that follows 0x0C if it is a control character and print a new character. If the second byte after 0xFC is not a control character byte, that byte prints normally.
**When the third byte is 0xFA, "➡" is produced.
**When the third byte is 0xFB, "+" is produced (though in the Japanese games, within the [[Options]] screen, it produces "=").
**The other control characters do not produce any characters. In the English games, nothing is printed, while in the Japanese games, miscellaneous data appears to be printed.
*0x0D, the text will be shifted by a certain amount of pixels, depending on the byte following this one. The effect wears off upon entering a new line.
*0x10, music will begin to play. Music is specified by the two bytes following, in [[wp:Endianness|little endian]] format.
*0x15, text will be rendered slightly larger and more spread out.
*0x16, text will be rendered at the default size and spread.
*0x17, music will be paused.
*0x18, music will resume playing.
====Color values====
A table of available text, highlight, and shadow colors is shown below.
A table of available text, highlight, and shadow colors is shown below.
{| style="border: 1px solid #999; border-collapse: collapse;"
{| style="border: 1px solid #999; border-collapse: collapse;"
Line 341: Line 335:
| style="background: #47A" |  
| style="background: #47A" |  
|}
|}
===0xFD variables===
When 0xFD is followed by the bytes below, the following variables are printed.
*0x01: the player's name
*0x02, 0x03, or 0x04: whatever text has been assigned to one of three buffers using a variety of script commands
*0x06: the rival's name
*0x07: the game's name{{sup/3|RSE}}
*0x08: the name of the villainous team{{sup/3|RSE}}
*0x09: the name of the non-villainous team{{sup/3|RSE}}
*0x0A: the name of the villainous team's leader{{sup/3|RSE}}
*0x0B: the name of the non-villainous team's leader{{sup/3|RSE}}
*0x0C: the name of the villainous team's legendary Pokémon{{sup/3|RSE}}
*0x0D: the name of the opposing legendary Pokémon{{sup/3|RSE}}


==Trivia==
==Trivia==

Revision as of 21:15, 13 April 2014

The Generation III games use a proprietary character encoding to store text data. The Generation III encoding is greatly different from the encodings used in previous generations, with characters corresponding to different bytes. Versions of the games in different languages may use different encodings, some more different than others.

Some text strings are stored in fixed-length structures while others are stored in a block of text with separate strings simply terminated by 0xFF. In the large, variable-length blocks, usually another structure will have pointers to the appropriate string(s) within that block of text. In the fixed-length structures, strings are still terminated by 0xFF, but any remainder of the alotted space is padded out with 0x00.

Character sets

Note that 0x00 in the following tables is a space (" "), not empty.

English

The English games will print any of the characters below. However, only the characters on a white background are actually used in text. Characters on a dark gray background are holdovers from the Japanese encoding, while those on a light gray background may be used in a game in a different language.

-0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -A -B -C -D -E -F
0-   À Á Â Ç È É Ê Ë Ì Î Ï Ò Ó Ô
1- Œ Ù Ú Û Ñ ß à á ç è é ê ë ì
2- î ï ò ó ô œ ù ú û ñ º ª File:Character 0x2C iii.png & +
3- Lv =
4-
5- ¿ ¡ PK MN PO Ké Character 0x57 iii.png Character 0x58 iii.png Character 0x59 iii.png Í % ( )
6- â í
7-
8-
9-
A- 0 1 2 3 4 5 6 7 8 9 ! ? . -
B- $ , × / A B C D E
C- F G H I J K L M N O P Q R S T U
D- V W X Y Z a b c d e f g h i j k
E- l m n o p q r s t u v w x y z
F- : Ä Ö Ü ä ö ü Control characters

Japanese

-0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -A -B -C -D -E -F
0-
1-
2-
3-
4-
5-
6-
7-
8-
9-
A- 0 1 2 3 4 5 6 7 8 9
B- ・・ . × / A B C D E
C- F G H I J K L M N O P Q R S T U
D- V W X Y Z a b c d e f g h i j k
E- l m n o p q r s t u v w x y z
F- : Ä Ö Ü ä ö ü Control characters

Control characters

  • 0xFA and 0xFB both mark a prompt for the player to press a button to continue the dialogue. However, they will print the new line of dialogue differently: 0xFA will scroll the previous dialogue up one line before printing the next line, while 0xFB will clear the dialogue box entirely.
  • 0xFC is an escape character that leads to several different functions (see below).
  • 0xFD is an escape character for variables, such as the player's name or a Pokémon's name (see below).
  • 0xFE is a line break.
  • 0xFF is a terminator, marking the ends of strings.

0xFC functions

When 0xFC is followed by...

  • 0x01, it will change the color of the text, depending on the byte following. The available colors are listed below.
  • 0x02, the text will be highlighted, depending on the byte following. The available colors are listed below.
  • 0x03, the text's shadow will have its color changed, depending on the byte following. The available colors are listed below.
  • 0x04, the text will be colored and highlighted. The byte immediately following determines the text's color, while a second byte afterward will determine the highlight color. The available colors are listed below.
  • 0x06, the text will change size, depending on the byte following. 0x00 will make the font smaller, while anything else will make the font the default size.
  • 0x08 and another byte, it produces a pause in the text. The byte after 0x08 determines the length of the pause.
  • 0x09, the game will pause text display, and resume upon pressing a button.
  • 0x0C, it will escape the byte that follows 0x0C if it is a control character and print a new character. If the second byte after 0xFC is not a control character byte, that byte prints normally.
    • When the third byte is 0xFA, "➡" is produced.
    • When the third byte is 0xFB, "+" is produced (though in the Japanese games, within the Options screen, it produces "=").
    • The other control characters do not produce any characters. In the English games, nothing is printed, while in the Japanese games, miscellaneous data appears to be printed.
  • 0x0D, the text will be shifted by a certain amount of pixels, depending on the byte following this one. The effect wears off upon entering a new line.
  • 0x10, music will begin to play. Music is specified by the two bytes following, in little endian format.
  • 0x15, text will be rendered slightly larger and more spread out.
  • 0x16, text will be rendered at the default size and spread.
  • 0x17, music will be paused.
  • 0x18, music will resume playing.

Color values

A table of available text, highlight, and shadow colors is shown below.

Byte RS FRLG E
0x00 Transparent
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
0x0D
0x0E
0x0F

0xFD variables

When 0xFD is followed by the bytes below, the following variables are printed.

  • 0x01: the player's name
  • 0x02, 0x03, or 0x04: whatever text has been assigned to one of three buffers using a variety of script commands
  • 0x06: the rival's name
  • 0x07: the game's nameRSE
  • 0x08: the name of the villainous teamRSE
  • 0x09: the name of the non-villainous teamRSE
  • 0x0A: the name of the villainous team's leaderRSE
  • 0x0B: the name of the non-villainous team's leaderRSE
  • 0x0C: the name of the villainous team's legendary PokémonRSE
  • 0x0D: the name of the opposing legendary PokémonRSE

Trivia

  • In the name field for Eggs, the game places the bytes 0x60 0x6F 0x8B corresponding to タマゴ (tamago, the Japanese word for egg). This remains in the English version even though the characters have been replaced.


Data structure in the Pokémon games
General Character encoding
Generation I Pokémon speciesPokémonPoké MartCharacter encodingSave
Generation II Pokémon speciesPokémonTrainerCharacter encoding (Korean) • Save
Generation III Pokémon species (EvolutionPokédexType chart)
Pokémon (substructures) • MoveContestContest moveItem
Trainer TowerBattle FrontierCharacter encoding (GameCube) • Save
Generation IV Pokémon species (EvolutionLearnsets)
PokémonSaveCharacter encoding (Wii)
Generation V–present Character encoding
Generation VIII Save
TCG GB and GB2 Character encoding


Project Games logo.png This data structure article is part of Project Games, a Bulbapedia project that aims to write comprehensive articles on the Pokémon games.