Pfhortran is a scripting language written for Marathon: Aleph One, an open-source project centered around Bungie Software's Marathon 2 source code. The language was created by Chris Pruett, and is distributed under the GNU Public Licence.This document is intended to provide a detailed description and explanation of the Pfhortran scripting language. Reading this should teach you how to code in Pfhortran, give you some idea of the power of Pfhortran, and make it clear to you what Pfhortran cannot yet do.
If you have never heard of Marathon or Aleph One, now might be a good time to stop reading.
Pfhortran scripts are pretty powerful. They can control the items the player carries, give or take life and oxygen, control the camera in cut-scenes, trigger tags in a map, and manipulate fog settings (if OpenGL is turned on). See the Future Plans section for information about what Pfhortran may be able to do one day.
Pfhortran programming is fairly straightforward. Each line can contain one of three things: a comment, a script directive, or a script instruction. A comment is just some text so other humans reading your code can understand what you are doing. A directive is a function that tells Pfhortran how to execute the script. Directives don't actually change the game experience at all, they just let you manipulate how Pfhortran works. Instructions are the heart of Pfhortran. They are responsible for actually manipulating the game state. Instructions actually do things to Marathon itself, and give the coder the power to change the game in many different ways.
Now for a little technical information that will come in handy later: on the Macintosh, Pfhortran scripts live in a "TEXT" resource in the map file they are associated with. Each level within the map file is represented by a different script. It is customary for each script to be given an ID number equal to 1000 + the level number that script is associated with. For example, a script for level 0 (remember, the first level is always level zero) would be held in text resource ID 1000. Level 5 would be in text resource ID 1005. Pfhortran scripts are only valid if they are associated with a special Marathon Markup Language (MML) script located at resource ID 128. The MML script located at TEXT resource 128 should look something like this:
Sample MML Script ID 128
|
<marathon_levels>
<level index="0">
<mml resource="10100"/>
<pfhortran resource="1000"/>
</level>
<level index="1">
<mml resource="10101"/>
<pfhortran resource="1001"/>
</level>
<level index="2">
<mml resource="10102"/>
<pfhortran resource="1002"/>
</level>
</marathon_levels>
|
|
On the PC and Linux, scripts are stored as plain text files outside the map file itself. Like Macintosh Pfhortran scripts, they only work in association with an MML script such as the one shown above. A helpful package containing a sample level with the resequite MML and Pfhortran scripts is available here:
Like we said, Pfhortran scripts can control items, energy, cameras, monsters, cut-screens, fog, and more. How can one accomplish these great feats, you might ask? Well, on to the next section...
|