Friday, 1 August 2014

Milkshape 3D 1.8.5 *.ms3d file format

The Milkshape 3D file format is included in the available at but contains some errors which I have corrected.

I also added some extra information for clarification.

Saturday, 12 July 2014

Metasequoia Script – Import MilkShape3D *.ms3d

Here is a script that imports a model from a MilkShape3D *.ms3d file.

The script uses Python 3 modules, syntax and objects so can only be used as is with Metasequoia 4.

MS3D model imported into Metasequoia 4

Tuesday, 8 July 2014

Keynote *.mqx file format

The Keynote plugin for Metasequoia stores its animation data in an XML text file with the file extension *.mqx.

I created the following simple animation using the Keynote plugin to study the keyframe data stored in the *.mqx file.

The animation starts and ends with both bones pointing in the +Y axis direction.

An animation created with the Keynote Metasequoia plugin

Mikoto *.mkm file format

Mikoto can export its animation data to a text file with the file extension *.mkm.

I created the following simple animation in Mikoto to study the keyframe data stored in the *.mkm file.

The animation starts and ends with both bones pointing in the +Y axis direction.

Animation created in Mikoto

Monday, 7 July 2014

About Rotations in Skeletal Animation

In skeletal animation, for every frame of an animation, the position of a bone’s origin (pivot point) and a bone’s rotation is stored for each bone in a hierarchy of bones.

The hierarchy of bones is also known as a skeleton.

In this article I will only discuss the rotations.

Like any 3DCG object you create in 3D modelling software, each bone has a local coordinate system defined by X,Y and Z axes.

For example I can define a bone as an object where the direction from the origin of the bone to its tip is in the positive Z axis direction and the the top of the bone is in the positive Y axis direction.

In essence I have created an object as shown below.

A bone can be considered a 3D object

Wednesday, 2 July 2014

Mikoto2x instructions 2

Since I now have the TR4 Lara Croft Metasequoia character rigged using Mikoto’s anchor method [link] I wanted to see if Mikoto2x could export the dance animation I transferred to my character in the sixth part of the Mikoto tutorials [link].

The instructions for Mikoto2x are here [link].

From the screenshot below you can see that conversion was successful.

dance bvh converted in Mikoto2x

Animating with Mikoto – part 9

To use the spherical deformation method in Mikoto the name of the object containing the mesh to be deformed must begin with sdef:. Do not forget the colon :.

Unlike the bone deformation method, the spherical deformation method only works when anchor objects have been created to bind the vertices to the bones.

Change our skin mesh object’s name to “sdef:skin” and save the *.mqo.

Rename skin object sdef

Monday, 30 June 2014

Tip for Quaternion Multiplication by Hand

Here is a technique for multiplying two quaternions by hand so you do not have to remember the formula mentioned in my introduction to quaternions post [link].

If you are multiplying P x Q where P and Q are two quaternions create a grid as shown below.

Write the first quaternion of the multiplication in a column on the left side of the grid and then write the second quaternion in a row at the top of the grid.


Metasequoia Script – Using Quaternions to Rotate Points

You can use a Python script in Metasequoia to demonstrate the quaternion sandwich product rotating a point.

I have set up a Metasequoia document as shown below.

Demonstate quatenion sandwich product in Metasequoia 4

Saturday, 28 June 2014

A Gentle Introduction to Quaternions

The internet doesn’t have enough tutorials about quaternions so I thought I’d add another one. ;-)

You only need to learn the basic arithmetic and some formulae to enable you to get the hang of quaternions.

The multiplication sign, x in this article stands for ordinary, everyday multiplication.

Remember to to do the multiplications first in any sum before doing the additions.

Firstly I’ll introduce you to some unusual numbers that you don’t see in everyday life.

Lets call them alphabet numbers.

Tuesday, 24 June 2014

Building a Simple C program in ZinjaI

Zinjai [link] is a C and C++ integrated development environment or IDE.

An IDE contains a text editor to write code, a compiler to compile code, a linker to build compiled code into an executable file and a debugger to pause a program during execution to allow a programmer to examine the program’s state.

ZinjaI screenshot

It is a Spanish language program but there is a version mostly translated into English.

Note that there is a newer version (20140620) available but it seems to have a bug that does not allow the user interface to be set to English. Update 25 Jun 2014: This bug has been fixed.

Zinjai was created for teaching programming so is good for beginners to use.

One useful feature is that you do not have to create a project to test simple C or C++ code. Just type it in and run it.

Zinjai uses the MingW GNU compilers and tools to compile and build programs. You need to know this if you download other code libraries to use with your programs.

In my post about MQO viewers [link], I posted a site where you can download the C source code for GLMetaseq.

Download from that site [link], near the bottom of the page.

We will build the sample_GL program in Zinjai so we can view a Metasequoia *.mqo file.

Sunday, 22 June 2014

Metasequoia Script – Import one of your own modules

Sometimes a Metasequoia Python script may contain many lines of code.

To keep the script simple you can split the script into several smaller scripts.

For instance you could have all your function definitions in a script of their own.

To access those functions you would import the script containing your functions into your main script the same as we have been doing for Python’s inbuilt modules such as “math”.

The script you import must have a filename that is a valid Python identifier so cannot start with a number and use only letters or numbers or the underscore, ‘_’.

The script file must have the extension ".py".

The script you import must not have any executing code or only have executing code in an “if __name__== “__main__”:” block.

For Metasequoia 4 the script or scripts you import must be in the same folder with the main script.

If you use Metasequoia’s MQSystem classes in the script you import, in that script you must explicitly import the MQSystem module as follows or you will get errors.

import MQSystem

Saturday, 21 June 2014

Metasequoia Script – Display an OpenFile Dialog

This script shows how to display an OpenFile dialog in Metasequoia 4.

Metasequoia 3 doesn’t have the MQWidget classes so this script is only for Metasequoia 4.

You use an OpenFile dialog to get a filename (actually the full path to a file) for your script.

Once your script has a filename you could use standard Python code to read the file.

You could, for example, write a script to open a 3D file format that Metasequoia does not support.

Friday, 20 June 2014

Metasequoia 4.2.2 User Interface Customisation

By default Metasequoia 4 ships with four predefined edit modes.
  • Beginner
  • Modeling (String)
  • Modeling (Icon)
  • Mapping
The edit mode setting determines which items appear in the command panel.

A “Customize” option has been added to the Edit Mode dropdown menu in Metasequoia 4.2.2.

Customize option added to Edit Mode menu

Metasequoia Script – Script Template

See this post [link] for the basics of using Metasequoia’s Script Editor.

Here is a Python script you can use as a starting point for your scripts.

Learning fragMOTION part 4

In TRLE games the gunflash for the shooting animations of enemies is an object that is linked to a particular mesh number of the enemy object.

Usually you can guess that the mesh the gunflash is linked to is the gun mesh.

That is, the gunflash is positioned x, y, z units from the origin of the gun mesh.

Gunflash positioning

You can use fragMOTION to be sure which mesh the gunflash is linked to by changing the rotation of the mesh and seeing if the gunflash position rotates too and stays in the correct position relative to that mesh.

Tuesday, 17 June 2014

MQO viewers

A collection of programs that can load and display Metasequoia *.mqo files.

Changing a TRLE meshtree with TRWad Reorganizer

In Tomb Raider 4 the gunflashes are linked to a particular mesh number of the animating object’s skeleton (meshtree). For instance the SAS slot links the gunflash to mesh number 7 of the animating object in that slot. Mesh number 7 is the mesh of the gun.

See this post [link] for how to find which mesh the gunflash is linked to by adjusting the shooting animation using fragMOTION.

If, in the SAS slot, you replace the SAS animating object with a different enemy, the gunflash may appear at the wrong place because mesh 7 of the new enemy is not the gun mesh.

So one reason to change the mesh order is to have the gunflash appear in the correct position.

TRWad Reorganizer [link] is a program that can change the order of the meshes in an animating object’s meshtree.

Changing the order of the meshes usually ruins the existing animations but the magic of TRWad Reorganizer is that it adjusts the animation’s keyframes to match the new mesh order so the animations are not ruined.

Monday, 16 June 2014

Metasequoia Script – Mikoto bdef bone influence

See this post [link] for the basics of scripting in Metasequoia.

In this post [link] I talk about how Mikoto assigns vertices to a bone using the geometry of the triangle created in Metasequoia for bdef meshes without using anchors.

To help visualise which vertices will be bound to a bone I wrote a script that shows the zone of influence of each bone.

The Metasequoia Python API doesn’t have routines to create Primitive objects so rather than create an object in code this script requires a Primitive to be created in Metasequoia which it can copy.

The Primitive object must be named capsule and have its properties set as shown in the screenshot below.

Create a capsule primitive with these settings

Sunday, 8 June 2014

Metasequoia 4.2 *.mqo file includes a thumbnail

Be aware that Version 4.2.1 of Metasequoia embeds a thumbnail image in an *.mqo file by default.

This means a large increase in the size of the *.mqo file.

It may also make the *.mqo file incompatible with some programs.

Since version 4.1 was uninstalled when I installed version 4.2.1 I cannot check whether version 4.1 also saved a thumbnail in the *.mqo.

You can disable this feature by clicking File>Configuration>File and unchecking “Embed a thumbnail”.

Go to Configuration to disable saving a thumbnail image

Make sure Embed a thumbnail is unchecked

Animating with Mikoto – part 8

To use the bone deformation method in Mikoto the name of the object containing the mesh to be deformed must begin with bdef:. Do not forget the colon :.

Our model’s skin is composed of separate meshes so to make it easier to demonstrate the deformation I will merge all the skin meshes into a single object.

In Metasequoia, click “Misc” in the Object Panel and click “Show All” to make all objects visible and then hide the “bone” object.

Click “Misc” in the Object Panel and click “Merge all visible”.

Merge skin meshes into one mesh

Click OK on the dialog to merge the skin meshes into one mesh.

One skin mesh

Saturday, 7 June 2014

Metasequoia Script–Lots of cubes

See this post [link] for the basics of using Metasequoia’s Script Editor.

I found an interesting script at this Japanese blog [link].

Animating with Mikoto – part 7

We used the closest bone method to assign our character’s meshes to the bones in the skeleton.

When a model is composed of separate mesh objects as ours is you can specify which bone a mesh is bound to by adding the bone name to the mesh object’s name separated with a hyphen (dash), “-”.

As an example I have bound the “Head (31)” object to the “foot[R]” bone by changing the object name to “Head (31)-foot[R]”.

Add bone name to object name to bind to that bone

In Mikoto the head no longer moves when the “head” bone is moved but only when the “foot[R]” bone is moved.

Head no longer moves with closest bone

Head rotates with right foot

Of course you would not bind the head mesh to the foot. I only did this to illustrate how this new method of binding meshes to bones overrides the closest bone.

The technique we have been using so far has not changed the shape of any of the meshes.

This method is all you need for some objects but for most human and animal characters you want to make the meshes bend smoothly at the joints such as elbows and knees etc.

To do this in Mikoto you have two choices, bone deformation (bdef) or spherical deformation (sdef).

prev | next

Friday, 6 June 2014

Metasequoia Script–Sierpinski Triangle Pyramid

See this post [link] for the basics of using Metasequoia’s Script Editor.

I found an interesting script at this Japanese blog [link].
# fractal generate

doc = MQSystem.getDocument()

num = doc.numObject
obj = doc.object[0]

# field

x = 100
y = 100
z = 100
rn = 4 # recursive number

# Primitive

p01 = MQSystem.newPoint(x/2,y,z/2)
p02 = MQSystem.newPoint(0,0,0)
p03 = MQSystem.newPoint(x,0,0)
p04 = MQSystem.newPoint(x,0,z)
p05 = MQSystem.newPoint(0,0,z)

# function fractal()

def fractal(number,p1,p2,p3,p4):

  if number == 1:
    v = []
    v.append( obj.addVertex(p1) )
    v.append( obj.addVertex(p2) )
    v.append( obj.addVertex(p3) )
    v = []
    v.append( obj.addVertex(p1) )
    v.append( obj.addVertex(p3) )
    v.append( obj.addVertex(p4) )
    # bottom
    v = []
    v.append( obj.addVertex(p4) )
    v.append( obj.addVertex(p3) )
    v.append( obj.addVertex(p2) )
    p5 = MQSystem.newPoint((p1.x + p2.x)/2, (p1.y + p2.y)/2, (p1.z + p2.z)/2)
    p6 = MQSystem.newPoint((p2.x + p3.x)/2, (p2.y + p3.y)/2, (p2.z + p3.z)/2)
    p7 = MQSystem.newPoint((p3.x + p1.x)/2, (p3.y + p1.y)/2, (p3.z + p1.z)/2)
    p8 = MQSystem.newPoint((p3.x + p4.x)/2, (p3.y + p4.y)/2, (p3.z + p4.z)/2)
    p9 = MQSystem.newPoint((p4.x + p1.x)/2, (p4.y + p1.y)/2, (p4.z + p1.z)/2)
    p10 = MQSystem.newPoint((p4.x + p2.x)/2, (p4.y + p2.y)/2, (p4.z + p2.z)/2)
# endfunction fractal()



Make sure you have an empty Scene in Metasequoia by clicking File>New then open the Script Editor and paste the code into the upper input pane of the editor.

Paste the code into the Script Editor's input window

Press F5 or Script>Run to execute the script and create the object.

Execute the script to create the object

Thursday, 5 June 2014

Decompiling Python programs

The EditWad program [link] was written in Python 2.5 and packed into an *.exe file using py2exe [link].

Packing a Python program into an *.exe file means the end user doesn’t need to have Python installed on their PC to run the program.

Because Python programs are compiled to bytecode and not machine code it should be easier to decompile a Python program than a program that is compiled to machine code like a FreePascal progam or a C++ program.

Learning fragMOTION part 3

To view an animation in fragMOTION, click on the Animations tab, click on the animation name (in this case “Animation”) and then click the play button or click and drag the Frame slider.

Play animation

Rather than creating a new animation by posing the model at various frames (keyframing) , I’m am going to try an import one from a BioVision *.bvh file the same as I did with Mikoto [link].

If successful then maybe it’s possible to save the animation to MilkShape 3d *.ms3d and import it into a TRLE *.wad file with Daro Anim Maker or a *.TR4 file with Fexanim.

Sunday, 1 June 2014

Mikoto2x instructions

Mikoto2x [link] [link2] is a program to convert animations created in Mikoto to the Direct3D *.x text file format.

Mikoto is a program that can be used to animate models created in Metasequoia.

The model has to include special objects and object names for animation to be possible in Mikoto. See the tutorial here [link].

Mikoto2x requires the vertices of the character mesh to be assigned to the bones using the anchors method in Metasequoia.

Anchors are boxes that envelop all the vertices that are to be assigned to a bone.

Reading the translated “readme.txt” [link] it may required that the effector must be bdef: only and that the character mesh must be in a single object but I have not had time to clarify this.

I will just show how to use Mikoto2x at this time and update the post later with the requirements for the model.

Create a new folder somewhere on your PC and copy the following files from Mikoto2x’s sample folder to the new folder.
  • “kobito.mqo”
  • “kobito.m2x”
  • “df_00.bmp”
  • “df_01.bmp”
I will be using the freeware MetasequoiaLE R3.0.

It is yet to be confirmed whether Mikoto2x is compatible with *.mqo files saved from Metasequoia 4. Metasequoia 4 default *.mqo files are version 1.1 whereas Metasequoia 3 default *.mqo files are version 1.0.

Open “kobito.mqo” in Metasequoia.

Open model in Metasequoia

Saturday, 31 May 2014


The instructions for the Japanese programs I download often appear as gibberish (lots of question marks or other unusual symbols) when I open them in a text editor on my PC.

This happens because the text has been decoded using a different character encoding than was used to write the text.

The Japanese call this Mojibake.

Thursday, 29 May 2014

Learning fragMOTION part 2

I have found a simpler way to texture a model and to demonstrate I will use an *.ms3d file exported from Fexanim this time.

<Edit 17Sep14>

TurboPascal has updated Fexanim to include the material information in the *.ms3d file so the texture will now be assigned automatically when the *.ms3d is opened in fragMOTION.

TurboPascal also fixed the bugs that caused the UV map errors and the joining of the vertices in the upper leg meshes.


Open the model in fragMOTION and click the Texture pane tab.

Right click in the Texture pane and click New>Texture from the context menu.

Right click in texture pane and create a new texture

Tuesday, 27 May 2014

Learning fragMOTION part 1

fragMOTION is a 3D modelling and animating program. [link]

It is not freeware but you can use the fully featured trial indefinitely by obtaining a seven day license every seven days.

The seven day license is obtained by typing a version of the Christian Lord’s prayer into the program when prompted.

Note I had to use a compatibility mode for the program not to give me a “trial has expired” warning and making the program close to unusable even though I had typed in the prayer. I don’t know if I did something wrong or if the program has a problem with Windows 8.1.

(Since I installed it in Program Files I needed to run it as administrator to have the trial work properly.)

FragMotion screenshot

Metasequoia Script – integer vertex coordinates

The registered version of Metasequoia allows scripting in the Python language.

This article will demonstrate a script to move all vertices (also known as points) in an object to integer coordinates.

An integer is a whole number like 1, 2, 3, 40, 75 etc.

A trial license for Metasequoia 4 is easy to obtain and unlocks all features for a limited time including the Script Editor. [link]

Friday, 16 May 2014

Animating with Mikoto – part 6

We have rigged our model ready for animating in Mikoto.

I’m not very good at animating so how did I create the animation seen in part 1?

Mikoto can open *.bvh files which store motion capture data.

UPDATE: Mikoto cannot open *.bvh files which have values written in scientific format e.g. -8.759e-005.

In Mikoto’s Sample folder you will find dance01.bvh which is the file I used to animate Lara.

Click New in Mikoto to start a new project and then open dance01.bvh.

A new actor object named dance01.bvh is added to the project.
Each actor object is indicated in the tree with a cyan coloured cube icon.  icon_object

Select dance01.bvh by clicking on its name.

The hierarchy for a *.bvh file is displayed as circles containing small XYZ axes instead of bones.


Wednesday, 14 May 2014

Animating with Mikoto – part 5

For my character I will use the Lara Croft model from a Tomb Raider Level Editor (TRLE) *.wad file.

The post tells where to obtain TRLE or *.wad files if you don’t have them.

Open the *.wad file in version 1.4 of my EditWad program.

Information about EditWad can be found at
EditWad can also be downloaded from

EditWad has a console window and a GUI window. The console window only displays information.


All interaction is with the GUI window.

Click on the slider and drag it to the far right until the number on the top right blue button is “7”.


Click the blue button with the “7” on it to bring up the save dialog and save the *.mqo file.

Close EditWad as it is no longer needed.

Open the file you saved in Metasequoia.

Note that meshes are exported from EditWad at 1:1 scale and meshes in TRLE *.wad files are big.

You may need to change the Distance setting in Field of view by clicking View>Set View.


Tuesday, 13 May 2014

Animating with Mikoto – part 4

You can also connect triangles in Metasequoia root to root.


You will see this type of connection in many humanoid character models so that the lower half of the body can be rotated independently of the top half and vice versa.

The root-root connection is the end of the IK chain for both halves of the body and can be translated.

An example can be found in lowbody_sdef.mqo located in the Sample folder included with Mikoto.

This type of connection is only allowed once in the skeleton.

Animating with Mikoto – part 3

I will be using Metasequoia 3.1.6.

I am using this version because I prefer the user interface to that of the newer version.

If you are using the newer version you may need to save in Metasequoia Format version 1.0 for compatibility with Mikoto.

Now I have used Metasequoia 4 I see that there is no option to save as Format 1.0. What you can do is make sure you triangulate any N-Gons which are polygons made from 5 or more points and save the *.mqo.

Then either open the *.mqo in Metasequoia 3 and save or open the Metasequoia 4 *.mqo in a text editor and change the version in the header from 1.1 to 1.0.

If using Metasequoia 4.2 or newer make sure not to save with an embedded  thumbnail [link].

An easier way is just to save as version 2.2 *.mqo in Metasequoia 4 since Mikoto can open those files.

To animate with Mikoto you create a model in Metasequoia in one or more object layers and then create a skeleton in an object layer of its own.

The skeleton (also known as an armature) is made up of bones with each bone sized, positioned and angled to match parts of the model. Each bone can be rotated and some translated to create the animation.

Each part of the model is then assigned to a bone or bones so that when a bone is manipulated, the corresponding part of the model is manipulated as if it was connected to the bone.

Mikoto allows different ways to assign parts of a model to bones.
  • Use object names
  • Use boxes (known as anchors) around parts of the model
  • Use materials
  • Use the closest bone
  • Use the size of the bone
Using the closest bone is the simplest method and is the method used in this tutorial.

Saturday, 10 May 2014

Animating with Mikoto – part 2

There are four versions of Mikoto available on the internet.

From oldest to youngest they are 0.3g, 0.4c2, 0.4d and 0.4f.

  • Version 0.4c2 and 0.4f from (Click on the link/square next to "Mikoto" at the top of the page and click on the images)

Version 0.3g is the only one that can do Morphing (change mesh size and shape) but sometimes it is not possible to run this version on a modern PC.

I will use the English version of Mikoto 0.4f available for download in part 1.

I can't find any English tutorials for Mikoto so online translation is often necessary to learn how to use the program.

I found all the following webpages by searching for Mikoto+Metasequoia or Mikoto+Metaseko or Mikoto 0.4f in an internet search engine.

The following web page is the official manual written by the author for version 0.3g but is still probably the best introduction to Mikoto.

A lot of Mikoto tutorial sites recommend a pictorial tutorial by a user named UMEMORI*69 but the website has disappeared.

Fortunately most of the tutorial has been preserved at the webarchive. Translation though is not easy since the Japanese instructions are part of the images and not text but the diagrams can be easy to follow once you have aworking knowledge of Mikoto.

More Japanese sites with Mikoto tips are:

The following French sites also have guides for Mikoto.

Another good way to learn is to study the *.mqo and *.mks files some users have released to the public.

Downloads are available at the following sites.

Following hyperlinks on the Japanese sites can also lead to more downloads and tips.

prev | next

Tuesday, 6 May 2014

Animating with Mikoto – part 1

Mikoto is an abandoned Japanese program for animating models created in Metasequoia, a Japanese 3D modelling program.

Metasequoia files have the extension .mqo.

Some other programs that can be used for animating *.mqo models are:

For a translated version of this and other plugins and also some tips, go to the Sword of Moonlight forum.

I don’t have a registered version of Metasequoia so cannot use Keynote.

  • ToyStudio which is a Japanese animating program.
The program looks good but I cannot find a translated version to use.

So that leaves Mikoto.

I obtained an English translation of Mikoto from this thread but the hyperlink is now dead so you can download the translated version here, MIKOTO_EN.rar.

UPDATE:  The models from the thread at can be downloaded from these links.

The Japanese version can be downloaded here.

A French translation can be found in this forum [link].

In this series of articles I will explain how I created the following animation.



Writing a StrPix-like program with Lazarus – 11

We need to add some global variables to the implementation section to store details of the currently selected texture.

Monday, 5 May 2014

Writing a StrPix-like program with Lazarus – 10

When we use the mouse wheel with the mouse pointer over Image1 we don’t scroll through the pages.

What we need to do is link Image1’s MouseWheel event handler to ComboBox1’s Change event handler.

Writing a StrPix-like program with Lazarus – 9

IceBerg has done the hard work of converting the raw RGB image data of the *.wad file into the *.bmp format so all we need to do to display the image data is assign the *.bmp to a TImage control.

Sunday, 27 April 2014

Writing a StrPix-like program with Lazarus – 8

Rather than have the moveables’ object ID numbers displayed we will display their names.

We will store their names in a text file with each name on a separate line and where the line number matches the object ID if we consider the first line as line 0.

We could hard code the names into the program but reading them from a file means that new names can be added for new objects and the names changed if needed.

Saturday, 26 April 2014

Writing a StrPix-like program with Lazarus – 7

We will delete Edit1 we placed on the form in the previous post since it was only to test that we could access data from the Wad.version and not part of our program’s design.

Go to Window>Form1 to display the form.

Click on Edit1 to select it and then press the delete key to delete it.

Deleting the control does not remove the code that references it in TForm1.FileOpenAcccept so go to that procedure and delete the two lines we added to display the version number in Edit1.

Friday, 25 April 2014

Writing a StrPix-like program with Lazarus – 6

Our program copies the *.wad file into memory and then reads the file in memory and extracts the data into a variable named Wad which is declared in the TombRaiderWAD unit.

Since the implementation section of unit1 includes TombRaiderWAD in the uses clause, the variable Wad can be used in any of the functions or procedures in unit1’s implementation section.

The variable Wad is declared as type TWAD and we can inspect this type in the TombRaiderWAD unit to see what information is available in the Wad variable.

Create or edit tut1.raw with GIMP

The file tut1.raw and other *.raw files that have the same name as the wad files contain the sky texture for a level.

Like uklogo.raw which contains the game’s logo, these can be created or edited in GIMP.

Editing uklogo.raw is discussed in another post so I will only discuss the settings that need to change for the raw sky images.

In GIMP go to File>Open and navigate to the raw sky image.

Before clicking the Open button in the Open File dialog, expand the Select File Type dropdown and select Raw image data.

Do not mistakenly select raw image which is for raw images from digital cameras.

Writing a StrPix-like program with Lazarus – 5

To add IceBerg’s code for reading a *.wad file to our program, with our project open in Lazarus, go to the File menu and select Open.

In the Open File dialog, navigate to the WadExplorer source code folder (WADE11sources) we copied to our Lazarus projects folder.

Select and open TombRaiderWad.pas which contains all the code necessary to read a *.wad file.


Monday, 21 April 2014

Writing a StrPix-like program with Lazarus – 4

Make sure the the form designer window is visible. If it is not you can use the Window menu and select the form window, “Form1” in our case, or you can press the Toggle Form/Unit button to switch to the form window. This button is only enabled if the unit displayed in the source editor has a form.


Writing a StrPix-like program with Lazarus – 3

Create a folder somewhere on your PC for your Lazarus projects. I named my folder Typhon32 Projects.

Extract the WadExplorer source code zip file and copy the folder into your Lazarus projects folder.

Do the same with the other source code zip files you downloaded. With the StrPix code you need to also unzip the shared folder inside the StrPix folder.


Sunday, 20 April 2014

Writing a StrPix-like program with Lazarus – 2

To write a program to modify a *.wad we need some *.wad files. If you don’t have TRLE installed you can get it from any of the links below. The *.wad files are found in the graphics folder. TRLE was also included on a separate disc with Tomb Raider Chronicles (TR5) for PC.

If you don’t want to install TRLE you can download some *.wad files at this link.

Writing a StrPix-like program with Lazarus – 1

StrPix is a program used in the TRLE (Tomb Raider Level Editor) community.

tombraiderforums Level Editor forum 

The program is used to import models into a TRLE *.wad file and to also texture and add other attributes to the models like shine and collision.

 A *.wad file stores the geometry, texture and animation data for the objects in a TRLE game.

StrPix was written in the Delphi language by TurboPascal.

TurboPascal released the source code but since the latest Delphi IDE (integrated development environment) is expensive and any cheap older versions or free versions are difficult to buy or find, it is probably necessary to write a new program from scratch to add new features or fix bugs or update it for new operating systems.

Lazarus is a free, open source IDE for the FreePascal language and FreePascal is based on Delphi.

Lazarus can open and convert simple Delphi projects to its own format but I have been unable to successfully convert any of the TRLE Delphi programs by TurboPascal (StrPix) or IceBerg (WadExplorer) or RaiderCroft (PixStr).

No matter, we can still copy most of the code.

This series of posts will hopefully also show how simple it is to start programming with Lazarus and serve as a Lazarus tutorial for beginners.


Friday, 18 April 2014

TRLE File Formats cutseq.pak

Program: Official tomb4.exe
Description: Contains animation data for cutscenes
Document Version: 1.0

TRLE File Formats *.trw

Program: WadMerger
Description: Animation Editor custom import/export format for animations
Document Version: 0.1

Wednesday, 16 April 2014

FreePascal programming notes #3

If you place a TImage inside a scrollbox, using the mousewheel does not scroll the TImage when the mouse is over the TImage.

If the mouse is inside the scrollbox but not over the TImage the TImage scrolls as expected with the mousewheel.

Note this may only be a problem on Windows.

Here is my workaround.

Create a handler for the scrollbox’s MouseWheelEvent with the following code.

procedure TForm1.ScrollBox1MouseWheel(Sender: TObject; Shift: TShiftState;
  WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
  inc : integer;
  inc := 16; // choose a value for the increment you desire
  if WheelDelta > 0 then inc := -16;
  ScrollBox1.VertScrollBar.Position := ScrollBox1.VertScrollBar.Position + inc;
Set this procedure as the image’s MouseWheelEvent handler also.

Now the image should scroll the same when the mouse is over the image or over the scrollbox.

Note that right clicking on the scrollbox’s scrollbar will popup a menu with some options but this will not be the case for the image.  

Sunday, 23 March 2014

TRLE File Formats: *.wad

Program: TRLE standard wad file used by WadMerger, EditWad, StrPix, TRWad Reorganizer
Description: Contains object geometry, texture and skeletal animation data
Document version: n/a

IceBerg’s documentation is the best.

Download from the archive of his site

Click on Tools, then Programmer’s corner.
Download by clicking on the white dot.

While there, also download his WadExplorer program which displays all the *.wad information.

IceBerg's website screenshot

Sunday, 16 March 2014

WIP: Sound Manager Clone


A program to edit the *.SFX and *.SAM files directly like Wadmerger’s sound manager.
Stalled development until BASS audio library is understood.

Update 22Aug16: Version 1.2 released. Only cosmetic change from V1.1

Run as adminstrator if modifying files in Program Files or other paths controlled by Windows' UAC.

WIP: TRLE Sound Editor

Version: 1.1

Status: Released

TRLE Sound Editor 1.1 screenshot

Wednesday, 12 March 2014

TRLE File Formats: *.swd

Program: n/a TRLE wad file
Description: Contains sprite images
Document version 0.2

Sunday, 9 March 2014

TRLE File Formats: *.trwad

Program: Wadmerger
Description: Custom import/export format for moveables
Document version: 0.2

Wednesday, 5 March 2014

Create or edit uklogo.raw with GIMP

You can use the freeware image editing program GIMP to create or edit uklogo.raw for your custom Tomb Raider Level Editor (TRLE) game. Uklogo.raw is the graphic that appears above the menu when the game starts and is usually the game’s title.

Introduction to File Formats

A computer file can be considered as a sequence of zeroes and ones. Each one or zero is known as a bit. Representing a file in ones and zeroes is known as binary format.


It is convenient to organise the bits into groups of eight. Each group of eight bits is known as a byte. This file is eight bytes long.

10000001 00000000 00000000 00000000 00010111 00000110 00000000 00000000

Saturday, 1 March 2014

FreePascal programming notes #2

Before reading or writing to a TMemoryStream know what its position is.
Do not assume that methods like LoadFromStream will set position to the start of the stream before reading from the stream.

FreePascal programming notes #1

Missing information for TStream.CopyFrom method highlighted below.
Copy data from one stream to another
DeclarationSource position: line 806
public function TStream.CopyFrom(Source:TStream; Count:Int64):Int64;
DescriptionCopyFrom reads Count bytes from Source and writes them to the current stream. This updates the current position in the stream. After the action is completed, the number of bytes copied is returned.
This can be used to quickly copy data from one stream to another or to copy the whole contents of the stream.
Count = 0 will set Source.position to 0 and copy the whole stream.