|
 |
|
|
|
|
|
GTA Modification Forums
[Q/P] ifp file format Are there any docs?
 |
|
 |
| |
REspawn  |
|
REgent

Group: Members
Joined: Jul 6, 2002



|
yea, Hollower wrote up a txt doc before that I have reposted below, its old so dont know how much of it is true for SA. | CODE | ================================================================= IFP file format for Grand Theft Auto III and Vice City animation Written by Hollower (hollower@hotmail.com) ================================================================= (updated Jan 2004)
This file is intended for programmers only.
First column is the number of bytes. V means that the length varies. Second column is the suggested data type (C/C++). Third column is a brief description of the data. Strings are padded to 4-byte alignment.
This is how I broke up the file for reading in. The section markers indicate the more "correct" way, but I used this simpler grouping (ie. why worry about the parent section of "INFO" blocks when they should always be in this order anyway), and I used the section markers for error checking. Using my grouping also makes it easier to output an IFP file that is valid for GTA3/GTA:VC. This may change in future GTA games.
IFP FILE HEADER ---------------- 4 (char[4]) "ANPK" --- section marker 4 (int) Offset to end of file 4 (char[4]) "INFO" --- section marker 4 (int) Offset to end of header 4 (int) Number of anims V (char[V]) Internal file name (null terminated string)
ANIMATION INFO ---------------- 4 (char[4]) "NAME" --- section marker 4 (int) Length of anim name string V (char[V]) Anim name (null terminated string) 4 (char[4]) "DGAN" --- section marker 4 (int) Offset to end of animation 4 (char[4]) "INFO" --- section marker 4 (int) Offset to first object (usually 8) 4 (int) Number of objects 4 (int) NULL
OBJECT INFO ---------------- 4 (char[4]) "CPAN" --- section marker 4 (int) Offset to end of object 4 (char[4]) "ANIM" --- section marker 4 (int) Offset to frame info (usually 48) 28 (char[28]) Object name (null terminated string, padded to 28 bytes) 4 (int) Number of frames 4 (int) NULL 4 (int) Index of last frame (Number of frames - 1) 4 (int) Index of next sibling (-1 if none) 4 (int) Index of previous sibling (-1 if none)
FRAME INFO ---------------- 4 (char[4]) Frame type (see below) 4 (int) Length of frame data
FRAME DATA ---------------- Frame data is all floats. Structure depends on frame type.
Frame types:
"KRT0" Root quaternion rotation (float x,y,z,w), vector translation (float x,y,z), time (float seconds)
"KR00" Child rotation, time
"KRTS" Scaled rotation, translation, scale (float x,y,z), time
Root frames contain extra data for translating the model in the world. Child frames are simply rotations, concatenated as they go up the hierarchy.
You can probably guess, the letters here stand for (K)eyframe, (R)otation, (T)ranslation, (S)cale, (0)None so presumably there could also be other combinations like "K0T0" but the above are the only ones found in all of the files I studied.
Notes ----------------
Overall file structure looks like this:
Header | +-Animation | | | +-Object | | | | | +-Frame | | +-Frame | | +-Frame | | +- ... | | | +-Object | | | | | +-Frame | | +-Frame | | +-Frame | | +- ... | | | +- ... | +-Animation | | | +-Object | | |
...and so on.
Object names are a reference to the DFF mesh or bone which will be rotated with the frame data. The string is not case sensitive.
An animation does not need to reference every part of a model, only the ones that will move. They also do not require an equal number of frames or matching time index.
There are sometimes anomalies like anims with 0 objects or objects with 0 frames.
For reference, the base pose can be viewed by creating animations with Rotation = {0.0f, 0.0f, 0.0f, 1.0f}.
I hope this file has been helpful. Now let's see some editors!
- Hollower
|
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Beholder  |
Posted: Thursday, Jan 10 2008, 05:25
|
Player Hater

Group: Members
Joined: May 17, 2005

|
steve-m, I guess it would it depend on how different SA is from VC. At quick glance it looks as though the section markers aren't in SA's ped.ifp, as well as the frame types. Also, there is a reference to studio max in the first animation, abseil. I'm not usually much when it comes to cracking file formats, but I have a pretty decent base to work from and can take a crack at it (no pun intended). If I get stuck I'll try to seek one of those 3ds authors and if that doesn't go anywhere I'll just post back here and cry myself to sleep. For anybody else that plans to use the doc posted here, I would like to mention that as far as VC's ped.ifp file is concerned, in the object infp section, the NULL int following the number of frames should not be read/written if the offset to frame info is 44, as opposed to if the offset is 48. Thanks REspawn and steve-m, you guys rock! -Beholder
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
AK-73  |
Posted: Thursday, Jan 10 2008, 19:08
|
Hustler

Group: Members
Joined: Oct 31, 2005

|
If you're concerned with animations in Vice, I'd like you to refer you to two mods of mine: First my ifp suite which is open source and which enables exporting directly into the (VC) .ifp from gmax. It does contain a bug though which I can't fix because I can't upload files onto gtagarage. (Anybody knows when this is going to change?) But the exporter is open source, so depending on what you want to do, it might help. Secondly my GTA:MA mod which allows adding new animations as a side-benefit. I have even added new animations from SA into VC with it. Just ask ceedj.  Anyway, I don't know the SA file format but I am fairly well-acquainted with the VC .ifps. If you need some help, feel free to pm me. Now if I could only convince steve-m or some of the other veterans to help me make sense of the rest of the ps2 lcs .mdl file format...  Wäre richtig gut.  Alex
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Aschratt  |
Posted: Saturday, Jan 12 2008, 13:34
|
Three Headed Monkey

Group: Members
Joined: Apr 12, 2006



|
Well... I took a look to the ANP3-Format some moths ago... I haven't realy finished my work on this, cause I thought I can find something out about Cutscenes, and how they work, but then I found out that cutscenes are ANPK-Animations... I posted this stuff to the wiki: http://www.gtamodding.com/index.php?title=CutsceneThere are not many differencies between ANPK and ANP3. Section Markers are removed and sections are more sorted and compressed now (Like the compression in the COL3 - collision-files). Yesterday I found time to create an txt like hollower did once: | CODE | ================================================================= IFP file format for Grand Theft Auto San Andreas animation Written by Aschratt (support@aschratt.com) ================================================================= (updated Jan 2008)
This file is based on the decodings of hollower from 2004. For more information search GTA Forums.
Binary Structure:
==== Header ============
4b - CHAR[4] - 'ANP3' (Version Identifier String) 4b - INT32 - Offset to end of file (Relative to stream position pointer, so usually you have to add 8 to get the file's content size) 24b - CHAR[24] - File's Internal Name 4b - INT32 - Number of Animations ==== Animation Info ====
24b - CHAR[24] - Animation Name (!!! String stops with first null-char ('\0'). Everything after this is ignored... R* Put some debug stuff there sometimes (Like 3dsm directorys)) 4b - INT32 - Number of Objects 4b - INT32 - ? 4b - INT32 - ? ==== Object Info ========
24b - CHAR[24] - Object Name 4b - INT32 - ? 4b - INT32 - Number of Frames 4b - INT32 - ? (Frame DATA TYPE: KRT0 = 0, KR00 = 1, KRTS = 2) ==== Frame Info =========
2b - INT16 - ? (RX) 2b - INT16 - ? (RY) 2b - INT16 - ? (RZ) 2b - INT16 - ? (RW) 2b - INT16 - ? (TX) 2b - INT16 - ? (TY) 2b - INT16 - ? (TZ) 2b - INT16 - ? (TIME) Like nearly all new coordinate formats in SA the Animation Packages are compressed. To get the real-world floating coordinates simply divide the short values with 128!
================================
Notes: I think that there is a constant value in the object-info section which defines the frame's data type. This means that there are still those data-types like in ANPK.
But I am not sure about this and still have to search some examples and try a little bit around. Mostly the frame info data type is like the root structure.
These decodings are done by scratch in an hour. I had not much time, but I hope it will help you for further decodings.
Greetings... Aschratt!
Homepage: [URL=http://www.aschratt.com]http://www.aschratt.com[/URL] E-Mail: support@aschratt.com |
I hope this helps! To the cutscene animations: They are ANPK-Packages, but somehow they got an diffrent structure in some phrases... somehow the sibling numbers are mission sometimes or only one of them exists... sometimes the number of frames is too high and the last frame seems to be removed. Maybe in SA ANPK is Version 2 and ANP3 Version 3, so that VC-Animations are not longer compatible to SA Animations. But I have to test this (Maybe it is only an mistake of mine). Greetings... Aschratt! This post has been edited by Aschratt on Saturday, Jan 12 2008, 13:49
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
steve-m  |
|

Group: Members
Joined: Jul 26, 2002



|
To convert the transformation data in Frame Info to floats, divide the signed INT16s by the following values: - real part of the quaternion (RX, RY, RZ): -4096
- imaginary part of the quaternion (RW): 4096
- position vector: 1024
- time key: 60
Haven't checked those, just looked them up in my old code. Especially the quaternion seems a bit weird, likely I got that wrong. The third INT32 in Object Info is the Bone ID, it (usually) matches those used in DFF files. Here is some code I used to map animations to dff frames, might be helpful: | CODE | // Check, which of the animations can be applied to the loaded model // must do in reverse order, because VC models have 2x "root"! Animation[i1].AnimObject[i2].ObjFrame := -1; j := length(DFF.Frame)-1; while (Animation[i1].AnimObject[i2].ObjFrame = -1) and (j >= 0) do begin if (AssignByBoneID and (Animation[i1].AnimObject[i2].BoneID = DFF.Frame[j].BoneID)) or (not AssignByBoneID and (CompareText(Animation[i1].AnimObject[i2].Name, DFF.Frame[j].Name) = 0)) then Animation[i1].AnimObject[i2].ObjFrame := j; dec(j); // j-- end; |
(AssignByBoneID is a Boolean for using BoneIDs rather than frame names for matching, preferably for SA models/anims)
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Aschratt  |
|
Three Headed Monkey

Group: Members
Joined: Apr 12, 2006



|
| QUOTE (derty @ Jan 14 2008, 16:33) | | QUOTE (Beholder @ Jan 13 2008, 13:19) | | Another thing I'm kinda curious about is that are objects with only 2 frames, and no change in the translation/rotation values. |
Maybe these are like the TVs/VCRs, ETC? 2 frames: the static state and the "lifted"/interacted state? Just a guess, watchin this topic, interesting. Greets Steve. | I don't think so... I think that this is like in cutscene animations... they are only used as "spaceholders". Means: You got one frame at point 0 and one at point X. between those points the animation does nothing. So you can stop an animation for a certain time (e.g.). In cutscenes this is used very often. Imagine: the first Cutscene in SA. It has many animations (The suitcase, CJ, the Stuartess, the Taxi and the taxi Driver.) But how to combine those animations? (There is no info about the time they are loaded). Easy awnser: All Animations started at the same point. but thos who aren't used until they are in view are stopped for this time span. So for example in the first cutscene the Taxi starts to drive after the suitcase falls into the hole. But the taxi-animation is startet when CJ starts to walk. To make this more imaginable (if you haven't understand me ^^), simply import the cutscene into 3ds max (KAMs supports them).
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
| |
 |
|
 |
|
|
|
|