Contrary to what a lot of people think, cam timing and ignition timing have nothing to do with each other.
Cam timing is a relationship between where the cam is indexed at (phased) with the crank. When it is referred-to as "straight-up" or at "zero", it means it is degree for degree in line with the TDC index of the crank, where the cam manufacturer wanted the cam to be at. It isn't advanced, and it isn't retarded in relationship with the crank.
Advancing the cam opens the intake valve sooner, which brings the power curve down to a little lower RPM. In other words, advancing the cam 2, 3 or 4 degrees will make the cam's power curve come-on sooner. This is ideal for things like trucks that need "grunt power" to get moving, or for cars with engines that don't make enough low-end torque to "get-up and go" off the line better. It's a bad situation if you have too much low-end power and can’t control the tire traction. In cases like that, or where higher RPM power is more the goal, you can retard the cam timing by a couple of degrees and that'll bring the power-on later in the RPM range. This may be ideal for high speed cars that don’t take-off like jack rabbits, but need more top-end power, like a road race car or a car that may run at Bonneville.
Ignition timing ONLY has to do with when the sparkplug lights. The distributor may be driven by the cam gear BUT, the distributor rotates freely and can be rotated in any position to set the timing wherever you want, regardless of whether the cam is advanced, retarded or strauight-up. Just because they share the same word of "timing" doesn't mean they are referring to the same MEANING of what "timing" is. For some reason a lot of guys think that if their cam is advanced (or retarded) a few degrees that it affects their ignition timing, when nothing could be further from the truth. Regardless of where the cam is "phased" in relationship to the crank, you can ALWAYS rotate the distributor to achieve the ignition timing you want to have.
Ignition timing ONLY controls when the spark plug ignites. Most engines light the spark plug to ignite anywhere from 32 to 42 degrees before top dead center (BTDC), or in other words, before the piston has compressed the fuel & air all the way to the top.
Advancing the spark timing creates a better burn and more cylinder pressure. Cylinder pressure = power. When you light the cylinder as the piston is still rising to TDC, the fuel & air is expanding, yet the piston is still compressing AS those gasses are expanding. This creates a tremendous amount of pressure inside teh cylinder, which = power. You can only advance the timing just so far though before the fuel burn becomes uncontrolled (detonation or "pinging"), which will cause serious damage to pistons, rings, head gaskets, etc.
Fuel is supposed to be a controlled burn with an even & controlled expansion. When detonation happens, it is more of an out of control explosion. If you stood behind your car and pushed on it smoothly and evenly with yur hands, it'll begin to roll. It doesn’t take that much effort to get it to roll, but if you stood behind you car and smacked it with a 12 Lb sledge hammer, the force you hit the car with is MUCH greater than when you pushed on it smoothly with your hand, yet the car didn’t move an inch. All you did was put a great big dent in the back of your car. The force you hit it with was MUCH greater than yoru hand pushing on it was, yet the result of moving the car was much less. That is what happens when detonation happens inside a cylinder. So you can only go just so far on the timing before you have detonation, and when it happens, it's like smacking the top of the piston with a sledge hammer rather than pushing in it with a smooth & controlled burn.
Retarding the timing does the complete opposite. It lights the compressed fuel & air later (at, or after TDC) and doesn’t create enough cylinder pressure to make good power, or to create a good idle vacuum. Because the burn is lighting later and the pressure is lower, the burn happens MUCH too slow. In fact, it is still burning when the exhaust valve opens, which is why when your timing is too late, your header will glow cherry red and your water temperature comes up. It's also why it becoesa complete turd and has no power. The engine gets lazy because it isn’t making any cylinder pressure to create any power. You need to light the cylinder BEFORE the piston reaches TDC on the compression stroke.
Every engine is different to where it likes the ignition timing. Usually the magic number is 36 degrees befoere top dead center (BTDC) of total timing. Some engines will only like 32 - 34 degrees of total timing, while other's might make more power and have a better burn with 38-40 degrees of total timing. It's all relevant to the static compression, the effective compression (based on the cam profile, power adders, etc.), the type of fuel being used (octane), and a few other factors.
With too much static compression and not enough octane in the fuel, you'll end-up with pinging (detonation) problems and won’t be able to run enough timing to make any power. An engine with not enough compression and too much octane will burn too slow and too cool, and will want more timing advance to help get it out of its own way. This is why rookies that run their cars at the race track with their not so modified engines, and they put "race fuel" in ther tanks THINKING they'll go faster, end-up going slower. They don't have enough static compresion or ignition timing to get enough energy out of the fuel with too much octane. The trick is to have a matched amount of static compression, effective compression, etc. to the type of fuel being burned, and then finding that engine combo's sweet spot for where it likes the timing for where it likes the cylinder to fire at. Once that has been done, later-on you can try different cam timing settings to alter when the power comes-on at. For instance; if you have a car that makes a lot of power but doesn;t have very good traction off the line, you "could" retard the cam timing a bit to bring-on the power later so you can get traction off the line and have explosive power once you're down the track a bit up in the RPMs more.