[NEW] Sprites.ddf - Overview

This is for features being worked on in the Devbuilds!
Post Reply
User avatar
Corbachu
Site Admin
Posts: 778
Joined: Fri Jun 08, 2012 11:22 am
Gender:
Contact:

[NEW] Sprites.ddf - Overview

Post by Corbachu »

Hey all, wanted to post a bit about our upcoming new DDF, called Sprites.ddf (lump name is DDFSPR).

The following is a breakdown by ChillyWilly:
The things.ddf defines all the info the sprites need BESIDES how they look. What states they use, the timing, etc. That will stay there.

What sprites.ddf will do is make it easy to define how sprites LOOK.

Toward that end, you get to define certain things.

static const commandlist_t spr_commands[] =
{
DDF_FIELD("LUMP_NAME", lump_name, DDF_MainGetLumpName),
DDF_FIELD("FILE_NAME", file_name, DDF_MainGetString),
DDF_FIELD("DATA_TYPE", data_type, DDF_SpriteGetType),
DDF_FIELD("SPRITE_NAME", sprite_name, DDF_MainGetString),
DDF_FIELD("FOFFSET", foffset, DDF_SprGetCoords),
DDF_FIELD("SOFFSET", soffset, DDF_SprGetCoords),
DDF_FIELD("SSIZE", ssize, DDF_SprGetCoords),

DDF_CMD_END
};

You start with a lump or file name. While you could do one for every sprite you're replacing, what is intended is you actually have ONE image that has ALL the sprite images you are replacing. Then you follow that file name command with multiple sprite names and offsets and such. So it would look something like this

FILE_NAME="sprites/new-zombie.png"
DATA_TYPE=PNG
FOFFSET=14,50
SOFFSET=0,0
SSIZE=28,52
SPRITE_NAME="POSSA0"
SOFFSET=28,0
SPRITE_NAME="POSSA1"
SOFFSET=56,0
SPRITE_NAME="POSSA2"

and so on.

The FOFFSET sets the position of the foot inside the sprite rectangle.

The SSIZE sets how big that rectangle is, and SOFFSET tells where the rectangle is inside the main image.

If fields don't change (like FOFFSET and SSIZE in the example), you don't need to include them. Only fields that change need to be specified. Each time it encounters a sprite name, it uses all the currently set info to set
the sprite info the game uses. You can change all the data, or none (for identical sprites), between sprite names.
Note that this can also work for PNG sprite sets too, which avoids you having to define every entry for, say, a 60 image PNG set -- this way will allow you to set them all-at-once.
If you just wish to change some attributes of existing sprites, you'd do so like this

SOFFSET=0,0
SSIZE=34,48
FOFFSET=17,40
LUMP_NAME="CSAWA1"
FOFFSET=19,40
LUMP_NAME="CSAWA2A8"

and so on. The lump names would be the already existing lump names, the soffset would always be 0,0, and the ssize would be the same as it already is. Then you would simply keep changing the foot offset for each lump... and the size if it also changes.
Of course, PNGs can just as well have their offsets defined by the internal grAb chunk, like Slade offers.

So, what do you all think? This system was very much needed, so we have to thank ChillyWilly for taking time to write it all out.

After that is finished, I will document it in the DDF/Wiki formats. Terrain.ddf will come shortly after. ;-)
\(סּںסּَ` )/ۜ

CeeJay
Posts: 224
Joined: Sat Jan 26, 2013 9:56 am

Re: [NEW] Sprites.ddf - Overview

Post by CeeJay »

Yes, this is something I've been missing on quite a few occasions. It would cut down on the amount of "repeated frames" in the WAD, something I use a lot of to create more smoother animations. But with it, what will happen to images.ddf? Perhaps they should be merged into one since they share a very similar function. Or images.ddf is just removed, since with the new grAb feature on top of it it would make this DDF feel a little obsolete, I think.

User avatar
Corbachu
Site Admin
Posts: 778
Joined: Fri Jun 08, 2012 11:22 am
Gender:
Contact:

Re: [NEW] Sprites.ddf - Overview

Post by Corbachu »

This is not primarily for PNG images (that is a secondary thing) -- rather, this is intended for real sprites (Doom image lumps embedded in a WAD), not external formats.
\(סּںסּَ` )/ۜ

Return to “WIP Features”