A-code internationalisation

As of version 12.83, A-code is sufficiently UTF8 compliant to handle games with messages, vocabulary and entity names in languages other than English, including ones which use non-ASCII characters, provided (a) words are separated by ASCII blanks (octal 32) and (b) are parsed left to right. All you need is a UTF8-compliant text editor. While this degree of UTF8-compliance is only possible since A-code version 12.83, it is available in games using A-code styles from 10 upwards.

UTF8 compliance means that you can have texts and player vocabulary, including object/place names in any character set that can be represented in UTF8 encoding of Unicode. To activate this feature of the current A-code engine, add the UTF8 major directive to the game source header.

Of course, full game internationalisation has other challenges, which are nothing to do with character encoding.

  • Parsing of complex commands
    Some words, such a AND, THEN, AGAIN... have special meaning for the kernel. Different words will apply in different languages.
  • Modifying kernel messages
    While A-code leaves most of communication with the player to the game's code, there are a few occasions when the kernel responds directy -- e.g. about being unable to save a game. These kernel messages also need changing for languages other than English.
  • Echoing player's words grammatically
    When the game incorporates player command words into its responses, in English just echoing player's words is sufficient. Other languages typically need to be able to modify echoed words accoding to their grammar rules.

Parsing complex commands

A-code kernel has to be able to identify words being used to structure complex command: AND being used instead of a comma, and THEN being used instead of a semicolon. Furthermore, if the verb AGAIN is defined by the game, it is intercepted by the kernel and taken to men a request to repeat the previous command (see the section on automatic entities and flags in the A-code language documentation). There are a few other special words that have to be known to the kernel. The current complete list is as follows:

The obvious solution in writing a game in a language other than English is to declare the appropriate synonyms for such special words. (AND and THEN are defined automatically, but can be also defined explicitly as vocabulary words.) E.g. in Czech the equivalent of AND is A, and of THEN is PAK (or POTOM). Thus

WORD AND, A
WORD THEN, PAK, POTOM

enables these words to be used in place of AND and THEN.

There is, of course, an obvious snag to this simple solution. It leaves the English version of such special words in the player vocabulary, which may be very confusing to players (e.g. because of the typo correction mechanism). Or worse, those words might mean something else in some other language. To avoid such problems, one can specify exclusion of English versions from the player dictionary in the standard manner:

WORD -AND, A
WORD -THEN, PAK, POTOM

A bit of magic happens when any synonyms are given to the excluded word, allowing that word to be defined in its own right and having another meaning altogether. Thus it would be perfectly legal to add e.g. WORD THEN to the above example. Any code references to THEN would then be referring to that addition definition. This avoids any potential case of a clash between a reserved English vocabulary word and some word in another language.

If no synonyms are given, the excluded word can still be used by game code, if required.


Modifying kernel messages

The acdc translator defines a number of default messages for kernel's use. Those which can occur during normal play, can be redefined simply by declaring a text message of the appropeiate name. Below is the list of all such redefinable messages with their default definitions and a brief explanation of the circumstances in which the message is used by the kernel. None of these messages need to be defined in the game's code. An explicit definition is only required if a non-default text is desired.

Shown if the game executes the DUMP directive:
TEXT .K.DATA.DUMPED
   Game data dumped into the log file.
This playful instruction is shown only in the Windows console build. It exists in order to prevent game window closing before the player can read game's final message.
TEXT .K.EXIT.ENTER
   (To exit, press ENTER)
This message is displayed when an interrupted game is being resumed. Unlike other messages, it is not written into the log if the game is being logged.
TEXT .K.IN.PROGRESS
   Restoring game in progress...
This error report occurs if an interrupted game is to be resumed but the corresponding game dump cannot be fuond, read or parsed. Which should never happen, of course.
TEXT .K.LOST.SESSION
   Oops! We seem to have lost your current game session! Sorry about that!
The next 5 messages are to do with game being saved by the player.
TEXT .K.NAME.TO.SAVE
   Name to save game under:_
TEXT .K.DUMP.EXISTS
   There's already a game dumped under that name.
TEXT .K.REALLY.OVERWRITE
   Do you really mean to overwrite it?_ 
TEXT .K.AS.YOU.WISH
   As you wish...
TEXT .K.CHANGED.MIND
   Changed your mind, eh? Fine by me...
The following messages occur in only in the library mode, when the controllong routine makes the advturn("_LIST_") call. The first prefixes the list of saved games about to be displayed by the kernel.
TEXT .K.NAME.TO.RESTORE
   Name of saved game to restore:_
TEXT .K.GAME.LIST
   You have the following saved games:_
TEXT .K.NO.SAVED.GAMES
   You have no saved games to restore.
If the QUERY directive is used to prompt for a yes/no answer and the player responds with something other than yes or no, these two messages get used.
TEXT .K.YES.NO
   Eh? Do me a favour and answer yes or no!Which will it be?_
TEXT .K.ASSUME.YES
   (OK, smartass... I'll assume you mean YES - so there!)
FRAGMENT .K.PRE.SAY
   Ok - \"
TEXT .K.POST.SAY
   \"
TEXT .K.OK
   OK.
TEXT .K.MORE
   [More?]_ 

Echoing player words grammatically

Echoing player words in Engish is easy enough. For example, if the player says TAKE CLOAK, responding with "You take the cloak" is fine, but in other langauges, player's CLOAK may have to be transformed from the nominative case to the genitive one. End even in English one may wish to reply with a plural (e.g. "There are no cloaks to be seen here") or transform an irregular verb into the past tense.

The current version of A-code does not as yet offer a way to do this, but I have a cunning plan :-) for a simple extension of the language which would do so. Watch this space!

In the meantime you'll have to stucture game's responses to avoid the need for grammatical transformations.


Back to the documentation index
To the Mipmip home page
Feel free to leave a comment!
Mike Arnautov (06 May 2025)