X, Y, Up, and Down Compression

This is really just a simple question, but one that's dogged me to no end.

It's best that I preface the problem with the statement that I'm bad with math. With that out of the way, suffice it to say I am attempting to assign proper compression values for sprites that I've rendered for my plug-in, and no matter my best efforts, I always seem to be just a few pixels off. No worry, I think, so I change the values by a few pixels here and there. Sadly, the visual effect that occurs is the direct opposite of "desirable".

So, I came to the realization that there is probably some simple math that somebody creating ships has already figured out and that I have not. I'm almost sure that the compression values are pretty much the same assuming that every ship has been rendered from exactly the same overhead angle.

If my ships have been rendered from a 60° angle over the ship (90 being top-down), what compression values should mathematically create the most accurate gun positions? I can always fix x, y, and z by sight alone, but the math behind the compression is driving me to madness.

QUOTE (Delphi @ Aug 17 2010, 07:51 PM) <{POST_SNAPBACK}>

If my ships have been rendered from a 60° angle over the ship (90 being top-down), what compression values should mathematically create the most accurate gun positions? I can always fix x, y, and z by sight alone, but the math behind the compression is driving me to madness.

I would recommend using NovaTools if possible since it shows you where they exit. If not, I'm not sure.

I'm not sure anyone knows for sure how to calculate those values. I don't know if it will help, but this is what MC says regarding up/down compression values:

QUOTE (Mission Computer)

If you have ship sprites that are rendered at an angle, these fields are used to correct for the ships perspective when calculating the weapon exit points (above). If the ship is pointing generally "up" (heading is 0-90 or 270-359) then UpCompressX/Y are used; if the ship is pointing generally "down" (heading is 91-269 degrees) then DnCompressX/Y are used. These values are divided by 100 and then multiplied by the rotated x & y values in the weapon exit point fields to apply a rough correction factor, so values less that 100 will bring the exit points in closer to the ship and values greater than 100 will move the exit points farther out. Experimentation is the best way to learn how this works. Values of zero are interpreted the same as a value of 100, so you can leave this field set to zero if unused.

So basically set some values, decide if the shot is too far or too close to the center, and then alter the values to correct. I also second EVWeb's suggestion of using NovaTools if at all possible as it will save time in the sense you won't need to load up EVN for each try and then quit again if you got the values wrong or if you need to do it again for another ship.

I did it by checking the positions of 0°, 90°, 180° and 270°. The two main ones I used were 0 and 90, because that gives you a pretty accurate first rendering.

Basically, say the 0° position of one gun is (40,50). Say the 90° position for the same gun is (59,49) (don't forget the values will be reversed, given that the axis changes). You can easily figure out that you need to expand the X values by 100% / 400 for each degree (there are 90 degrees of change, 40 pixels to start with, and we're adding 1 pixel (1/40th of the base pixels) per 10 degrees), i.e. 0.25%, and that at 90 degrees, the X position (Y in this case, given the reversal of values) is therefore 122.5% (100% + 90*0.25).
I can't remember the actual computation to figure out the final "UpCompressX/Y/…", but that was the basis for my approach to calculating gun points in ARPIA2…

I was unaware that other tools didn't use a graphical interface for finding those points; thus I will third using NOVAtools + resedit, assuming you've still got os 9 lying around. I know you can find both somewhere, and I think I've found them somewhere in the bowels of David Arthur's site.

My method always was to set the positions of the guns along the length of the ship when it was facing straight right-left and check to see that they were the same when left-right (y values?). Then, I set the up-down compress for the ship facing up and check that it works facing down. Then I set the values across the ship (x?) and adjust z values as necessary.

My approach basically makes it so you're trying to set the points along the straightest, non-compressed line, which is usually facing left-right/right-left, and then basing everything else on that, since it is not compressed at all along those points.