• 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!

Realistic Guns?

"Can I store the position of the firing ship to some `ship-specific` variables every time it fires?"

Sure. You can do it from either void Ship_FireAction() in AIShip.c or void Ball_AddBall() in AIBalls.c

I suggest the latter as I'm not certain the former is used in every instance when a ship fires.

Add a block of code like so (assuming we're using Ball_AddBall)
{and note I don't add Y pos, but you can (and make the calcs 3D) if you _really_ want to... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />, and that I add Y angle, for below.)
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    aCharacter.lastfiredpos.x = aCharacter.ship.Pos.x;

    aCharacter.lastfiredpos.z = aCharacter.ship.Pos.z;

    aCharacter.lastfiredpos.ay = aCharacter.ship.Ang.y;<!--c2--></div><!--ec2-->

Then you can check that anywhere you have a reference to whose cannonball the ball you're operating on is (which is LastBallCharacter, I believe).
---
For quadrants you use the same stuff only you check both ships and do some trig: first render the enemy ship's coordinates into those based on the firing ship's position and axis (using vector change of base--is that what it's called when you make one vector use as axes another pair?--formulae which I'd need to look up), then check which of X and Z are positive.
It's probably quicker another route, but that makes the (final) comparison easiest.
Then do your deflection check.
---
Re: integration. Mwahaha, yes. Thank you, WinMerge.

Regarding toggleability. I would certain suggest that as worthwhile, but I think you're right in terms of making _everything_ toggleable.
So why not just the speed and angle changes, and leave the rest (new calibers, ricochets, etc.) `always-on`.
---

Cat: MATH! YAY!
 
Hey, another thing.

If you want to be _really_ tricky... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
In Ball_AddBall(), detect what arc the gun is firing from by comparing ball direction vs. ship Y angle (or compare aiball x and z vs. ship x and z, though the former method is probably better), and then set the AIBalls.Type to something that says both the good _and_ the angle.
I.e. use a bitmask, with 00 determining the ball type and the second 00 determining the angle. Balls from the fore chasers=0000 (0), grape from the starboard broadside 1001 (9), and so forth.

Then decouple the bits whenever you check the ammo type of an incoming ball.
 
Ehhh, the bitmasks are a bit much. Vector change of base looks like the way to go, but it means I'm going to have to brush up on my linear algebra in order to do this.

Just so I'm getting this straight: I have to use the firing ship as the origin and redifine the `x-axis` to be in the direction the firing ship is pointed. Then I have to use some trigonometry to get the position of the target ship relative to the firing ship in polar coodinates. Then I decide on whether or not the target is being hit by chasers based on what quadrant [theta+pi/4] is in (first/third quadrants = chasers). *Then* I scale the damage using the absolute value of the dot product of unit vectors representing the directions of the ships, with different functions for tracers and broadsides.

You'll excuse me if I don't start on this right away? I'm not entirely sure how to go about step #1, and I've got midterms to focus in on in the next couple of weeks.

Once I have some free time (and I finish KoTOR II), I'll probably start back up on this. Until then, anyone's free to try to get this working.
 
Actually, I'm warming more and more to the `modify-the`-type route, because you can also add `caliber-specific` (`damage-multiplier`-specific) info to the type that way, and because the math is far faster because it's only a straight check: fire angle vs. ship angle.

And rather than encode quadrant, let's do the full angle. That way when calcing damage, you just read that angle from the type attribute and do the `is-perpendicular` check there, no need to check original ship angle.
Heck, include the ship's xz coords too. All comma separated and use a comma parser to strip the components.

OK, let me see if I can add that on top of yours.
Good luck with exams! (and KoTOR...). <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" /> Great work, KNB, all I asked for was a simple answer and what do I get? A whole download <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_praise.gif" style="vertical-align:middle" emoid=":bow" border="0" alt="icon_praise.gif" /> .

Talking about downloads, <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/oops3.gif" style="vertical-align:middle" emoid=":eek:ops2" border="0" alt="oops3.gif" />, Catalina, mind to mail me KNBs zip file? My ftp problem...
 
<!--`QuoteBegin-alan_smithee`+--><div class='quotetop'>QUOTE(alan_smithee)</div><div class='quotemain'><!--QuoteEBegin-->If reloading times are increased, can we also increase chances of crippling a ship's hull or riggings? I already play at `triple-speed` as it is, as the ships dance around one another firing `pot-shots` for hours on end without inflicting an iota of damage. bah.

And great to see you back, KNB.[/quote]

Sorry for double- posting, but I just realized this.
Yes, you can change the amount a certain sort of ammo does, however, it´s not in one of the PROGRAM files but in an .ini, I´ll look it up ASAP. There are the "base damages" of the ammo types, which are modified according to gun caliber in the cannon_init.c and in AIShips.c.
 
talking about guns...

It is possible to have a switch in buildsetting.h to toggle completely on/off the bombs from the game?

Until we will have some mortars, they are completely unrealistic, at least for ships... so...

Maybe the forts can keep the bomb, it will add to their strengh and are more logical firend by them.

Thanks!
 
Good... though it's not just `per-ball` damage I'm thinking of, but random events, like dismasting, destroying ("splitting") sails, (and like I say this could require you to stop everything, like a firedrill, to replace your sails during combat), maybe a lucky shot to the powder room, that sort of thing.

Speaking of powder... any chance to work the need for that into ammo tweaks?
 
dHerblay, re bombs, I think KNB was talking about converting them into heated shot...

Alan: re powder ammo, 6shoota was working on it; I don't know what happened to him, he seems to have diappeared...but it's certainly possible to make that.
Re: crits. Mast falls can only be triggered by DLL as far as I know; sail damage I _think_ can be created via script but I'm not sure; a single `blow-up`-everything crit _is_ totally possible.
 
Nathan: I know about heated shots but those kind of ball wasn't used on ships because it's was too dangerous... See Horatio Hornblower for details. But, for forts, bombs as well as heated shot are completely right! Anyway, I was just suggesting something to be toggled or not.
 
Sorry, I spoke incompletely. What I meant was that it was my understanding that he was not only converting them into heated shot but restricting them to forts.

But toggleable is even better, yes. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
<!--`QuoteBegin-v_Grimmelshausen`+--><div class='quotetop'>QUOTE(v_Grimmelshausen)</div><div class='quotemain'><!--QuoteEBegin-->Talking about downloads,  :eek:ops2, Catalina, mind to mail me KNBs zip file? My ftp problem...[/quote]Ah yes, thanks for reminding me, sorry I didn't get online here until late. It's on its way. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />
 
KNB, could it be that some of your files got screwed up in editing? Not all of them, but the following ones:
- Shipsinit.c
- CharactersUtilite.c
- Officers.c
- AIShips.c

If I open these files, there are no line switches, but the whole content runs like common text, where the line should change there´s a small rectangle symbol. I don´t know wheter they still work, I haven´t tested, but for reading and working on them, that´s terribly exhausting.
 
They should definitely work.

The problem is that there are two different characters that indicate a line break/carriage return (or something like that). Notepad only reads one of them as a line break and displays the other as a null character (the black rectangle). It's been like this with Notepad as long as I can remember, even though almost every other text editor will display it correctly.

To "fix" it, open the files in windows *Wordpad*, immediately save, and exit. Wordpad automatically converts the carriage returns to the format Notepad likes when it saves plain text files.

I use Textpad for everything, so I don't know if the files were like this from the beginning or if they got changed around when I zipped them (which often happens -- who knows why. (mac compatibility?)). It's not really a problem, it's just completely baffling as to why Notepad still does this after 10+ years.
 
Heh, because Notepad hasn't changed in ten years! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />

I use a hex editor/text editor for all my coding, even html sometimes. UltraEdit is terrific... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Heh, because Notepad hasn't changed in ten years!<!--QuoteEnd--></div><!--QuoteEEnd-->
Why, at least, most of the time it WORKS, and there´s much to be said for that - more than can be said about a lot of other and more expensive programs.
 
Another case of "If it ain't broke, don't fix it!" <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="icon_wink.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
Just a detail KNB. In Cannons_init should it be:

Cannon_caliber_ max = 9;
Carr 68 missing in that list?
 
Actually, no.

There are no guns with a caliber of 68. All carronades use an internal caliber of (roughly) half the diplay caliber. For example, the 18pdr carronades use an internal caliber of 9; they display as 18pdrs (and I calculated damage assuming an 18 pound projectile), but they are mountable in place of 9pdr guns. The 68s are likewise treated as 32pdrs ingame, except the player just isn't allowed to buy and mount `seventy-odd` 68pdr carronades on a Battleship. I only added them because a couple people were complaining about forts being easy... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/dev.gif" style="vertical-align:middle" emoid=":d:" border="0" alt="dev.gif" />

As I remember it, that array is only used for giving pirate ships bigger guns, anyway. The game reads "pirate cannon multiplier = 1.5" as "pirates get the next higher maxcalibur in the Cannons_init array." In fact, if you put 42.5 for the multiplier it would do the exact same thing. As 68pdrs are treated as 32s, they are already mountable on anything that can mount 32 pounders (or would be, if they were buyable in the shipyard).

You can go ahead and add it in anyway, if you want, it won't do anything.
 
I guess it should...

I´ve made some new sounds for the cannons. There will be two versions: one for the KNB realistic cannons, 14 types, and one for the original 7 types.
 
Back
Top