Altitude Game: Forums  

Go Back   Altitude Game: Forums > Altitude Discussion > General Altitude Discussion

General Altitude Discussion Discuss anything Altitude related that doesn't belong in another forum.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-11-2016, 02:41 PM
Moon Moon is offline
Senior Member
 
Join Date: Jun 2012
Location: UK
Posts: 187
Default Altitude p# image files

After I began being annoyed by the zebra skin I wondered if it is possible to get rid of it while still being able to see my glorious checkered skins. So I took a look at the Altitudes image folders, and removed p4 files that corresponded to the zebra skin which made the client default to the standard no skin planes for the zebra users. However I was left wondering if its possible to view or even edit the p# files, and it turns out that I can.

So I'll be leaving this post here in case anyone else feels like browsing through the Altitudes image files.

A lot of the p# files contain a header which I assume contains the mappings to each sprite within the file. If you find the index of the last mapping ( last ".png" representing byte sequence), and skip 32 bytes ahead, the next 8 bytes contain the image dimensions(4 for the height, and then 4 for the width).

The rest of the file after that is just raw pixel data.
4 byte sequences of RGB + Alpha.

Parse it and you can retrieve the images:




I also managed to modify the images within these files and altitude seems to be rendering them just fine.
Reply With Quote
  #2  
Old 09-11-2016, 04:54 PM
Winters Ark Winters Ark is offline
Senior Member
 
Join Date: Feb 2011
Posts: 352
Default

This is really cool. I'll try it out later today after APL. Been playing with skins off because camo is pretty OP, but I miss my santa hat
Reply With Quote
  #3  
Old 09-11-2016, 05:38 PM
LewisH LewisH is offline
Senior Member
 
Join Date: Mar 2012
Location: Earth
Posts: 215
Default

I wrote a small tool to read and write these files a couple of months ago (not quite 'usable' enough that I'd release it, re-writing it for release has been on my to-do list for a while now.)

Here's my documentation of the format:

Code:
Each `pack` file is a texture atlas containing a texture (sometimes multiple
textures, but only for large images), and one or more sprites.

The file starts with a list of sprites.

First is a little endian (later referred to as 'LE') 32bit integer giving the
number of sprites the pack contains.

For each sprite, the following is then read:

   - It's file name
      + a UTF-8 string which starts with a 16bit LE integer giving the
         length of the string in bytes.
   - X-offset (The horizontal offset in pixels from the left of the image)
      + a 32bit LE integer.
   - Y-offset (The vertical offset in pixels from the bottom of the image)
      + a 32bit LE integer.
   - Width in pixels
      + a 32bit LE integer
   - Height in pixels
      + a 32bit LE integer

After the list of sprites is the metadata for the textures:

   - A 32bit big endian (BE) integer:
     - If the value is less than 10000, the image is uncompressed, and this
       value gives the pixel format:
        - 0 => ALPHA8
        - 1 => RGB5
        - 2 => RGBA4
        - 3 => RGBA8
        - 4 => DXT1
        - 5 => DXT1A
        - 6 => DXT3
        - 7 => DXT5
     - If the value is 10000 or higher, it gives the compression type, and
       _another_ 32bit integer is read for the pixel format.
        - 10000 => Uncompressed
        - 10001 => DXT
        - 10002 => JPEG
          - Altitude extends the JPEG format to add transparency, by way
            of an optional LZMA compressed bit-mask.
        - 10003 => LZMA
   - Another 32bit BE integer giving the repeat type:
     - 0 => Clamped
     - 1 => Repeat (a draw area larger than the texture will repeat the texture)
   - Another 32bit BE integer giving the filter type:
     - 0 => Nearest neighbour
     - 1 => Linear

Finally, the textures:

   - A 32 bit BE integer giving the number of textures.
   - For each texture:
     - It's width (32bit BE)
     - It's height (32bit BE)
     - The RAW pixel data, with the compression and pixel format given above.

The default maximum texture size is 256x256.

For large images there can be multiple textures which are tiled together
to make the full image. As far as I can tell, these packs only ever contain
a single sprite (presumably whatever bin-packing algorithm they use
starts with the largest, and ends when a single texture is full).
P.S. That glyph packing on the second texture in the OP... Gotta save the bits I guess ^^

Last edited by LewisH; 09-14-2016 at 04:40 PM.
Reply With Quote
  #4  
Old 09-12-2016, 10:47 AM
Oyster Oyster is offline
Senior Member
 
Join Date: Jul 2011
Location: In the ocean.
Posts: 325
Default

so you're saying we can edit these to make whatever kind of skin we want?
Reply With Quote
  #5  
Old 09-12-2016, 11:28 AM
Moon Moon is offline
Senior Member
 
Join Date: Jun 2012
Location: UK
Posts: 187
Default

I thought you were only concernign yourself with server side exploration. What other stuff have you been looking into?

Also have you played around with messing with the texture sizes? Does altitude still recognises the file, and does it scale the textures down after reading them? Or for eample with planes, does it produce some odly shaped textures with regular hitboxes?

edit: @Oyster, depends on what you mean by 'whatever kind of skin.' I edited the files without changing any of the dimensions of the textures and the altitude recognised them just fine. Not sure if alti would be happy with non-standard dimensions even assuming you properly define them using the format LewisH outlines for us here.

Also.. will anyone really be bothered enough to edit 36 odd images? :/

Last edited by Moon; 09-12-2016 at 12:45 PM.
Reply With Quote
  #6  
Old 09-12-2016, 01:35 PM
LewisH LewisH is offline
Senior Member
 
Join Date: Mar 2012
Location: Earth
Posts: 215
Default

I am mostly concerned with server stuff -- In this case, Stam asked if it was possible to edit the files, so I spent a week or so looking into it. I'll clean up the code whenever solemnsky gets a proper map graphics format, for adding images in my altitude to solemnsky map converter ^^

As for what I've looked into: File formats (maps and resources), the packet/message format (including vapor), and the protocol (also including vapor). Along the way I've deobfuscated enough of the main game code to make small server modifications. I prefer to pretend client modification isn't possible, for reasons. My current work is on writing my own implementation of all of this, with the eventual goal of custom server software (altserv). I may also write a vapor master server, for whenever nimbly shut down their altitude servers, be it in 10 months or 10 years.

I haven't played with the skins at all, so I'm not sure what's possible with that.

> Also.. will anyone really be bothered enough to edit 36 odd images? :/

I wouldn't be particularly surprised :3

Last edited by LewisH; 09-12-2016 at 01:43 PM.
Reply With Quote
  #7  
Old 09-13-2016, 09:17 AM
Oyster Oyster is offline
Senior Member
 
Join Date: Jul 2011
Location: In the ocean.
Posts: 325
Default

I'd gladly edit 36 images if it meant having a new skin
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for some help in modifying some files. Diablo Tech Support 1 04-13-2013 02:13 AM
Altitude Promotional Image lamster News 34 05-18-2010 07:15 PM
Background Image York Map Making 8 01-13-2010 09:20 PM
Altitude Fansite/Press Image kit Karl General Altitude Discussion 6 12-13-2009 07:12 PM


All times are GMT. The time now is 02:01 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
2008 Nimbly Games LLC