• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Making chainshot better

LarryHookins

Buccaneer
Staff member
Storm Modder
Have you ever noticed that chainshot really doesn't work very well in the game? I've been working on the code to find out why and have come up with a few things.

The first thing we did was increase the range a bit, which is already in the build. At least you can fire manualy and expect to have some target effect now.

But automatic fire is pretty abysmal. I found a lot of instances where larger ships were given the same height numbers as smaller ships in the ships_init file, so autoaimed chainshot would always hit too low on these. Initial tweaks were to simply multiply the aiming height values by a set factor, but that wasn't working either, even after changes to the ships_init file.

So I had a look at the code where the aiming point is calculated. I couldn't figure out what the programmers intended until I had a quick look at the original game code, which was dirt simple. Height.Knippels.Y was how high on the target the guns aimed, and Height.Knippels.DY was the variance, such that the shot would hit between Y-DY and Y+DY randomly. The Y and DY variables are in yards.

Ok, that's simple enough, but with USE_REAL_CANNONS you'd still end up firing your guns almost straight up if you were right next to a larger enemy ship. That was the reason the Cannons_GetFireHeight() function was changed by previous modders. Unfortunately, it looks like they tried to add a range test, then started tweaking numbers until they got an effect they wanted, and the final result makes no sense. I have no idea what effect DY actually has with the current code. And it looks like the cannon ranges are given in feet, while everything else is in yards, making the calculations that much further off because that didn't seem to be taken into account.

So I simplified it again, using the original effect of Y plus or minus DY, then adjusted for minimum range and maximum elevations on the guns (5 degrees for real cannons). I'm also using the boxsize.y value for the actual target ship height (for chainshot) instead of the incorrect Y and DY values from ships_init, so that even if the numbers are wrong in ships_init the game will still fire at sails properly. I've calculated a minimum range for the firing height, based on the max elevation of the cannons (depending on the USE_REAL_CANNONS settings), and if you're under the minimum range your cannons will aim lower.

The final effect is that chainshot is now quite lethal. At least for sails. If an enemy ship decides to use chainshot against you, expect to take considerable sail damage at higher difficulties. I've seen sail values as low as 18% on enemy ships before they surrendered. It's not difficult to get enemy sails down to around 30%, and it's amusing to note that an enemy will surrender the instant your guns are loaded and ready to fire.

A side effect of changing the code is that roundshot will generally hit the hull now, instead of right on the waterline with half the shot missing. I've still got some tweaking and testing, but at least I can justify the math now.

We may end up having to tweak the overall damage multipliers to account for better aiming, but I think that's already in the user settings so it shouldn't be too difficult.

Hook
 
I believe the idea of the Realistic Cannons Mod was to make the cannonballs fly according to real-life physics. I'm not sure how well the original modder managed to accomplish that. If I have to choose between best physics or best gameplay, I would choose the latter.

Would this be Build 13 or Build 13.1 content?

<!--quoteo(post=161506:date=Sep 14 2006, 06:55 AM:name=Hook)--><div class='quotetop'>QUOTE(Hook @ Sep 14 2006, 06:55 AM) [snapback]161506[/snapback]</div><div class='quotemain'><!--quotec-->
A side effect of changing the code is that roundshot will generally hit the hull now, instead of right on the waterline with half the shot missing.<!--QuoteEnd--></div><!--QuoteEEnd-->
That is better than what it's doing right now. I hate the cannonballs hitting the waterline just in front of the enemy ship. <img src="style_emoticons/<#EMO_DIR#>/diomed.gif" style="vertical-align:middle" emoid=":dio" border="0" alt="diomed.gif" />
 
<!--quoteo(post=161513:date=Sep 14 2006, 04:44 AM:name=Pieter Boelen)--><div class='quotetop'>QUOTE(Pieter Boelen @ Sep 14 2006, 04:44 AM) [snapback]161513[/snapback]</div><div class='quotemain'><!--quotec-->
I believe the idea of the Realistic Cannons Mod was to make the cannonballs fly according to real-life physics. I'm not sure how well the original modder managed to accomplish that. If I have to choose between best physics or best gameplay, I would choose the latter.

Would this be Build 13 or Build 13.1 content?
<!--QuoteEnd--></div><!--QuoteEEnd-->

I'd consider this a bug fix, but it may alter game balance a bit. I just had my sloop dismasted twice in a row by a light frigate. I've only been dismasted once before in the game. I believe the frigate was firing roundshot.

I like the real life physics as well. This doesn't mess with the physics, but is better than having shot that only hits where you want if the target is exactly half the range of your guns. It was trivial to use a formula:

MinRange = Y / tan(Degree2Radian(5));

... to determine how high you can aim. Maybe boal (author of this part of the mod) didn't know trig. Then if range is less than MinRange, multiply Y by (range / MinRange).

I've spent the last 6 hours making balls and chains work the same way. We can eventually eliminate the Height.Y and Height.DY from the ships_init.c file for the various ammo types.

You know what's really bad? I realized I'd been playing the game and working on fixing the chainshot aiming point for almost 24 hours straight. I only stopped when I did because I had to go see a doctor. (Scheduled appointment, not as bad as that sounds at first. <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> )

Hook
 
<!--quoteo(post=161522:date=Sep 14 2006, 12:57 PM:name=Hook)--><div class='quotetop'>QUOTE(Hook @ Sep 14 2006, 12:57 PM) [snapback]161522[/snapback]</div><div class='quotemain'><!--quotec-->
You know what's really bad? I realized I'd been playing the game and working on fixing the chainshot aiming point for almost 24 hours straight. I only stopped when I did because I had to go see a doctor. (Scheduled appointment, not as bad as that sounds at first. <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> )
<!--QuoteEnd--></div><!--QuoteEEnd-->
Hehe. I wouldn't recommend you to do that though. You might get waaay tired or fed up. <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Hehe. I wouldn't recommend you to do that though. You might get waaay tired or fed up.<!--QuoteEnd--></div><!--QuoteEEnd-->
Hey! .... well, pieter does have a point.

Its nice to see those cannons finally being worked on. I never touched them, as my math is nichtzergut. It required a brain to figure out how to make them better.
 
When I'm working on something I want to work on, the time just flies. <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> It's not like cleaning up after sloppy coders, it's a lot of fun.

I need to cut the loading times back and find two groups fighting so I can see how well the AI does with the new aiming. Only problem I've seen so far is that chainshot sometimes fires way too high... I could lower the aiming point or reduce the variation in the shot, but both ways would end up putting chainshot through existing holes in sails. <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> There may be some oddities with the box size on some ships.

Hook
 
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->There may be some oddities with the box size on some ships.<!--QuoteEnd--></div><!--QuoteEEnd-->
Like some modder not setting the z height properly in the gm files because they figure "eh, why bother? thats not used"... <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />
 
Back
Top