1. Please help us cover the costs of Terra-Arcanum's migration to Xenforo, Guest! More information is available here.
    Dismiss Notice

.ART file specification - need help

Discussion in 'Modding and Scripting Support' started by SparrowJacek, Aug 20, 2016.

Support Terra
Arcanum:
GOG.com
 
 
  1. SparrowJacek

    SparrowJacek New Member

    Messages:
    8
    Likes Received:
    0
    Joined:
    Jun 23, 2016
    Hi, can anyone help me? I'm trying to get some data from .ART files, but using Artview I can only do it manually, is there any specification for this format available?
     
  2. FilthyJack

    FilthyJack Member

    Messages:
    84
    Likes Received:
    10
    Joined:
    Jan 27, 2011
    Hello,

    If you're looking for the values representing anim speed and offsets, number of frames etc, then you may be intrested in Arcanum Factory, the builtin art tool can display all those values and much more. If this is not your choice then I can share some details on ART format, or the source code to decode it.

    I guess from your previous post that you want to extract animations in a quick way, then Arcanum Factory can do this easily. Drop the .ART on the window, hit extract, enjoy the newly created folder with all the frames.
     
    Last edited: Aug 23, 2016
  3. SparrowJacek

    SparrowJacek New Member

    Messages:
    8
    Likes Received:
    0
    Joined:
    Jun 23, 2016
    Thanks for the reply!

    I already managed to extract .ART into separate BMP files, however .ART file looks to have much more information that I need(like palette and center X/Y values). If I could somehow extract those values all at once and work on them, that would make my work much smoother. Artview could show me such things, but I wasn't able to get them without manually typing them to txt file.

    Well, Arcaum Factory has this extract info and extract palette tools, but... how do I open that .info file? (Sorry if this question is foolish, notepad++ shows nothing that can be read by humans). It seems that it might be what I need, if I can only get that information :) If you could give me some info on .ART format that would be great, as it'd probably help me with my further plans concerning modding. Anyways, thank you for any help and time that you might give me.
     
  4. Nataku

    Nataku Member

    Messages:
    243
    Likes Received:
    1
    Joined:
    Jun 19, 2011
    Personnaly, I cannot judge on Factory, I do not use it for ART files (but on some others purposes and it's really good at it). To built animed ART I use ArtGen.
    If this is just that, ARTview has an extract all function.

    If you are talking of height and spatial position of art according to their tile, I don't know change them. Then I use ArtGen and I create art based on an npc position : with that picture
    [​IMG]
    And then I know where my art will appear on the tile.

    If you are not talking about anything of that, please can you be more about about what you want.
     
  5. FilthyJack

    FilthyJack Member

    Messages:
    84
    Likes Received:
    10
    Joined:
    Jan 27, 2011
    Well ArcanumFactory can extract/join any frames merge palettes and extract/modify anim infos, but the anim infos is saved as binary data (not human readable) this is so that you can load it back in ArtEditor, the art window has all those elements accessible (Center/speed/offsets) and can be modified for each frames by just typing the new values in.

    Maybe I could change the output format of anim infos to be plain text, but modifying it in the interface or in a text file is the same, isn't it? In the interface you have a preview of the frame you are modifying.
     
  6. SparrowJacek

    SparrowJacek New Member

    Messages:
    8
    Likes Received:
    0
    Joined:
    Jun 23, 2016
    Well, if I knew which byte represents which value in .info that would be what I need. I'm working on 2 things at the moment: using Arcanum animations in Baldurs gate and vice versa. For that I need all these offsets and such to create BAM file out of ART file(BAM files contain all animations and pictures in BG game. I also have BAM specification, I can create BAM file simply by putting bytes with right values to right places) or ART out of BAM. After seeing which data is present in .ART I think that they have similar structure, so making program that makes all the work in a few seconds wouldn't be hard if I had more info on ART file format.
     
  7. FilthyJack

    FilthyJack Member

    Messages:
    84
    Likes Received:
    10
    Joined:
    Jan 27, 2011
    I really love anything BG related, good luck with the project!

    About the ART specifications I don't remember everything by heart but it uses bmp (sometime rle compressed/padded) and a header with palettes (up to 4).
    Here is the function I use to create a single frame .ART file from gif in delphi, hope it helps you understand the file structure.

    procedure CreateArtFile(the_gif : TGifImage; FileName : string);
    var
    id, x, y : integer;
    ArtFileHeader : ARTHeader;
    f1 : TFileStream;
    FrameInfos : ARTBmpHeader;
    pix : Byte;
    rgba : ARTColorMapValue;
    begin
    ArtFileHeader.ArtFlags := 1;
    ArtFileHeader.HeaderItemCount := 8;
    ArtFileHeader.FrameRate := 8;
    ArtFileHeader.PalRGBA[0] := $F8F91200;
    ArtFileHeader.PalRGBA[1] := 0;
    ArtFileHeader.PalRGBA[2] := 0;
    ArtFileHeader.PalRGBA[3] := 0;
    ArtFileHeader.ActionFrame := 0;
    ArtFileHeader.RealFrameCount := 1;
    //size here = 36
    for id := 1 to 8 do
    begin
    ArtFileHeader.PaletteInfos[id].size := 0;
    ArtFileHeader.PaletteInfos[id].offset := 0;
    ArtFileHeader.BmpInfos[id] := 0;
    ArtFileHeader.bmp_padding[id] := 0;
    end;

    FrameInfos.Width := the_gif.Width;
    FrameInfos.Height := the_gif.Height;
    FrameInfos.size := the_gif.Width*the_gif.Height;
    FrameInfos.center_x := the_gif.Width div 2;
    FrameInfos.center_y := the_gif.Height - 1;
    FrameInfos.offset_x := 0;
    FrameInfos.offset_y := 0;

    f1 := TFileStream.Create(FileName, fmCreate);
    f1.Write(ArtFileHeader, sizeof(ArtFileHeader));
    for id := 0 to 256 -1 do
    begin
    rgba.red := GetBValue(the_gif.Images[0].ColorMap.Colors[id]);
    rgba.green := GetGValue(the_gif.Images[0].ColorMap.Colors[id]);
    rgba.blue := GetRValue(the_gif.Images[0].ColorMap.Colors[id]);
    rgba.reserved := 0;
    f1.Write(rgba, sizeof(rgba));
    end;

    f1.Write(FrameInfos, sizeof(ARTBmpHeader));

    for y := 0 to the_gif.Images[0].Height - 1 do
    for x := 0 to the_gif.Images[0].Width - 1 do
    begin
    pix := the_gif.Images[0].Pixels[x,y];
    f1.Write(pix, sizeof(Byte));
    end;

    f1.Free;
    end;
     
  8. SparrowJacek

    SparrowJacek New Member

    Messages:
    8
    Likes Received:
    0
    Joined:
    Jun 23, 2016
    Hopefully some of Arcanum animations will be present in Improved Anvil v7 mod - that one I'm currently working on. Check it out if you want :)

    Not to stray from main topic:
    FilthyJack, thank you very much for that code! I'm sure it will help me with second part of my project(BAM to ART), which will be harder part probably. At the moment I'd like to focus on ART to BAM conversion. For that I need mostly http://imgur.com/AlhfWAU those values. X and Y can be obtained from BMP files without problems, but "center" can't (to my knowledge, and I'm just a self-learner and beginner at programming). Your ArcanumFactory can extract those values, but sadly I have no idea which bytes represent them in .info file, could you help me with that please? (I will probably use lots of Arcanum animations, so I'd rather avoid writing them manually from the screen)

    EDIT: For some spells those center values are more complicated than width div 2, that's why I can't obtain them from pure gif or BMP files.
     
    Last edited: Aug 24, 2016
  9. FilthyJack

    FilthyJack Member

    Messages:
    84
    Likes Received:
    10
    Joined:
    Jan 27, 2011
    The way I save the infos in binary format:

    if ExportAnimationInfos1.Checked then
    begin
    name := folder+'\anim_infos.info';
    f1 := TFileStream.Create(name, fmCreate);
    f1.Write(art1.Header.ActionFrame, sizeof(DWORD));
    f1.Write(art1.Header.FrameRate, sizeof(DWORD));
    f1.Write(FramesInfos[0], Length(FramesInfos)*sizeof(ARTBmpHeader));
    f1.Free;
    end;

    The structure for ArtBmpHeader:

    ARTBmpHeader = packed record
    Width, Height,
    size,
    center_x, center_y,
    offset_x, offset_y: dWord;
    end;

    This is pretty much straightforward, a succesion of packed dword, it's just not human readable. (binary)
    num_frames := (file_size - (sizeof(dword)*2)) div sizeof(ARTBmpHeader);

    I remember IA very well, it is one the hardest mods for BG, I'm glad to see you're still working on it!
     
    Last edited: Aug 24, 2016
  10. SparrowJacek

    SparrowJacek New Member

    Messages:
    8
    Likes Received:
    0
    Joined:
    Jun 23, 2016
    Thanks! Using all that info I got from you I finally managed to create BAMs that work in BG! https://postimg.org/image/z0xd83qyj/ That is an example(I'm still working on some details, but generally I can converty any animation and it works pretty well) of how it looks like in game.

    I'll ask our main modder to put you in credits for new IA version :)

    EDIT: here's another example https://postimg.org/image/c061u9osb/ it looks pretty nice, colors are balanced and you wouldn't say that it's from another game IMO.
     
    Last edited: Aug 29, 2016
  11. FilthyJack

    FilthyJack Member

    Messages:
    84
    Likes Received:
    10
    Joined:
    Jan 27, 2011
    From the screenshots I'd say, 1-hell's pocket plane, 2-forest with gods statues, hehe, otherwise I'm surprised it looks quite good!
    Credit would be cool ofc, but is not required ;)

    Thanks for keeping the modding community alive guys, and good luck with the new version!
     
  12. AxelStrem

    AxelStrem New Member

    Messages:
    2
    Likes Received:
    1
    Joined:
    Apr 27, 2017

Share This Page

Our Host!