Textures - Animating advanced

Note: This tutorial applies only to the new game engine which has opened up a whole new world of possibilities for using animating textures in levels. The setting up of animation ranges is also far easier than ever before.

P - Frames

This allows you to change the texturing of a room without using flipmaps for example you could change the ground cover from grass to snow by using a flipeffect.

To do this you assign an animating range consisting of 2 or more textures with the Anim - Type set to P - Frame. By applying the trigger shown below the texture referenced by the [E]xtr parameter is replaced by the texture referenced by the timer parameter. Two separate P - Frame ranges can be used with this type of trigger.


Note: During testing I have used the normal water textures supplied with the standard tga sets.

I do not advise using values above about 4 and 6 for 64 x 64 & 128 x 128 textures respectively as the desired effect is lost at higher scrolling speeds.

Information provided by Paolone

This animation mixes UV-scroll full rotate with normal frame animation. It is used to simulate the flowing water of a river. In reality water runs (Uv-range) but there is also light reflecting on the surface (frame animation).

To set this in the Animation range window of the NGLE, you have to set in the top combo list a low value for UvRotate such as 1 or 2 for 64x64 textures or a value of 2 or 3 for 128x128 textures.

In the bottom combo box you should set a value of MAX_FPS or a bit lower such as 28 fps. The bottom combo box will set the speed of the frame animation (like normal water) while the top combo box sets the speed of scrolling (UvRange).

It's advisable to set only a few water textures for the river range to allow for other textures for normal water.

The River-rotate range is placed in the level like the normal water textures - double sided and transparent on a portal between stacked rooms. When you place these river textures it's important to rotate all textures the same way to keep the same direction of the UvRotate animation. This direction should follow the flow of the river, of course.

If in game you don't see the flowing of water particularly well, it can be useful to reduce the frame speed, setting in the bottom combo box a lower value of MAX_FPS, for example use values of 28 fps or 20 fps.

Paolone has advised that the river animation range requires that a couple of any texture from the river range is placed in opaque mode in a hidden part of the level. I have tested with and without placing these opaque textures and have noticed no difference in the effect obtained.

Texture Sequences

These allow one texture to be replaced by another in a sequence defined by the level builder and can be started & stopped repeatedly using flipeffect triggers. A highly talented builder could achieve the effect of players seeing Lara on some sort of screen moving her lips as she appears to talk to them.

Only textures in specific locations on the tga map can be used these are listed below and are counted across  from the top left corner of the tga map starting at 1.

Textures 5 - 12 and 21 - 24.  Textures in any other location of the map will not currently work, this problem may be solved in the future in which case this tutorial will be updated to reflect the changes.

A lot of valuable information concerning the required script command and it's various parameters is contained in the script documentation for TRNG provided by Paolone, the appropriate section of which is reproduced at the end of this tutorial. I will just give examples of setting up various texture sequences.

Example 1 A single sequence and range

In the Animation Ranges window select the desired textures up to a maximum of 16, from the Anim - Type dropdown box select P -Frames and click the Assign and ok buttons.

Set a trigger for the effect in the required place and set the trigger parameters as shown below.

Note: The animation range parameter set in the trigger box must be the number of the range which you have just set. If for example you had previously assigned one texture range for any purpose, you would select the 2nd Animation Range from the [E]xtra: dropdown box.

A second trigger which will stop the effect can also be set as shown here.

Finally to complete the setup process the TextureSequence= command must be added to the level section of the script an example is shown here.

TextureSequence= 1, 1, SEQ_LOOP,3, 2, 1, 0

This would run a sequence of four textures in the order 3,2,1,0, at a rate of one per second in a continuous loop until stopped with a flipeffect.

The various parameters which can be used are fully explained at the end of the tutorial.

Example 2 A pair of sequences and ranges

This is setup as the previous example until we get to setting the triggers and the entries in the script file. In this example I have set an animating range for normal water textures before setting the second texture sequence range, as a result I have selected the 3rd Animation Range in the [E]xtra: dropdown box of the trigger window.

The script will require an entry for each range as shown here, the second  entry refers to the second sequence range numbered 3 as explained above. I have also chosen 2 frames per second as the speed and the textures will loop in reverse order because of the SEQ_LOOP_INVERSE

TextureSequence= 1, 1, SEQ_LOOP,3, 2, 1, 0
TextureSequence= 3, 2, SEQ_LOOP_INVERSE,3, 2, 1, 0

Example 3 Multiple sequences within a single range

It's possible to have several texture sequences in a single animation range for this example I'll use a single range of 8 textures split into 2 sequences, this is the texture set used for the tutorial so you can better understand what happens.

Assume that the texture 'A' is applied to a wall to begin with and we want the lettered textures to form one sequence and the numbered textures to form the other sequence. We would set this trigger for the 1st sequence.

And this trigger for the 2nd sequence.

And make these entries in the script.

TextureSequence= 1, 1, SEQ_LOOP,0, 1, 2, 3
TextureSequence= 2, 1, SEQ_LOOP,4, 5, 6, 7

The numbers 0 - 7  refer to the position of each texture within the range. When the first trigger is activated the letter 'A' will be replaced by the letters B,C,D in sequence. Once the second trigger is activated the sequence will become this.  A,1,B,2,C,3,D,4

Activating the 2 triggers in the reverse order would result in the sequences  1,2,3,4 and  1,A,2,B,3,C,4,D

Either or both sequences stopped by using a flipeffect as shown in example 1, and can also be repeatedly stopped & started.


Syntax: TextureSequence=IdTexSeq, FramePerSec, SEQ_ flags, Tex Indices array {...}
Scope: to use in [Level] section

IdTexSeq field
Progressive number to identify this texture sequence when you enable it using the flipeffect trigger. You'll use "1" for first TextureSequence command, the value "2" for second TextureSequence command, etc.

FramePerSec field
In this field you set the speed of the sequence. The value is in frames per second. The max value is 30, i.e. 30 frames per second, the smallest value is 1.

SEQ_ flags field
You can set two or more SEQ_ flags, you will find the list in the reference panel of NG Center program.

Currently there are the following flags:

The sequence will be performed indefinitely. If you use this flag you'll have to use specific a flipeffect to stop the sequence, otherwise it will be performed continuously.

This flag works only if you have set the SEQ_LOOP flag. While the single SEQ_LOOP flag sets an infinite loop with this sequence (supposing we use 4 textures from 0 to 3): the sequence will appear like this.

0 1 2 3 0 1 2 3 0 1 2 3 ....

When you set also the SEQ_LOOP_INVERSE flag, the sequence will become:

0 1 2 3 2 1 0 1 2 3 2 1 0 ...

If you set this flag you force the engine to always reset to the first texture of the range when the animation is sequence is completed. Differently, if you omit this flag the last texture shown depends on the  type of animation sequence set.

If you have set no loop, the last texture shown will be the texture of the last index of the array sequence. If you have set a loop, the texture shown will depend on the exact moment when you perform the Stop texture sequence flipeffect.

Tex Indices array {...} fields
The tex indices array may host up to 100 different indices. You'll separate the value with commas ',' in normal way. Each index will describe the index position for each texture within the specific animation range.

For example if you set four textures in the tga map, with each texture show a literal "A" on the first and then "B", "C" and "D". When you want show a frame with "A" texture you'll type 0 (zero), when you want the "B" you type 1, etc.

For example if your TextureSequence command is:

TextureSequence= 1, 4, IGNORE,
3, 2, 1, 0

You'll have a sequence with ID = 1 (this is the number to set in flipeffect trigger to start/stop this sequence).

The animation will be slow, because you have set 4 fps, so the image will change only four times per second.

Will not loop, because you have set IGNORE for SEQ_ flags

While the sequence shown in game will be with following images:

D  (3)
C  (2)
B  (1)
A  (0)


~ The ranges you can animate with the TextureSequence command have to be set like "P-Frames" in NGLE.

~ The max number of textures you can animate with TextureSequence is 16. This mean you can only enter numbers in the range of 0 - 15 in the Indices Array fields.

~ You can animate the same P-Frame range with different TextureSequence commands.

The number of P-Frame to animate will need to be set in the flipeffect trigger.