Giter Site home page Giter Site logo

csprite-format-specs's Introduction

csprite-format-specs

Specifcation For .csprite File Format


Specification

About

the csprite file format is more like an "archive format", since csprite files are basically tar archives or a tarball, the tarball has a particular structure, this structure is how any encoder/decoder knows where to put files or read files from.

a csprite image is made up of 2 components, layers & frames. when multiple layers are put into a order a single frame is produced, optionally if multiple frames are put into order a animation is produced.

Structure

the root of the tarball must have a Info.ini file, this file has all sorts of metadata about the file, like the resolution, number of frames, frame rate, image format, author, description, copyright information, license.

Frame structure

since a frame can have a single or multiple layers it is stored in a directory, the directory name follows the following convention: F0 where 0 is to be replaced by the frame number you're referring to.

Layer structure

a single frame has single or multiple layers which must be ordered since that's how it will be ordered in the editor & when rendering the layers into 1 frame.

the name of the layer(s) follows the following convention: 0.LayerName where 0 is to be replaced the index that layer is on, following with a separator . after which everything is treated as the name of that layer.

each layer consists of pixel data and storing the pixel data depends on the image format that is specified in the Info.ini file, for example if the image format is image/png then a png decoder is needed to decode that layer & read the pixel data.

the same is done when encoding, if your image format is image/png then you need a png encoder to encode the data & then store it.

Conclusion

and that's how you store pixel art consisting of multiple frames that are made up of multiple layers.

the format may not be effiecient but it's very easy to read & write.

Example Structure

/Info.ini

/F0/0.Background
/F0/1.Player
/F0/2.Car

/F1/0.Background
/F1/1.Player
/F1/2.Car

/F2/0.Background
/F2/1.Player
/F2/2.Car

License

all the sample code is licensed under the BSD 3-Clause "New" or "Revised" License.


Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.