#1 07-11-2007 22:07

Aschratt
From: Chemnitz
Registered: 07-11-2007
Posts: 8
Website

Cutscenes

Hey there!

Finnaly I thought it is better to post this here where I hope I can find some scripters who are able to help me ^^. However I know that some great coders are here.
A few days I started to try to understand how Cutscenes work. However I reached a point where I think it will be possible to create cutscenes using a MaxScript. My target is to create such a MaxScript.

However I already talked to steve-m about this. He told me that in GTA III there were 3 lanes for the cameras, but I will come to this later.

(P.S.: I will create an post in the modding wiki when it is working correctly again)

But enought words, now I wan't to show you my findings:

General Stuff:

Cutscenes are located in the "~SA\anim\cuts.img" archive.
Each cutscene consits of 3 files: the "cutscene-data".
These files got the same name but diffrent endings:

- *.cut
- *.dat
- *.ifp

The CUT-File contains information about models, characters and placement of the cutscene. It is loaded as the first file of the cutscene-data through SCM. It is an standart TEXT-File split up into certain sections.
The DAT-File contains information about the camera lanes relative towards the offset (defined in the cutfile). It is loaded second.
The IFP-File is normally an Version 1 (ANPK, not like SA Standart ANP3... dunno if ANP3 will work!) Animation Package. However it contains the data of R*'s motion capturing and thats the reason why the animations are as big!

The CUT-File:

Section #1: INFO

info
offset X Y Z
end

This defines the point where the cutscene is "placed". Relative towards this point the rest of the cutscene is playing.

Example: (prolog1.cut)

info
offset -1833.640015 18.857000 1060.170044
end

Section #2: MODEL

model
?, DFF-File, TXD-Entry
end

The Unknown value seems to be allways 1. I don't think that this is a number of files loaded, cause first this wont make sense and second there are some models loaded twice or more times, but they also got one line per model.
The DFF-File defines the name of the model-file. the TXD-Entry seems to be an ID to an Texture of an TXD File or a whole TXD Directory. However there are sometimes only the names of TXD's and sometimes there is an number added.

Example: (prolog1.cut)

model
1, cssuitcase, cssuitcase-1
1, cssuitcase, cssuitcase-2
1, csplay, csplay
1, csstew, csstew
1, cstaxi92, cstaxi92
1, csbogman, csbogman
end

Section #3: EXTRACOL

extracol
?
end

This contains an Integer-value which is somehow related towards the collisionfiles. However it seems to be a counter of something.

Example: (prolog1.cut)

extracol
3
end

Section #4: TEXT

text
StartTime, Length, GXT-Entry
end

The StartTime is an Integer-value which defines the time relative to the cutscene start in milliseconds, when the text is displayed. The Length defines how long the GXT-Entry is displayed (in the same way). The GXT-Entry is a string which gives the standart-expression of an text in the gxt-files.

Example: (prolog1.cut)

1596,4066,PRO@01
7215,1397,MOBRING
8739,476,PRO@02
9499,811,PRO@03
10644,1389,PRO@04
12439,2718,PRO@05
end

Section #5: UNCOMPRESS

uncompress
Texture
end

The Texture-String defines a texture like in the model-section. These textures are DX-compressed textures which need to be uncompressed to be used by the game.

Example: (prolog1.cut)

uncompress
cssuitcase-1
cssuitcase-2
csplay
cstaxi92
csbogman
end

Section #5: MOTION

motion
range on X Y
quick off
Model:AnimationObject(Tag),Animation
end

I don't realy know what the range is and if it is the stuff which is disabled by using quick off.
However the rest of the data is related to the IFP-AnimationPackage.

The Model is the model which is loaded. I think the IFP-Animation defines where it is placed relative to the offset. But I can't imagnine, cause I think the coords there are relative towards the pivot of the model. AnimationObject is an Index to an object in the IFP File. (Each animationtree is stored in certain "objects".) I don't realy understand what the tag means. First I have to understand how IFPs are correctly working^^. the Animation is an ID to the Object-Entry. Means it is the number of the animation in the "object".

Example: (prolog1.cut)

motion
range on 540.000000 1210.000000
quick off
cssuitcase:Root(tag0),6
cssuitcase 1:Root(tag0),6
csplay_x:root,5
csstew:Root,1
cstaxi92:taxi,4
csbogman_x:root,5
end

The DAT-File:

The DAT-File contains data about the camera. It is splittet into 4 Blocks:

- Block1: Rotation relative towards some kind of vector
- Block2: Zoom
- Block3: CameraPositions
- Block5: CameraTargetPoints

Let's take a shot look to the prolog1.dat

4.733000f,51.774010,51.774010,51.774010,
4.733000f,51.774010,51.774010,51.774010,
6.865999f,51.774010,51.774010,51.774010,
6.865999f,51.774010,51.774010,51.774010,
13.018999f,51.774010,51.774010,51.774010,
14.145000f,51.774010,51.774010,51.774010,
15.029999f,51.774010,51.774010,51.774010,
15.033001f,51.774010,51.774010,51.774010,
18.632999f,51.774010,51.774010,51.774010,
18.632999f,51.774010,51.774010,51.774010,
22.299999f,51.774010,51.774010,51.774010,
22.333332f,51.774010,51.774010,51.774010,
;
14,
0.000000f,0.000000,0.000000,0.000000,
0.033001f,0.000000,0.000000,0.000000,
4.733000f,0.000000,0.000000,0.000000,
4.733000f,-0.500000,-0.500000,-0.500000,
6.865999f,-0.500000,-0.500000,-0.500000,
6.865999f,0.000000,0.000000,0.000000,
13.018999f,0.000000,0.000000,0.000000,
14.145000f,0.000000,0.000000,0.000000,
15.029999f,0.000000,0.000000,0.000000,
15.033001f,0.000000,0.000000,0.000000,
18.632999f,0.000000,0.000000,0.000000,
18.632999f,0.000000,0.000000,0.000000,
22.299999f,0.000000,0.000000,0.000000,
22.333332f,0.000000,0.000000,0.000000,
;
14,
0.000000f,1.372110,-3.289650,0.348241,1.372110,-3.289650,0.348241,1.372110,-3.289650,0.348241,
0.033001f,1.374477,-3.285426,0.348313,1.373696,-3.286820,0.348289,1.485693,-3.086910,0.351664,
4.733000f,1.708157,-2.689816,0.358369,1.596942,-2.888333,0.355017,-351435712.000000,996336576.000000,195180544.000000,
4.753000f,0.566675,0.546339,0.992326,351435712.000000,-996336576.000000,-195180544.000000,0.566675,0.546339,0.992326,
6.865999f,0.566675,0.546339,0.992326,0.566675,0.546339,0.992326,0.566675,0.546339,0.992326,
6.885999f,-25.128313,43.978294,-5.243558,-25.128313,43.978294,-5.243558,-25.128313,43.978294,-5.243558,
13.018999f,-25.199257,45.274353,-5.229860,-25.199257,45.274353,-5.229860,-25.199257,45.274353,-5.229860,
14.145000f,-24.704872,45.288445,-5.390404,-24.845209,45.314960,-5.336510,-24.594572,45.267601,-5.432763,
15.029999f,-24.431650,45.152348,-5.518365,-24.522743,45.197723,-5.475703,-25.216389,43.404213,-5.411711,
15.033001f,-26.693468,40.113770,-5.210960,-25.908730,41.861904,-5.317614,-25.883440,40.723061,-5.395410,
18.632999f,-24.263140,41.941826,-5.764365,-25.073168,41.332535,-5.579916,-219697904.000000,-8866951168.000000,843817920.000000,
18.653000f,-27.117434,-73.256783,5.198439,219697840.000000,8866951168.000000,-843817920.000000,-27.893589,-73.229073,5.073773,
22.299999f,-29.458689,-73.173187,4.822388,-29.458689,-73.173187,4.822388,-29.458689,-73.173187,4.822388,
22.333332f,-29.458689,-73.173187,4.822388,-29.458689,-73.173187,4.822388,-29.458689,-73.173187,4.822388,
;
14,
0.000000f,0.355181,0.377279,0.985035,0.355181,0.377279,0.985035,0.355181,0.377279,0.985035,
0.033001f,0.354870,0.377269,0.984592,0.354973,0.377272,0.984738,0.340251,0.376828,0.963785,
4.733000f,0.311009,0.375946,0.922165,0.325628,0.376387,0.942972,81028968.000000,216780560.000000,15418848.000000,
4.753000f,0.574195,1.080061,0.972246,-81028968.000000,-216780560.000000,-15418846.000000,0.574195,1.080061,0.972246,
6.865999f,0.574195,1.080061,0.972246,0.574195,1.080061,0.972246,0.574195,1.080061,0.972246,
6.885999f,-24.415503,44.468201,-5.129688,-24.415503,44.468201,-5.129688,-24.415503,44.468201,-5.129688,
13.018999f,-24.437296,43.236435,-4.954520,-24.437296,43.236435,-4.954520,-24.437296,43.236435,-4.954520,
15.029999f,-25.544277,43.336678,-5.065734,-25.298626,43.249981,-4.968792,-25.884001,42.968060,-5.010449,
15.033001f,-26.523449,42.274227,-4.906388,-26.183725,42.642845,-4.961673,-26.846678,42.200039,-4.777145,
16.033001f,-27.493233,42.051640,-4.518620,-27.170004,42.125828,-4.647863,-27.493233,42.051640,-4.321027,
18.632999f,-26.844765,40.319283,-5.154108,-26.844765,40.319283,-5.154108,-26.844765,40.319283,-5.154108,
18.653000f,-26.181892,-71.569000,-0.250942,-26.178116,8634788864.000000,-0.250942,-26.870512,-71.541290,-0.250942,
22.299999f,-28.522501,-71.485405,-0.626076,-28.522501,-71.485405,-0.626076,-28.522501,-71.485405,-0.626076,
22.333332f,-28.522501,-71.485405,-0.626076,-28.522501,-71.485405,-0.626076,-28.522501,-71.485405,-0.626076,
;
;

Let's start in general: Each Block's end is marked by an semicolon. The eof (end of file) is marked by an additional semicolon. The first number in each Block is the number of entries in it.

Block 1 and 2 are in same structure. Now I have to tell you about those lanes. We actually don't realy know why there are 3 lanes, but they exist. However only the first lane (LANE1) is used. Easily you can set all three lanes to the same.
So you can in general see the structure for each Block like this:

1
TIME, LANE1, LANE2, LANE3
;

The TIME is stored as single values (float) in seconds.

Block #1: Rotation

The value for each lane contains a rotation as a floating value. It is somehow related to the vector from the camera position to the target.

Block #2: Zoom

This contains information about the zoom. However this is calculated like in optical phyiscs. So negative values are zoom in and positve zoom out.

Block #3: CameraPosition

Thix contains standart floationg point values about the position of the camera relative towards the offset from the cut-file.

Block #4: CameraTargetPosition


Thix contains standart floationg point values about the position of the camera's target point relative towards the offset from the cut-file.

----------

Thanks for your free minutes! However there is still some work left. I tried around with IFPs but somehow the object names are too strange for C# :D (I can't realy read them out).
Would be cool if someone would help me and try to find senses for the unknown parts. However I also haven't realy got time to test this stuff. so if you can try a little bit around with this and report your findings please tell me!

I am sure this will be usefull for scripters. If not: It is for me :D

Greetings and Сбозиво (Is this written correctly? xDDD)... Aschratt!

Last edited by Aschratt (07-11-2007 22:12)


gwmsignatureapvnw.jpg

Offline

#2 08-11-2007 09:22

Seemann
Registered: 07-08-2006
Posts: 2,050

Re: Cutscenes

Hi, Aschratt! Nice stuff, thanks for sharing this.

We already tried to understand how the cutscenes work here, and the format of .cut-files here (in Russian though).

You’ve described it almost completely. I just add/correct something:

Section #1: INFO

Only one parameter could be inside, which is offset. It’s a global position of cutscene. This can be overwritten by opcode 0244.

Section #2: MODEL

The Unknown value seems to be allways 1.

Yeah, this one is always 1, but it’s unused anyway (the game just skips it), so it doesn’t matter what it need for. Also, the limit for objects/textures being in use at same time by cutscene is 50.

Section #3: EXTRACOL

This contains an Integer-value which is somehow related towards the collisionfiles. However it seems to be a counter of something.

No, it can be interpreted as ‘EXTRACOLOUR’. This value has same meaning as, say, opcode 04F9. It looks like this section is only used in the interior-within cutscenes.

Section #5: MOTION

This section is ignored anyway, does not matter what it means.

Also, there are some sections that are not used by R*, but supported by the engine, and a few you have not mentioned. These are:

Section PEFFECT
Or Particle effect

Example (ryder2a.cut):

peffect
cigarette_smoke,0,-1,1,3,0.0,0.0,0.0,0.0,0.0,-1.0
end

Starts the particles effect at specified time.

Parameters: effect name, start time in ms, end time in ms, unknown_number, bone, X,Y,Z, unknown_float1, unknown_float2, unknown_float3.

*bone – a body part the particle effect or object is attached to.

Section: REMOVE

Example (sweet2a.cut):

remove
2523.695,-1678.6,14.492,Gen_doorEXT03
end

Removes a static object?

Parameters: XYZ coord, object name


Section: ATTACH

Never used in the original files. Maybe need to attach an object as in opcodes 069B or 069A?

Parameters: number, number, number


Also, there’s an ANPK-file viewer made by me: http://sannybuilder.com/dev/ifptool.rar
Nothing serious, just shows how much animations are inside. This is for the IFPs in the cuts.img.

Сбозиво (Is this written correctly? xDDD)

Actually it should be written as Спасибо.

Спасибо = Thanks
До свидания = Good bye
Пока = Bye
Привет = Hi
Немецкое пиво - лучшее в мире = The German beer is the best beer in the world! grin grin


Hope this helps! smile

Offline

#3 08-11-2007 18:32

Aschratt
From: Chemnitz
Registered: 07-11-2007
Posts: 8
Website

Re: Cutscenes

Well... Your tool helped me... however I haven`t found something about IFPs (I based my reader on KAM's IFP Dump MS). But now I don't need it any more...

Well if I take a look to UNCOMPRESS it seems to parse the animations instead of uncompressing the textures.

REMOVE realy seems to remove static objects. I searched for your example. Exactly at the same coords the same object (It's the door of sweet's home) is mapped. I don't know if the coords must be exactly the same, but I think so. Maybe there is an flag or something like this in the object pool. Doesn't matter, but I think the game first looks what is mapped there and then checks if the name is the same.

PEFFECT stands for ParticleEffect. However I already tried a little bit around with 2dfx. The particle section only uses 24 characters for the particle name. maybe those unknown values are somehow related to the effects.fxp file.

The attach section sounds cool. I don't realy know how to check out where and how such things are working. Do you know which type the numbers have to be?

And do you know how the animations and models are placed? I haven't found anything in SCM yet!

----------

OT: I had russian for 4 years but I never realy understood it grin. Only have been to belarus time... Was just the greatest time of my life... even if I haven't understood much!
And you are right... Our beer is realy great. Maybe the only good thing on germany tongue

Last edited by Aschratt (08-11-2007 18:53)


gwmsignatureapvnw.jpg

Offline

#4 09-11-2007 13:53

Seemann
Registered: 07-08-2006
Posts: 2,050

Re: Cutscenes

The attach section sounds cool. I don't realy know how to check out where and how such things are working. Do you know which type the numbers have to be?

Not sure 100%, but it seems that the first number is the model to attach, the second number is the model we attach to. The numbers are the indexes of model entries in the MODEL section. The last number is unknown to me, it's an ID of model structure hierarchy part (where to attach?).

model
1, cssuitcase, cssuitcase-1
1, cssuitcase, cssuitcase-2
1, csplay, csplay
1, csstew, csstew
1, cstaxi92, cstaxi92
1, csbogman, csbogman
end

attach
0,1,0
end

Attaches cssuitcase #1 to cssuitcase #2?


Need to test though.

Tested, nothing changed. If write

(attach objects to each other)

attach
0,1,0
1,0,0
end

they both disapper, however the cutscene continues.


And do you know how the animations and models are placed? I haven't found anything in SCM yet!

SCM only loads/unloads/starts the cutscene. There's nothing about coords or whatever. I think they all are stored somehow in the IFP file of the cutscene (ANPK).

Do you know the format of these IFPs?

Last edited by Seemann (09-11-2007 16:58)

Offline

#5 09-11-2007 19:49

Aschratt
From: Chemnitz
Registered: 07-11-2007
Posts: 8
Website

Re: Cutscenes

Well actually I haven't realy fund out much about those IFPs...

However the frames itself seem to be bone-related...
Steve once told me that there was an TXT about the structure of the IFP files... however I wasn't able to elicit him the charanimviewer source or this txt grin

mmhh... maybe attach just attaches 2 animations? Maybe 2 numbers are to attach IFP entries to a 3rd number (ID). But I am not sure... have to research some stuff!

I think we still got some decoding work left...
Can you send the IFP viewer's source? (Or only the LoadFile-Function as a textfile, cause I am too lazy to install Delphi ^^).

Somehow my tool only reads the first object correctly... dunno whats wrong but I think it is somehow related to ReadString() (Used in KAMs!).
I have to spend some time with this... maybe I will find a few minutes at the weekend...


If you got some time left for me then please send me! I would pay for grin


gwmsignatureapvnw.jpg

Offline

#6 10-11-2007 13:21

Seemann
Registered: 07-08-2006
Posts: 2,050

Re: Cutscenes

Can you send the IFP viewer's source? (Or only the LoadFile-Function as a textfile, cause I am too lazy to install Delphi ^^).

OK, I posted the source part that reads the IFP here:
http://pastebin.ca/768217

Offline

#7 10-11-2007 13:38

Aschratt
From: Chemnitz
Registered: 07-11-2007
Posts: 8
Website

Re: Cutscenes

Great! I will have a look at this. smile
Maybe I can find something... Even if I still belive that the actors and objects are not defined in the IFPs!

Greetz!


gwmsignatureapvnw.jpg

Offline

#8 15-11-2007 19:20

Aschratt
From: Chemnitz
Registered: 07-11-2007
Posts: 8
Website

Re: Cutscenes

Well I found out some new things.

Everything is spawned through IFP. The IFP is related to the offset. So if you want to create an Cutscene you have to do this relative to the point (0|0|0). The time when animations are loaded is very simple handled. That's btw also the reason why those IFPs are as large! So let's try to understand what a cutscene does after it is loaded through SCM:

1st step: Loading the *.cut file. Setting the offset and loading the models. The model-section loads the model (normaly placed in models\cutscene.img) and attaches them to the IFP-Entry. Then it stores the text section to temporaray. The uncompress section uncompresses the used animations. However if it is required it also loads the rest of the sections.

2nd step: after the *.cut-file has been loaded the game parses the camerainformation from the *.dat file

3rd step: The game parses the animation and binds the animation entry to the models. Now the models are moved. Their startposition is defined as the first frame of the animation! Each animation runs from the beginning. that means unused animations got many identical frames. That means if an animation is required later as the beginning the frames until the animation entry point are the same as the first frame.
Well... You can export those IFP's with KAM's IFP IO (Still haven't yet testet ANP3. I think they must be exportet as ANPK).

If the cutscene finished the game sets 02E9 to true.
In fact all Cutscene DFFs are skinned. I haven't yet rigged an PED or tried such jokes, so I can't realy tell you more about this ^^.
However I don't think that cutscene models are defined in IDEs (although I haven't yet found any IDE Entries). I think the TXD needs to have the same name as the dff. I haven't found any coll yet. I don't think that it is required cause cutscenemodels are only used once and only in parts where you can't move through models.

I will now try to code an MaxScript for that. (Maybe I can use KAM's IFP IO as base... got to ask him. But I think I will create a new one!)

Greetings... Aschratt!


gwmsignatureapvnw.jpg

Offline

Board footer

Powered by FluxBB