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

steamship sound mock-up

morgan terror

Magnificent bastard
Storm Modder
Public Relations
yesterday i came up with an idea to implement proper sound for the paddlesteamer's engine. as know hardly any C++, i thought i'd write it down in text, but you get the idea. the idea is that as you pick up speed, you'll hear the engine running faster as well.

code:

if ship is not 'paddlesteamer',

(existing code for sailing sound effects)

{if ship is 'paddlesteamer', and
time is 1x,
{if current speed <12,0
play soundeffect 'chuff' with interval:
([square root](13-speed))/4, and
repeat}

{if current speed is equal to or >12.0,
play soundeffect 'full speed' once, and
play soundeffect 'chuff' with interval 0.25}
}


the interval mentioned above should be taken in seconds. the 'chuff' is the sound of a single stroke of the engine, and the 'full speed' soundeffect might be something that would play once you reach 12 knots. just a little sound for fun, maybe a blow on the whistle or something. the main purpose is preventing the game from trying to take the square root of 0 or less, which is impossible.

the code in bold represents the increase in speed. the reason why i've chosen a formula with a square root is because the engine would then have a quick increase in speed at low speeds, and a slower increase at higher speeds. i've done this because the engine would otherwise (like when it would be a linear increase) be going unrealistically slow at speeds of 4 knots and lower, and way too fast at high speeds. i've assumed that the statistical maximum speed for the ship is 13 knots, including speed upgrades. change the numbers if appropriate. also, i am aware that the forward slash could already have a coding purpose. the 'divide by' function should in that case be replaced by something similar. one important thing of note is that the interval doesn't indicate the time between the ending of the first and the beginning of the second, but the time between the beginnings of the 'chuff'.

the condition that time should be 1x might seem odd, but i've done this because the sound effect would be played annoyingly quickly if you would speed up the game, and potentially cause massive lag. you can try leaving it out, but i'm not sure how well it would go.

additionally, it would be nice to have a puff of smoke every time the 'chuff' is played, which shouldn't be that difficult to add into the above code.
 
That does sound pretty good. If somebody can arrange a sound file,
I can see if I can code it in when I've got that new laptop of mine. :yes
 
i've got all the sounds you'd need. they are part of a longer file though, so the file needs to be cut down to size first, and i don't quite know how.
 
I used to have a sound editing program that I could try at some point.
Annoyingly though, some WAV files, the game will not accept.
Haven't the foggiest how to make it work or not.
Anyway, if you can put the file somewhere, we'll look at figuring it out. :yes
 
allright, here's the files. from full speed, you'll only need the first few seconds i'd think. the bit you'll need for the chuff can be found at the 30 second mark of it's file.
 

Attachments

  • chuff.mp3
    229.9 KB · Views: 108
  • full speed.mp3
    103.2 KB · Views: 136
i've just gotten my hands on the steam frigate in-game, and there's some really odd problems with it. firstly, the smoke is coming from completely the wrong place. secondly, the walkfile is WAY off (but that was to be expected with a custom model). thirdly, the speeds are so wrong i don't even know where to begin. when going with the wind, your speed drops down to almost nothing, but with the wind on the side, you go double the speed of what you're supposed to be capable of! :blink: and i haven't even tried going against the wind yet. this really needs to be fixed before my mod's even started (although it would still work. kinda)
 
When the ship's not making any speed, the smoke does come from the right spot.
However, for whatever insane reason, when the ship starts gathering way,
the spot where the smoke comes from appears to move.
NO idea why it does that.

As for the speeds, the ship IS still a sailing ship and not genuinely steam-powered.
However, she's set up so that the maximum speed is achieved when sailing close to the wind.
This opposed to most other ships that get it with the wind from on the beam or astern.
In the game, THAT is the main advantage of a "steam" frigate.
But if you go straight into the wind, you'll lose your speed anyway.
And your speed is still related to the wind speed too.
It's a tough nut to crack properly. :facepalm
 
i've noticed that the first person camera moves backwards at higher speeds, if that's any help.

i had imagined that the perfect wind conditions would be reversed, but it's still strange that it goes that fast. what i had expected was that the ship simply didn't have a point where it would completely lose speed, but would handle like a sailing ship in any other way. like, 7 out of 12 knots against the wind.

is the factor that determines a ship's ideal wind conditions set up per ship, or are there two conditions you can choose from and then assign to a ship?
 
All the code for the sailing characteristics is in the ships_init.c entry.
Here's the steamship code, which also includes some useful comments:
Code:
//	refShip.TurnRate		= 78;
//	refShip.InertiaAccelerationX	= 4;	refShip.InertiaBrakingX		= 0.5;
//	refShip.InertiaAccelerationY	= 1.95;	refShip.InertiaBrakingY		= 0.5;
//	refShip.InertiaAccelerationZ	= 2.5;	refShip.InertiaBrakingZ		= 2.0;
// Slightly increased maneuvrability from differential thrust options
// Constitution defaults TR = 65, yaw acceleration 1.9
// Ship sits considerably lower in the water due to increased tonnage.

if (!bArcadeMode){
refShip.SpeedRate		= 12.0;
refShip.TurnRate		= 78;
refShip.InertiaAccelerationX	= 4;	refShip.InertiaBrakingX		= 0.5;
refShip.InertiaAccelerationY	= 1.95;	refShip.InertiaBrakingY		= 0.5;
refShip.InertiaAccelerationZ	= 2.5;	refShip.InertiaBrakingZ		= 2.0;
}else{
refShip.SpeedRate		= 12.0;
refShip.TurnRate		= 45;
refShip.InertiaAccelerationX	= 0.2;	refShip.InertiaBrakingX		= 2.0;
refShip.InertiaAccelerationY	= 10;	refShip.InertiaBrakingY		= 4;
refShip.InertiaAccelerationZ	= 4.0;	refShip.InertiaBrakingZ		= 2.0;

}	

// Modified Constitution arcade mode settings	

// Constitution default sails
//	refShip.ClosestPoint = 0.25;
//	refShip.BestPoint = 0.8;

// TESTING - If you use these values the ship will move at 100kts!
//	refShip.ClosestPoint = 0.01;
//	refShip.BestPoint = 0.99;
//	refShip.RigType = sDet;

// Experimental Steam Frigate - due to game engine limitation this is the best compromise. Max speed in broad reach ;semi-wind independent
refShip.ClosestPoint = 0.10;
refShip.BestPoint = 0.8;
refShip.RigType = "Xeb";

// Movement unaffected by wind - sails fastest INTO the wind (Flying Dutchman)
//	refShip.ClosestPoint = 0.01;
//	refShip.BestPoint = 0.01;
//	refShip.RigType = sDet;
Speedrate defines the speed, but apparently is neither the maximum nor the minimum speed.
ClosestPoint is the closest the ship can sail to the wind in radians (I think; unless it's a 0.0-1.0 scale).
BestPoint is the angle of wind where the ship will sail the fastest.
Theoretically this would give the best results:
Code:
// TESTING - If you use these values the ship will move at 100kts!
//	refShip.ClosestPoint = 0.01;
//	refShip.BestPoint = 0.99;
//	refShip.RigType = sDet;
ClosestPoint is as small as possible, so you can sail very close to the wind, while BestPoint is almost 1, which supposedly is with the wind dead astern ("steam assisted propulsion"). However, as per the comment, the game doesn't quite understand this and it ends up with weird results and the ship going 100 kts in some cases. I recall testing this myself and it really was bizarre.

This is the used code:
Code:
// Experimental Steam Frigate - due to game engine limitation this is the best compromise. Max speed in broad reach ;semi-wind independent
refShip.ClosestPoint = 0.10;
refShip.BestPoint = 0.8;
refShip.RigType = "Xeb";
It's the same idea as the testing code, but with the values decreased to prevent the game from going completely nuts with those 100 kts speeds.

For the smoke stack issue, here's the code used for that:
Code:
 // PB: Steam Ships -->

// Stack 1 = coal furnace exhaust
refShip.steamship = true;
refShip.stack1X = 0; // Width
refShip.stack1Y = 4.5; // Height
refShip.stack1Z = 4.5; // Length

// Smokestack 2 - boiler steam release
refShip.stack2X = 4.5; // Width
refShip.stack2Y = 2.5; // Height
refShip.stack2Z = 2.5; // Length

//SWS Prop Wash
refShip.prop1X = 6; // Width
refShip.prop1Y = 0; // Height
refShip.prop1Z = -1.5; // Length

refShip.prop2X = -6; // Width
refShip.prop2Y = 0; // Height
refShip.prop2Z = -1.5; // Length
// PB: Steam Ships <--
These are simply the x,y,z coordinates from where the particle effects originate. The particles are generated at the x,y,z coordinates of the ship in the game world, but shifted so they don't originate at the ship's (0,0,0) point, but from the intended point.
 
what i find very odd is that although the ship's stats aren't even that different from any other ship, it's speed is way higher above it's statistical speed than of any other ship. there must some other factor involved here. maybe there's some kind of parameter that calculates a force vector for the pressure on the hull? if bestpoint would be 0.99, there would be a tiny angle of wind which would make the vector really big, causing the ridiculous speeds.

i've also noticed that the steam ship doesn't go backwards when sailing right into the wind. might be becuase the situation can't get bad enough for it to happen.

the smokestack code clearly doesn't mention anything about momentum, so i'm guessing it's related to the smokestack particle effect itself.

oh, and every pirate ship in a pirate hunting mission is now a steam frigate for some reason.
 
I do think it's some sort of a vector thing.
I also think the game doesn't quite understand that the BestPoint and ClosestPoint are so very different.

Can anyone else confirm that all pirate hunting ships are steamships?
I'm not aware of there being any reason to cause that! :shock
 
Maybe there's some code that tries to select an enemy ship for you,
can't find it, and returns the player ship.
There's some code like that in random encounters,
resulting in me encountering the Black Pearl in encounters. :facepalm
 
i've seen the black peal in encounters too, but only with the vanderdecken curse on me. it's sails are missing though.
 
Sails missing? Did you install Build 14 Beta 1 Patch 1?
I made a mistake with the sails in the Build 14 Beta 1 Full installer. :facepalm

The Vanderdecken "curse" is a simple model and name swap and not related to ships.
Was your player ship the Black Pearl at that time too?
 
yeah, i'd figured that out by now. installed the fix.

nope. also, every ship i encountered started attacking me. it got fixed if i talked to the guy twice.
 
Your character model swaps back again then, yes.
But still I don't know what that has to do with ships at sea! :shock
 
patch, fix, whatever. i installed it.

i've noticed that the jackass bark can sail almost directly into the wind. where are those steamship parameters located? i want to fiddle around with them a bit.
 
Back
Top