1. Forum moved (you can use login and pass from old forum)
  2. Many discussions moved to the bugtracker

PCK extracting

Discussion in 'Tools' started by Jos, Dec 17, 2014.

  1. Jos

    Jos Registered

    Joined:
    Dec 5, 2014
    Messages:
    31
    Likes Received:
    2
    Best Answers:
    0
  2. JonnyH

    JonnyH Well-Known Member Official Developer Administrator

    Joined:
    Jul 17, 2014
    Messages:
    184
    Likes Received:
    36
    Best Answers:
    0
    I have some code here: https://github.com/JonnyH/xcapoc-resources

    There's the (questionably named) load_cityimages program that dumps a whole .pck/.tab pair to .png files, if that's what you wanted...

    You'll need to build it (only tested on linux, needs CMake, libpng, png++), run without arguments to get options.
     
  3. spacejim

    spacejim Registered

    Joined:
    Apr 5, 2016
    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    is it possible to make a build of this tool available? Figuring out how to build it and all it dependencies and the dependencies dependencies is beyond me.

    Also, does open apoc only read its data from the .iso file? Can i extract the pcks or even pngs and have it run from them? Or is this planned in the future, to aid moddability?
     
  4. JonnyH

    JonnyH Well-Known Member Official Developer Administrator

    Joined:
    Jul 17, 2014
    Messages:
    184
    Likes Received:
    36
    Best Answers:
    0
    Hi Spacejim - sure, I can try to put a build together - what platform are you on? I tend to dev on linux, so most of my tools are kinda focused on that (though they should work on at least windows too, but may need to setup the build steps yourself)

    The xcapoc-resources repository was mostly used as a 'simple' tool that is easy to modify for reverse engineering the file formats and checking we have decoded them correctly - it's not used in OpenApoc directly, instead the code has effectively been copied into the OpenApoc core itself. I believe that there haven't been any major changes in that which don't exist in xcapoc-resources, but I'm not 100% sure of that...

    If you just want to see the output, there's a copy here: http://s2.jonnyh.net/pub/list/extracted/ - that might be all you need :)

    And we do directly load the files from the .iso in Apoc's native file formats - but we also support png and any image resource can be overridden in an .xml file (I expect this is how mods will be implemented) though that process is still rather manual and often changing due to us still implementing the core game logic.

    One limitation of the .png loader is that it currently does not support the palette swapping used (for example) to do day/night cycles in the city, I am at this point not sure about the best way we can fix this, but having a complete game is still some distance off it's not at the top of my todo list.
     
  5. spacejim

    spacejim Registered

    Joined:
    Apr 5, 2016
    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Thanks JohnnyH, I'm on windows. I'm looking at doing a total conversion mod (no harm starting before the game is finished) and was wondering how to get my hands on the sprites and game objects so I could start doodling with it.

    Also wondering about the way to use them in-game without having to re-pack an iso every time. I was guessing something like elder scrolls games where "loose" files override packed versions, making it easy to mod for.

    maybe if the game has the ability to write pngs I could put in a build flag in its resource loader or something so it unpacks for me? I got the game building fine.

    Palettes are new to me though, expect I'm gonna get tripped up by them.
     
  6. JonnyH

    JonnyH Well-Known Member Official Developer Administrator

    Joined:
    Jul 17, 2014
    Messages:
    184
    Likes Received:
    36
    Best Answers:
    0
    Yeah, we already support path-based overrides using physfs - for example if the game tries to search for the image"

    "xcom3/whatever.pck"

    we search Resource.* paths (as set in the config file) in order

    The defaults, in the order of search, are:
    Resource.LocalDataDir "./data/"
    Resource.SystemDataDir "./data/" (the same as above on windows)
    Resource.LocalCDPath "./data/cd.iso"
    Resource.SystemCDPath "./data/cd.iso" (again only the same on windows)

    That means if you had a file "./data/xcom3/whatever.pck" it would read that one instead of the CD.

    I am currently in the process of adding paletted .png support to allow you to override individual .pck members with .png files, so that's still a work in progress.

    As another option, we also support overriding the resource string (IE path-to-image) for every object in the GameState, which then can be loaded as a mod on top of the 'default' loaded state. This means that you can write an .xml file that modifies the resource string for the tiles you want to change to a "data/my_mod/my_mod_image1.png" or similar.

    Again, this is all a work in progress, generally due to the current palette issues it's probably not worth trying to do much art at this point - as I mentioned I am currently in the process of allowing import/export of .png files while keeping the palette information, so hopefully there will be a better path within a week or so if you can hold off that long.

    I am also starting to write a couple of tools to help modify the .xml for mods and the like, as I know it's auto-generated and not very 'human' readable or easy to modify at this time.

    So, after all that I guess my answer is "Wait a couple of weeks and it'll hopefully get quite a bit easier" :)
     
    makus likes this.
  7. FilmBoy84

    FilmBoy84 Administrator Administrator Tester Researcher

    Joined:
    Oct 9, 2017
    Messages:
    83
    Likes Received:
    117
    Best Answers:
    9
    Whilst Command Prompt based (So DOSBox needed to mount)
    I still use PCKMan (Attached)
     

    Attached Files:

    makus likes this.

Share This Page