Spore allows player-created creatures to be shared by exporting a .png
file. That .png
is a photo of the creature, but if it's imported into the game, the creature's information (such as textures, size, and shape) also come with it.
How can I implement such a feature?
Answer
If all you truly needed was the PNG file, chances are they just simply added the information into the file. This is actually a practice of Steganography. A lot of the times, this is used to hide payloads or secret messages in things that are seemingly public facing. However, it is likely in this case that this method is what was used. Typical Stegongraphy will go out of the way to hide the contents, but there is no reason why one could not simply append the data out of the image in the end of the file and retrieve it.
Several tools encode this data for you, a google search brings up at least this and this.
A PNG has the byte signature $89
at the start, so it is possible that the information was inserted after the PNG structure itself and simply parsed by the SPORE game.
However, further research given by the other answers and a search on google reveals that Spore was actually using just a version of Stegongraphy to hide the information in the alpha bits. With this in mind, we can rule out the possibility of appended data or meta-data.
It should be noted that meta data is still a very viable choice, if the data is being parsed locally. If that information might be shared around the web or re-encoded, the export is not guaranteed to keep all your information. When pixel data is used, it can survive losless conversions without an issue.
No comments:
Post a Comment