>Obviously the caliber scale and the cartridge length determines how effective a AP, APCR, APHE and APFSDS projectiles are
That's not how any of this works. Instead of cartridge length the question is what kind of gunpowder used to propel the projectile, and how much of it is used. And even then, that alone tells you nothing without the barrel length. To begin with, there are guns that use bagged charges, so there is no cartridge to speak about (pic related). All of this is an incredibly complex subject with more variables than I can even think of, but luckily all of it can be ignored, because what really matters is the initial velocity of the projectile. Calibre is also not a number that denotes an universal truth. E.g. a 120mm mortar shell holds about as much explosives as a 155mm howitzer shell, because the former has a much lower muzzle velocity, therefore the walls of the projectile can be much thinner (as the forces acting on it are significantly lower) and it leaves more room for explosives.
Which leads to the other point: shell construction determines how the power released by the burning powder is used. After all, a heavier projectile launched by the same powder charge will travel slower than a lighter projectile, but it will retain energy better. But knowing the weight and velocity of a projectile means nothing without also knowing the ballistic coefficient (BC). Here is a quick summary on wikipedia:
As for various projectile types, high explosive can kill either with the blast wave itself or with the fragments launched by the explosion. The latter is usually more important, simply because fragments travel further than a blast wave. Every single fragments is like a projectile unto itself, but their size, weight and BC obviously varies, as they are simply fragments of the steel wall of the shell. But even that is not necessarily true, as there are pre-fragmented shell walls (think of a ˝pineapple˝ hand grenade, it looks like a pineapple so that it will break into more uniform fragments), and there are modern shells that use what are basically bearing balls cast into either the explosive itself or into the walls of the shell. With computers we can make all kinds of simulations, but in the end of the day you need actual tests to determine, for example, how many fragments are usually produced on average by a specific kind of shell, what is the chance of hitting a certain sized target a certain distance away from the explosion, and what kind of damage it causes. After all, flesh and metals behave quite differently if they are hit by something.
And speaking of metal, armour penetration is also a complex subject unto itself, with material density, angle of hit, and other nice things. Again, we can model it somehow but in the end of the day this too needs real world testing. Again, we are in luck, because it's usually compiled into nice tables that tell you how much RHE (rolled homogenous armour equivalent) a certain gun penetrates at a certain distance. And the armour of modern tanks is usually given in RHE too, despite being significantly different from RHE. But that's usually not the case with ww2 tanks, and for those angled armour is already a big enough complication that people usually just rely on real-life data to know what kind of gun could knock out what kind of tank at a given distance. If you want to see some formulas, then this is an interesting read, but keep in mind that it only works with ww2 warships, and not with tanks and whatnot:
>I want to write a program for video games (not simulators) that gives me plausible values of how much damage a ammunition type does and the associated cannon weapon
I think you should look still take a look at simulators. Or if you are not autistic enough for that, then just watch some gameplay of War Thunder to see a damage system that is (supposed to) model damage in a relatively realistic fashion.