Here are a few tips from someone who has been there.

This is very difficult, more so than you would think. I would not use this method for any control panel having more than 1 joystick and 2 buttons. The ghosting and masking issues are much more difficult to get around than you would think.

Even a panel with only 2 joysticks and 2 buttons per player may take hours of trial and error to find a seemingly working combination. It is only later you will find some odd occurance like pressing down on player one, while player 2 presses a diagonal and a button causes some different press to be recorded. Normal gameplay causes a lot more simultaneous keypress than you would think, it is possible to hit 16 keys at the same time while playing Streetfighter 2 and even something simpler like Golden Axe has a possible 10 at once (both examples are for 2 players).

This method is great for wiring up your coin mechs and your emulator control buttons. As long as you don't plan on pressing more than one at once you will be ok.

If you are going to rip something apart for the encoder, try a Microsoft Sidewinder joystick. They are almost as cheap as a keyboard and have enough inputs to run a 2 player, 3 button panel. There are also several specialized Mame encoders that are cheaper than the ones from the Arcade manufacturers.

Finally I wanted to clear up a few errors in the above. 8 way joysticks do not take 8 keys, they only take 4 just like the 4 way ones do. The only physical difference between the two types of stick is that the little bit of plastic that hits the microswitches is shaped differently. Also, you do not have to create a brand new circuit board. It is much easier to wire the original one up to a terminal block.