Everyone knows the value of tools, weither they are trying to take a bolt out of car, or prepare art for a game; the 'right' tool for the job can make things painless and fast.
The Sheet System
The S3Engine uses a system called the 'sheet' system, a sheet serves as a logical 2-Dimensional grouping of image frames, each frame can also store additional per-frame data.
A sheet is grouped in Rows and Columns, and each 'cell' of the table is a Frame.
Each frame has five basic properties:
These allow you to reference an image (texture) by file name, specify centering offsets, and also specify flipping.
This system is very useful because in most cases it allows fewer frames to be used in a game, where some frames can be referenced duplicates with different alignment and flipping.
It also gives us the ability to specifically 'trim' the whitespace from each frame making it as small as possible, the loss of left-top space can be compensated for via the offsetX and offsetY.
In the logical table an 'animation' is stored as a single row with it's frames being the columns of that row. This arangement allows the engine to make assumptions, such as 'use the first 8 rows as directions'.
The assumed small-size of each image frame allows for images to be swapped in and out very quickly under low memory conditions, instead of being locked into holding a huge single image.
A sheet file is stored in XML, which means it is editable with any text editor.
In short this is a really great format for storing animations.
However, very few things in life are perfect, while storing the sheet file in XML was a great idea, due to the ease of tweaking you get from standard editors (mass find/replace, regex, etc.), due to the nature of what the data represents modifying it by hand is VERY cumbersome in all but the easiest cases.
Imagine if a character has 8 directions of 16 frames each, that is 128 frame definitions you need to make, with each likely having different settings. Doing this by hand becomes a nightmare and one XML just can't save us from.
If we figure creating a sheet by hand would take us 1 hour and massive fustration, and using a tool would take us 1 minute and cause no fustration. Then if we figure a game might have 400 sheet files, then to do it by hand would 400 hours or 50 work-days (8hrs each), which for us is more than half of a single 3 month development cycle, in short unacceptable.
When a problem such as this is encountered it is best to write a tool. Even if we consider a tool will take 40 hours, it is still less than the waste it would cause without one, and let's not forget the fustration level, fustration can cause even less work to be done, or even worse the reluctancy to work!
So the answer is to write a graphical tool which let's us physically:
- add rows
- add frames
- delete,copy,cut,paste,reverse frames
- specialty functions such as copy+trim+reverse+append for creating a cyclic animation(for
- mass property changes
Given that this app is graphically intensive, it is neccisary to use a tool which makes writing GUI apps easy, and gives good results, in short C#.
While the tool is still a work in progress the most important features have been added, once they are all working it will be re-arranged into a good looking, easy to use tool which will help speed development.
Here you can see a single 'SheetRow' control: