# NEO GEO Sprite ripping tutorial

1. Introduction

This tutorial is focused in Neo Geo and Kawaks. We've used KOF games during the tutorial, but if you are clever, you will see that similar techniques can be applied to other games and emulators as well. Once you got the knowledge, it's only a matter of time to apply it to any circumstance. To put an example, if you know C/C++, you'll be able to work easily with both Visual C++ and Borland C.

In our tutorial, references to files/programs are written in red, comments are written in green, and menu names in blue.

2. Tools

2.1. What we need for sprite ripping

-A Neo Geo emulator, I recommend WinKawaks, since this tutorial is based on it (http://kawaks.retrogames.com)
-A Neo Geo game (I don't know how or where to get them, use google)

2.2. What we need for sprite processing and palette management

-Paint Shop Pro and Animation Shop (I won't provide them either. 30 day trial version can be downloaded here)
-Elecbyte tools: PCXCLEAN and development tools (sprmaker, sndmaker, fntmaker, and AirEditor)
-Notepad (comes with Windows)

2.3. What we need to achieve everything

-This tutorial
-Time and patience

3. Setting everything

With kawaks version 1.45, neo geo debug dipswitches can be enabled without any need of cheats, that's why I've chosen this emulator to focus this tutorial. You don't have to worry now about debug, dipswitches or cheats. I'll tell you when time comes.
First run your kawaks emulator, and select a game where you want to rip sprites from.
What? You don't know how to run it? Read the documentation that comes with the emulator (faq.txt)
Ok, now you have your game running. To get the best results, and this must be applied to any emulator. You must disable any enhanced graphic feature (scanlines, eagle eye, interpolation, etc..) This way your sprites won't be blurred. Also remember to set kawaks in windowed mode and 1x window size.

I suggest to put neogeo in Console mode, since this will alow us to do some tricks while ripping.
Now run the game, I've chosen KOF 2000 for this tutorial, but all other games have similar features.
Once game runs and you can see the intro, go to GAME menu and select NEOGEO SETTINGS and DEBUG DIPSWITCHES. You'll see the following menu:

What's this? Dipswitches are special switches (doh!) that allows you to configure special parameters in the game. You can make secret characters playable, have unlimited life, etc.. with a few changes in the dipswitches. Dipswitches also allow us to get some features that would help us when ripping or even when creating our mugen characters. You'll see why.
First, there's a description about each dipswitch (Thanks to Kaku for Dip Switches explanation)

DIP 1-1 : Debug Object in Middle
DIP 1-2 : CLSN boxes
DIP 1-3 : Infinite Strikers, Time Stop, access Throw edit mode, access skill edit tools,DEMO check modes,stage select..maybe more
DIP 1-4 : basic velocity values
DIP 1-5 : unknown(b4 kof2k..it's ASCII codes)
DIP 1-6 : P1,P2 infinite life
DIP 1-7 : unknown...
DIP 1-8 : able to pause in anywhere...then press P2's pause to see game frame by frame
DIP 2-1 : AI/other stuff edit tools (not useful)
DIP 2-2 : AI take control of P1 and P2.. I think
DIP 2-3 : P1 infinite life
DIP 2-4 : shows Battle Ability, press start to gain energy to MAX
DIP 2-5 : shows sound codes as they appear
DIP 2-6 : sound player I guess
DIP 2-7 : AutoFire
DIP 2-8 : unknown

We'll enable the following switches in kawaks, dips 1-1,1-3 and 1-6. You can see that a strange character has appeared in the middle of the screen. This is the Debug Object test.

Suppose we would like to rip Leona's sprites. To do this, select Vs. mode and choose 1st player as the character you want to rip his/her sprites. It doesn't matter who's the 2nd player.
Round starts, and we have Leona as our first player, Benimaru as our 2nd player and a palette swapped K'.
The most important thing about ripping is to keep the exact position of the axis. What's the axis? It's like a magic point that bonds the character to all his/her animations.
If we have our sprites with a bad axis, our character would "shake" with all his animations. Also, if all of our sprites have the same axis, we will save a lot of time in the SFF file construction.

good axis | bad axis

We have 2 choices, do the "hard way" (rip all sprites and calculate each axis for all sprites) or do the "easy way" (rip all the sprites in the same position and apply the same axis for all of them). I personally prefer the second one, since it's easier. I'll teach you the easy and consequently good way. You are free to learn the hard and bad way :P
Do you remember we enabled dips 1-1,1-3 and 1-6? Now you can see the results, we have an strange character in the middle (dip 1-1), we have unlimited time (1-3) and unlimited life (1-6). This way you can spend all the time you want to rip the sprites.

4. Let's start ripping!!

We'll use the debug object to extract our sprites, and not the character itself. Keep into account the following commands:

Holding 1P Select (F3 as default in kawaks) allows you to interact with the object in the middle.
If you press 1P Select would pause the game, the trick consists to pause it, and then hold the button in order to unpause it.
While holding 1P Select press:
Arrow keys allow you to move the object accross the screen. I suggest to put it in the middle facing right.
1P A increases the object's action.
1P B decreases the object's action.
1P C changes character in object.
1P D changes character in object.
Object inherits 1st players palette. That's why we've chosen 1st player as our rippable character.

Now, change the character in the Debug Object with 1P C/D.
Move your object to the middle of the screen. Save the game. (BEWARE!!!: Kawaks can crash during ripping. That's why I suggest you to save the game once you've chosen your object's position. Also it would allow you to "resume" your ripping process in another time)
Try to change your debug object's actions, you'll see how all animations are played in the same place. It's funny to see Kyo doing a moonwalk as if he was Michael Jackson.
Ripping in this way, we'll allow us to keep always the same axis position. (IMPORTANT: Don't change the position of your debug object after you've started ripping)
Now disable the front layer (timer and lifebars). We don't want them to interfere woth our sprites. To do this, go to VIDEO, DISABLE, DISABLE 8x8 sprites (Alt+1)
Also set the background color to pink in VIDEO, SET BACKGROUND COLOR, PINK.
Go to TOOLS, select SHOTSFACTORY and uncheck all items except the corresponding to the debug object.
Now pause emulator (not the game itself), with ENTER button. Take a screenshot with Ctrl+P. Screenshots are saved automatically in capture folder.
Once you've captured the first sprite, step frame the emulator with Shift+Space. When you see a new sprite, capture it again and repeat the process. When you've finished all sprites in that action group, change it and start to rip every sprite in the new group. You can change animation while stepframing, with a bit of practice you'll be able to rip them easily.

Your sprite should look as this one, once you've ripped it correctly

This may sound as an extremely hard and boring job, but trust me, is the easiest and fastest way to get all sprites. You can easily have all your sprites for your character in almost 3 hours.

5. Extracting a palette

Once you have all your sprites ripped, we'll do the palette extraction part. This part is where many people fails or gets frustated because they ignore how to do it. We'll explain a fast technique to extract a palette from a set of sprites.
First of all we need to convert all sprites into 8 bit (256 colours) PCX files. I use ACDSee (download here) to perform the conversion, because it's shareware and easy to use.
To convert all pictures into PCX do the following:
- Open ACDSee browser, and select all pictures to convert.
- Right button click and select convert.
- Select the output file format.

After converting all sprites into PCX, open JASC Animation Shop. That program allows us to make our own GIF Animations. We'll do one for our character.
Create a new animation, and select all PCX from your character. and make a GIF file with it.
The process can take some time, depending on your computer's speed. After having all your pictures loaded in the GIF framework, save it using the best quality setting.
Now you have obtained a big GIF file with all your sprites. Open Paint Shop Pro and load that GIF we just created. Go to COLOR menu, and select SAVE PALETTE. Save the PAL file with a name, for example temp.pal.
Ok, we've extracted a palette that holds all colours from your sprites. However, you've heared a lot of times that Mugen needs to set the background colour as index #0, and things like that. Indeed, and our palette doesn't have the background colour in the right position. We'll correct this right now.
Open Notepad.exe or any other text editor, and load your temp.pal file. Yes, in case you are wondering, you CAN actually open it with any text editor. You'll see the following text:

      JASC-PAL <- This is the file's header. Don't modify
      0100 <- I don't know what's this, but don't modify.
      256 <- This tells us we have a palette with 256 colours.Don't modify
      255 0 255 <- This is the colour in #0 position, i.e. our background colour
      29 32 31 <- Colour #1
      33 41 49 <- Colour #2
      43 51 59 <- Colour #3
      61 53 49 <- Colour #4
      ...

Obviously, your colour slots would have different values, but that's OK since every palette is different from other palettes.
Now, we'll set our background colour as number 0. To do it, search your background colour (255 0 255, since we are using pink/magenta as our BG colour) through the colour list. Once you've found it, delete that line and paste it in our colour slot number 0. Keep in mind that every your palette MUST have 256 lines of colours, if you delete one, you'll have to create a new one wherever you want.
After setting the BG colour in the right position, save the palette. You can use a new name, for example new.pal, if you are unsure and don't want to overwrite the original palette.
We'll use PAL2ACT, an Elecbyte tool to convert PAL files into ACT. Copy this program in the same folder where your palette is located. Now open a MS-DOS window dialog, go to your pal's folder and type the following command line:
pal2act new.pal new.act
Once the program has been executed, you will have a palette ready to use in Mugen. The last step will be apply this new palette to all of our sprites. We'll use PCXCLEAN to do it.
Open another MS-DOS window dialog, go to your sprites folder and type:
(Remember to backup your sprites BEFORE executing PCXCLEAN)
pcxclean -c -y -t *.pcx new.act
This command will apply our palette called new.act to all PCX files found in the folder.
Ok, we've finished the sprite ripping and pal extraction part of our tutorial. At this point, you have ripped all your sprites, cleaned them, extracted a palette, and applied it to all your sprites. It's time to learn the next level, SFF construction (this will be done in a future).

X. Special thanks

Deuce who showed me the light regarding Neo Geo Debug ripping.
FlowerGirl, Rabite and Kitsune Sniper for "betatesting" this tutorial, giving suggestions and tips.
Kaku and Sander for explanations about Dip Switches.
The entire mugen creators community for their works and help offered since the first day I discovered Mugen.
You for reading this tutorial. I hope it will help to bring a new creator in the "scene" and not a leecher :)