Sprite Plotter

Discussion in 'Utilities' started by MarkeyJester, Apr 15, 2012.

Thread Status:
Not open for further replies.
  1. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Right, this is for all of those sprite artists out there, one of the biggest tedious tasks of putting a new player/character (or even as simple as a design change), has to be “importing the art”. Now there are a few tools available, with the most recommended tool being SonMapEd, however, due to its “Import Sprite Sheet” option being incomplete, all sprites require being imported one by one, and the problem here is time consumption.


    As members of the community we strive to find new and innovative ways of getting awesome work done the quickest and professional, and we’re learning every year to improve, self-correct, and find alternative solutions to problems, and today I release a two weeks’ worth of work of a tool to contribute to this growth.


    Today I give you “Sprite Plotter”:


    Download


    This tool is designed to read almost any sprite sheet (within reason), and import all of the sprites correctly (in order of the sheet). Of course, that’s not to say it’ll wipe your arse for you, it’ll just do the tedious task of importing. Here’s how it works:

    Step 01 – Selecting a Sprite Sheet




    When you run the program, the first thing it'll ask you to provide is a sprite sheet (this must be a 24-bit bitmap image), here is an example of a good sprite sheet to import:


    Dragon Ball Z


    Notice how all sprites have a certain seperation space? That is necessary, the tool will generate a box around each sprite, and if any of the boxes touch, it will assume that the sprites are together as one major sprite, and it will fuse them.

    Step 02 - Selecting a palette




    The next thing it'll ask for is a palette, now, there are three things you can do, if you do not have a palette at all, you may click cancel, the program will try to generate one out of the sheet as best as it can. If you would rather not have the program generate a palette and would like to provide a pre-made one, then there are two types you can select:

    1. A "binary" file - this is in the Mega Drive's palette format, you can open up a binary palette that's already made
    2. A "bitmap" file - this is a simple 24-bit bitmap image of a palette of colours, it is important to understand that the program is sensitive when it comes to reading colours from bitmaps, here is an example of a "bitmap" palette that is suitable for the program:

    [​IMG]

    Step 03 - Selecting a Sprite Distance




    [​IMG]


    Now, you might have a sheet that has a sprite with pieces that are not attatched, but you would like the program to read as one major sprite, for example:


    [​IMG]


    A dialog box will pop up, requesting that you type in a distance, by default 1 will be there, you may click OK to proceed if you wish, what that number is, is how many pixels away from the sprite (on X and Y axis) the "touch box" has to be. As I mentioned earlier, each sprite will be given a square box around it, and if any of them touch, they will be fused together as 1 sprite, well, this will allow you to expand that box a certain number of pixels away from each sprite, allowing you to fuse certain untouching sprites together.


    THIS IS IMPORTANT THOUGH SO PLEASE READ, you need to get this right, this "touch box" WILL apply to every sprite, so be VERY sure that all sprites you don't want to fuse together are seperated on your sheet by a longish distance, here's an example of a sheet with a decent distance between sprites:


    Monkey Sheet Seperated


    That sheet has a shadow under the monkey that is about 14 (hex) pixels away from the monkey, so I have made sure that all other sprites are moved away from each other by more than 14 pixels, and then typed in 14 in that dialog box, my program will now know that the shadow should be fused with the monkey, but the other monkeys shouldn't be fused with each other.


    1 pixel should be fine for sheets that don't have untouching pieces though. But you do still need to make sure every sprite is not touching each other within the "touch box".

    Step 04 - Sprite Control




    [​IMG]


    Next up, in this dialog box you'll get to choose which palette line you want the sprites to advance themselves to, whether they're flipped/mirrored sprites, and if they are high/low plane, and if you would like it to setup and dump pattern load cues to go with the mappings, there's also an option to make the first sprite automatically null (Sonic sprites in Sonic games usually have a first null sprite for flashing when getting hurt).


    Once you have made your selection, click OK.

    Step 05 - Selecting a script




    So I don't bore you with the details, I'll keep this simple, there are 5 scripts that come with the program, each one for a different game's format, the ones available are Sonic 1, Sonic 2, Sonic 3, Sonic 3 (For non-character objects PLC) and Sonic Crackers. Select the one you require to import the sheet to.


    The reason why I've made scripts for each game, is so that those of you who have a slightly different format, or those who have their own engine/game, you can make your own script, it is limited, but not too limited, and there's a table in each one explaining the format.

    Step 06 - PLC Lables (Sonic Crackers Only)




    If you did not select Sonic Crackers, then you may skip to step 07, this is for Sonic Crackers Only.


    Because of the nature of Sonic Crackers' format being so different, instead of having a tile count and a tile "add" address like the other Sonic games, it has a DMA styled PLC, which contains the EXACT location fo the sprite art on the ROM, and the EXACT VRAM address to dump to, I have compensated for this by setting up the script in Sonic Crackers in such a way that the "O" and "D" flags will prompt you to type in your own "Lable" or "$035F2lalalaexample" address for the "Destination" VRAM and sprite art "Source", the program will place the Art add address in first and the will place your lable in after a "+" symbol, an example if you typed in "SonicArtLoc" as the source lable and "$F000" as the VRAM lable:



    Code:
    P34458294_0001:
    
            dc.w    $F000
    
            dc.l    $97000000+((SonicArtLoc/2)&$7FFFFF)
    
            dc.w    $0000+$F000,$FFFF
    
    
    
    P34458307_0002:
    
            dc.w    $F000
    
            dc.l    $970000F0+((SonicArtLoc/2)&$7FFFFF)
    
            dc.w    $0000+$F000,$FFFF
    
    
    
    P34458307_0003:
    
            dc.w    $E000
    
            dc.l    $970001E0+((SonicArtLoc/2)&$7FFFFF)
    
            dc.w    $0000+$F000,$FFFF


    Step 07 - Saving your files




    If Successfully imported, it'll ask you to save up to 4 items:

    1. Art file (Mega Drive binary 8x8 tiles)
    2. Palette file (Mega Drive CRAM binary palette)
    3. Mappings file (Assemblable mapping source code)
    4. PLC file (Assemblable pattern load cues source code)

    Now like I said, this tool doesn't do "everything" for you, when importing these sprites, it centred all of them, because it cannot know what sprites you want positioned where and how (it isn't human like us), so you may want to open up these files with SonMapEd or something and adjust them to your liking.


    The animation scripts will also need fixing (that's if the order of the sprites on your sheet does not match the order of the original set), but animation scripts are a piece of piss to work with anyway.


    What you use them for is up to you.

    Bug Reporting




    If you find any bugs like crashing, or the sprite sheet not importing correctly, then please be sure that you follow my recommendations first:

    1. Make sure the sprites are at a decent enough distance away from each other so my tool knows what is seperate.
    2. Make sure you have selected the right format script (it's no good selecting Sonic 2 if you wanted Sonic 1).
    3. Make sure the palette file (if you've selected one) is correct.
    4. If you opened up the output map and plc files using SonMapEd and it doesn't show up correctly, then this is likely a bug with SonMapEd, it doesn't read source files correctly and if there are any specific numbers in a specific order in the lable names, then it simply won't read it correctly, to get around this, I recommend either manually changing the lable names to something SonMapEd likes, or running it through sprite plotter again, my tool will output with a different set of lable names that SonMapEd might not be so cuntish about...

    If none of the above is the reason, then be sure to report it, make sure you include the sprite sheet you used and palette (if you selected one) and please be sure to include the script file you selected (so I can take a look at it and see if it's been modified incorrectly, etc). If it's a bug with my program, I might look into fixing it, depending on how I feel, but no promises.
     
    Last edited by a moderator: Nov 13, 2012
    Monitor, Bluestreak and pixelcat like this.
  2. SuperEgg

    SuperEgg I'm a guy that knows that you know that I know Member

    Joined:
    Oct 17, 2009
    Messages:
    Location:
    THE BEST GOD DAMN STATE OF TEXAS
    Jolly good, Markey. This may help out for a little project I was working on before hand.
     
    Bluestreak likes this.
  3. amphobius

    amphobius spreader of the pink text Member

    Joined:
    Feb 24, 2008
    Messages:
    970
    Location:
    United Kingdom
    This is just great for lazy people like me. Absolutely fantastic.
     
    Bluestreak likes this.
  4. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    Sounds like a very useful tool for spriters. I proberly won't need to use it mind, I don't edit many sprites so yeah. But I'm sure some will find use for this.
     
    Last edited by a moderator: Apr 15, 2012
    Bluestreak likes this.
  5. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    This is great. Now, all we need is a tool to do the opposite :)


    I have two technical questions: is it possible to create one palette per frame? And are the tiles always aligned 8x8 or can they be unaligned (it can save some tiles, but it's often minor)?
     
  6. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    No, I'm afraid they all must be the same line, unless you want to sit there confirming the palette line for each sprite, as for alignment of 8x8, that's within reason, the entire sprite isn't always within 8x8 "positioning", it pads out to 8x8, and then centres, so it's either a multiple of 8 or a multiple of 4, as for individual pieces, no, I'm afraid not, to calculate all of that, and write up an algorithm to do such a thing is not something I would like to commit myself to. I'm not a professional programmer so I won't be considering improving it any time soon.


    In other words, you get what you're given, thanks for the feedback though.


    EDIT: Additional response regarding the palette line thing, as I said about the positioning of the entire sprite on the first post which will require clean up (Due to the tool not knowing how you want something placed), you can use SonMapEd for example for repositioning, the same would apply to palette line selection of individual sprites, remember, what is dumped out of this tool is compatable with the games, and most of the stuff compatable with the games is readable by other tools too.
     
    Last edited by a moderator: Apr 16, 2012
  7. Zana

    Zana In Bun We Trust Exiled

    Joined:
    Jan 2, 2011
    Messages:
    76
    Location:
    Madrid
    Friggin Epic, hopefully i will have a spritesheet to use soon X3 this will come handy for so much stuff
     
  8. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Haha, no worries, I was just asking to know what it is doing and what it isn't doing. I was wondering if, once we'll have a tool to export sprite sheets, the resulting imported sprites and mappings would be similar or not to the original (which is essentially a rhetorical question as well).
     
    Last edited by a moderator: Apr 16, 2012
  9. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Bump! Version 1.5


    It seems that there is a bug with the tool...


    ...in very rare circumstance, the right side of a sprite can become completely cut-off, I tried using a Sonic sprite sheet I had made, and found that with Sonic's hurt sprite, the far right set of tiles vertically became non-existant, so it appeared as if a part of his shoe was gone. This was caused by incorrect fusing of touching sprite boxes, I won't go into details as it's pointless to explain, but I strongly recommend that you download the new bug-fixed version, I have updated the link in the first post, and here it is again below:


    Sprite Plotter V: 1.5


    i apologise for any inconvenience, happy spritin'!
     
  10. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    I don't art, but by reading your description it seems that your program can do great things, and I always like to show respect for this kind of useful utilities :)
     
    Bluestreak likes this.
Thread Status:
Not open for further replies.