LFS プログラミング

出典: LFS Manual


By its nature LFS is a very programmer friendly game and, while customisation of the game engine itself is frowned upon, there are many other avenues available for budding addon writers to explore. Whether it's parsing some esoteric file format, writing your own server system, or just grabbing your friend's hotlaps from LFSWorld, LFS has something to keep even the most adventurous hackers busy!

The following category attempts to explain and document the many various programmer topics related to LFS, in hopefully a clear and useful way. Our job of course is not to teach you how to program, there are many, many books about that, but to show you the myriad possibilities for customising LFS which are right at your fingertips.



InSim は、外部プログラムとLive for Speedの通信を可能にするプロトコルです。これを使用すると、LFSとソケット通信を行い、パケットデータの送受信を行うことができます。The InSim protocol describes how each of these packets is formatted, and any programming language which can create a network connection and send and receive strings of binary data can interface with it.

InSim Relay

With InSim Relay you can connect to any subscribed host and share a subset of InSim packets. This is mainly used in the creation of spectator style apps, such as LFSRemote.

OutSim / OutGauge

OutSim と OutGauge も外部プログラムとソケット通信を可能にするものです。InSimと似ていますが、こちらはモーションシミュレーターや外部ダッシュボード(メーターなど)に向けて作られたものです。

LFSWorld ステータス

LFSWorld ステータス では、ホストに関する全ての情報(プレイ中のレーサーの情報など)を取得するクエリを使用することができます。


LFS独自のたくさんの ファイルフォーマット は、開発チーム(公式)や、HEXエディタを使った熱狂的なハッカーたち(非公式)によってドキュメント化されています。



LFSのゲームクライアントはC++によって書かれており、ほとんどのデータ型はC++の言語仕様に準拠しています。The following table represents a breakdown of what each data-type means and what sort of value it holds.

LFS データ型 PHP パック型 説明
char 1 byte signed integer a or C An alphanumeric character (or a number between -128 to 127)
byte 1 byte unsigned integer C A number between 0 and 255
word 2 byte unsigned integer v A number between 0 and 65,535
short 2 byte signed integer s A number between -32,768 and +32,767
unsigned 4 byte unsigned integer V A number between 0 and +4,294,967,295
int 4 byte signed integer l A number between -2,147,483,648 and +2,147,483,647
float 4 byte floating point number f A number with a decimal point

In C strings are not first-class data-types, merely arrays of characters, so you will often see strings denoted using the following syntax.

char[16] <variable>

This indicates that the variable is a string of 16 characters in length, but in reality as the last character in a C-style string is always NULL, it would only be able to hold a value of 15 characters. For php in this case, you would use the 'a' as the pack format code, with a 16 following after it's declaration.

For example:

pack('a16', $variable);


Strings in LFS are C-style strings, meaning that they end with a NULL character, or are often padded with NULL characters. Most other high-level languages have done away with this limitation, so it's important to strip any NULL characters from the end of a string before using it.

LFS handles strings in its own way, it uses Windows codepages sepearared by special escape characters.


コード 名前 コードページ
^L ラテン語 (Latin 1) CP1252
^G ギリシア語 (Greek) CP1253
^C キリル語 (Cyrillic) CP1251
^J 日本語 (Japanese) CP932
^E 中央ヨーロッパ (Central Europe) CP1250
^T トルコ語 (Turkish) CP1254
^B バルト語 (Baltic) CP1257
^H 繁体字 中国語 (Traditional Chinese) CP950
^S 簡体字 中国語 (Simplified Chinese) CP936
^K 韓国語 (Korean) CP949


コード 文字
^v |
^a *
^c  :
^d \
^s /
^q  ?
^t "
^l <
^r >
^h #
^^ ^


^2 黄緑
^6 薄青
^8 濃緑 (デフォルト)
^9 オリジナルの文字色とコードページ