Skip to content

Commit d7d78dc

Browse files
committed
Automatic merge of T1.6-106-gdcc176472 and 12 pull requests
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window - Pull request #1091 at 492795a: Automatic speed control - Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing - Pull request #1121 at 91d2d26: Manually Override Articulation - Pull request #1124 at e241a0d: Built-in PBL2 brake controller - Pull request #1157 at 39cd994: Dynamic brake authorization by TCS - Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler - Pull request #1161 at 6cfe4e2: Fix string trim in .ini files - Pull request #1162 at 2516cce: specifies precedence of DDS over ACE - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1128 at 086d502: Particle Emitter Overhaul - Pull request #1160 at 9dc6b3b: Route Based TTrack Sounds
14 parents 20a4167 + dcc1764 + f46d5f2 + 492795a + ba3c47f + 91d2d26 + e241a0d + 39cd994 + 48c9a63 + 6cfe4e2 + 2516cce + 5845a1a + 086d502 + 9dc6b3b commit d7d78dc

File tree

9 files changed

+213
-152
lines changed

9 files changed

+213
-152
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 93 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,9 +2443,9 @@ OR supports the following special visual effects in a steam locomotive:
24432443

24442444
OR supports the following special visual effects in a diesel locomotive:
24452445

2446-
- Exhaust (named ``Exhaustnumber``) -- is a diesel exhaust. Multiple exhausts can
2447-
be defined, simply by adjusting the numerical value of the number after the key
2448-
word exhaust.
2446+
- Exhaust (named ``Exhaustnumber``, eg: ``Exhaust2``) -- is a diesel exhaust. Multiple
2447+
exhausts can be defined, simply by adjusting the numerical value of the number after
2448+
the key word Exhaust.
24492449

24502450
OR supports the following special visual effects in a wagon (also the wagon section of
24512451
an ENG file):
@@ -2474,16 +2474,16 @@ Each effect is defined by inserting a code block into the ENG/WAG file similar t
24742474
the one shown below::
24752475

24762476
Cylinders11FX (
2477-
-1.0485 1.0 2.8
2478-
-1 0 0
2479-
0.1
2477+
Comment ( Required parameters. )
2478+
ORTSPosition ( -1.0485m 1.0m 2.8m )
2479+
ORTSInitialVelocity ( -1 0 0 )
2480+
ORTSParticleDiameter ( 0.1m )
24802481

2481-
Comment ( ORTS parameters come after MSTS data! )
2482+
Comment ( Optional parameters. )
24822483
ORTSPositionVariation ( 0m 0m 0m )
2483-
ORTSInitialVelocityVariation ( 0.1 0.1 0.1 )
2484-
ORTSEmissionSpeedLimit ( 150m/s )
2484+
ORTSInitialVelocityVariation ( 0.1 )
24852485
ORTSFinalVelocity ( 0 1m/s 0 )
2486-
ORTSFinalVelocityVariation ( 0.75m/s 0.75m/s 0.75m/s )
2486+
ORTSFinalVelocityVariation ( 0.75m/s )
24872487

24882488
ORTSLifespanMultiplier ( 1.0 )
24892489
ORTSLifespanVariation ( 0.5 )
@@ -2495,24 +2495,22 @@ the one shown below::
24952495
ORTSRotationVariation ( 0.25 )
24962496
ORTSWindMultiplier ( 1.0 )
24972497
2498+
ORTSParticleOpacity ( 1.0 )
24982499
ORTSPipeArea ( 0.03m^2 )
2499-
ORTSMaxParticles ( 2500 )
25002500
ORTSRateMultiplier ( 1.0 )
25012501
ORTSUseChaoticRandomization ( false )
2502-
2502+
2503+
Comment ( Advanced optional parameters. )
2504+
ORTSMaxParticles ( 2500 )
2505+
ORTSEmissionSpeedLimit ( 150m/s )
25032506
ORTSGraphic ( "smokemain.ace" )
25042507
ORTSGraphicAtlasLayout ( 4 4 )
25052508
)
25062509

2507-
The code block consists of the following elements:
2508-
2509-
- Effect name -- as described above,
2510-
- Effect location on the locomotive (given as an x, y, z offset in metres
2511-
from the origin of the wagon shape)
2512-
- Effect direction of emission (given as a normal x, y and z)
2513-
- Effect nozzle width (in metres)
2514-
25152510
.. index::
2511+
single: ORTSPosition
2512+
single: ORTSInitialVelocity
2513+
single: ORTSParticleDiameter
25162514
single: ORTSPositionVariation
25172515
single: ORTSInitialVelocityVariation
25182516
single: ORTSEmissionSpeedLimit
@@ -2530,42 +2528,51 @@ The code block consists of the following elements:
25302528
single: ORTSMaxParticles
25312529
single: ORTSRateMultiplier
25322530
single: ORTSUseChaoticRandomization
2531+
single: ORTSParticleOpacity
25332532
single: ORTSGraphic
25342533
single: ORTSGraphicAtlasLayout
25352534

2536-
After including these settings, additional *optional* parameters unique to OR can
2537-
be included to further customize effect emitters:
2535+
While there are many parameters available to customize the appearance and behavior of emitted particles, most are set
2536+
to reasonable values by default and should be considered optional unless further customization is desired. The only
2537+
*required* parameters are as follows:
2538+
2539+
- ``ORTSPosition ( x y z )`` -- REQUIRED parameter which defines the (+/-) right/left, up/down,
2540+
forward/backward location of the emitter (in meters by default, other units are accepted)
2541+
- ``ORTSInitialVelocity ( x y z )`` -- REQUIRED to define the (+/-) right/left, up/down, forward/backward
2542+
components of emission direction (no units of measure, the particle speed is multiplied by
2543+
this vector to determine the 3D velocity of particles. Speed can be divided by inserting values
2544+
less than 1, or multiplied by inserting values greater than 1.)
2545+
- And ``ORTSParticleDiameter ( d )`` -- REQUIRED to set the nozzle width (default units meters, other units accepted),
2546+
which sets the initial size of each particle
2547+
2548+
The *optional* parameters unique to OR are as follows:
25382549

25392550
- ``ORTSPositionVariation ( x y z )`` -- Specifies the amplitude of random variation
25402551
in the right/left, up/down, and front/back emission location of a particle (default units
25412552
are meters). Useful for non-circular exhaust ports, as it allows one particle emitter
25422553
to be used to spawn particles from an area, rather than a single point. Note that
2543-
``ORTSPositionVariation ( x y z )`` would allow particles to emit 1 meter right and
2554+
``ORTSPositionVariation ( 1 0 0 )`` would allow particles to emit 1 meter right and
25442555
1 meter left of the initial position, for a total variation of 2 meters. Similar is
25452556
true of all other parameters related to randomness, the total variation is double what's
25462557
specified. Feature is disabled by default.
2547-
- ``ORTSInitialVelocityVariation ( x y z )`` -- Defines the randomization of initial particle
2548-
velocity in the right/left, up/down, and front/back directions, as a function of the
2549-
particle's initial speed (values are unitless). The default value is ( 0.1 0.1 0.1 ),
2550-
meaning the speed in each direction can be increased or decreased by 10% of the initial
2551-
particle speed. Larger values make the particle exhaust seem less directed and more diffuse.
2552-
- ``ORTSEmissionSpeedLimit ( v )`` -- Some particle emitters are driven by the simulated flow
2553-
rate of exhaust, which has to make some assumptions about the pressure and volume of exhaust.
2554-
This can lead to unrealistically high speed particles being emitted, so a speed limit can be
2555-
set (default units are meters per second) to keep particle speed reasonable. This is not a hard
2556-
limit, it is gradually enforced as the simulation calculates higher and higher exhaust speed.
2557-
The limit is also applied before considering the emitter velocity factor, so actual exhaust speed
2558-
will vary depending on other settings.
2559-
By default, the limit is 150 meters per second, which will be suitable in most cases.
2558+
- ``ORTSInitialVelocityVariation ( i )`` -- Defines the randomization of initial particle
2559+
velocity in all directions, multiplied by the particle's initial speed (no units of measure).
2560+
The default value is ( 0.1 ), meaning the speed in each direction can be increased or
2561+
decreased by 10% of the initial particle speed. Larger values make the particle exhaust seem
2562+
less directed and more diffuse. Alternately, 3 values can be provided in the format
2563+
``ORTSInitialVelocityVariation ( x y z )`` to specify the initial velocity variation in each
2564+
individual direction.
25602565
- ``ORTSFinalVelocity ( x y z )`` -- Determines the final right/left, up/down, and front/back
25612566
velocity of particles after they have settled (default units of meters per second). The default
25622567
is 1 m/s directly upward, and can be changed to fine tune the appearance of the particle trail
25632568
produced. Note that wind velocity is added to this value afterward.
2564-
- ``ORTSFinalVelocityVariation ( x y z )`` -- Unlike initial velocity variation, final velocity
2569+
- ``ORTSFinalVelocityVariation ( f )`` -- Unlike initial velocity variation, final velocity
25652570
variation determines the amplitude of random variation of final velocity in absolute terms
25662571
(default units of meters per second). The default setting is +/- 0.75 m/s in all directions, but
25672572
changing this can adjust the amount of and shape of particle trail spread. Larger variations
2568-
make for exhaust that seems more chaotic and diffuse.
2573+
make for exhaust that seems more chaotic and diffuse. Similar to initial velocity variation,
2574+
``ORTSFinalVelocityVariation ( x y z )`` can be used to specify the variation in each direction
2575+
individually.
25692576
- ``ORTSLifespanMultiplier ( x )`` -- Multiplies the lifetime of particles emitted from this
25702577
emitter by the given (unitless) value. Particle lifetime varies depending on simulation
25712578
data, but if particles seem to last too long a value less than 1 can be entered here, or a
@@ -2607,20 +2614,16 @@ be included to further customize effect emitters:
26072614
A value of 1 is used by default, such that the wind speed used by the simulation is used directly.
26082615
This can be adjusted to prevent particles that shouldn't be influenced by the wind (eg: cylinder
26092616
cocks close to ground level) from flying off in whatever direction the wind is going.
2617+
- ``ORTSParticleOpacity ( o )`` -- Controls how transparent emitted particles are by multiplying
2618+
texture opacity by the given value (unitless number between 0 and 1). The default setting is 1,
2619+
which doesn't change particle appearance at all. Lower values make particles more transparent,
2620+
until 0 would make all particles invisible.
26102621
- ``ORTSPipeArea ( a )`` -- Niche parameter to adjust the area of the exhaust pipe used by
26112622
the simulation (default units square feet). By default, the area is assumed to be a circle with
26122623
the same diameter as the exhaust particles. However, for non-circular exhausts this can be combined
26132624
with ORTSPositionVariation to give more believable results. Larger areas result in lower exhaust
26142625
speed without changing the number of particles emitted per second, which also allows this to
26152626
be used as a speed multiplier, though ORTSinitialVelocity is preferred for that purpose.
2616-
- ``ORTSMaxParticles ( n )`` -- Override for the maximum number of particles this emitter should
2617-
have in the world simultaneously (unitless integer). The default value is 2500 particles, which works
2618-
in many cases but may not be appropriate in some unusual circumstances. The limit can be reduced
2619-
on less extreme particle emitters to reduce memory use, or can be increased for more extreme emitters
2620-
to prevent particles disappearing and/or the reduction in particle emission rate caused by reaching
2621-
the particle limit. Do NOT increase the limit if particles are already overlapping; it is often
2622-
better to simply reduce the number of particles emitted using ORTSRateMultiplier and/or other
2623-
parameters listed here.
26242627
- ``ORTSRateMultiplier ( x )`` -- Multiplies the number of particles emitted per second by the given
26252628
value (unitless). Values less than 1 reduce the rate of particle emission, while values greater than
26262629
1 increase the rate of particle emission. The particle rate is determined by the simulation, but may
@@ -2630,11 +2633,33 @@ be included to further customize effect emitters:
26302633
- ``ORTSUseChaoticRandomization ( 0/1 )`` -- Changes the randomization algorithm used for positions,
26312634
velocities, durations, and so on to be "chaotic" if given a true or 1 value. Default is false or 0,
26322635
giving "smooth" randomization. With the "chaotic" randomization algorithm, the random changes in
2633-
position/velocity/time are entirely random and do not depend on the random values generated for the
2636+
velocity/momentum/time are entirely random and do not depend on the random values generated for the
26342637
previous particle, resulting in sudden dramatic changes. In comparison, the default "smooth"
26352638
randomziation algorithm changes the random values by a small amount for each iteration. The "chaotic"
26362639
algorithm tends to make exhaust that is more spread out and discontinuous, which may be desireable in
26372640
some cases.
2641+
2642+
The following *advanced* parameters have unusual effects that do not directly influence the motion of
2643+
particles and may only be useful in very specific circumstances. Caution should be taken when using any
2644+
of these to ensure the parameter is used correctly, as improper settings can produce displeasing results
2645+
and poor framerates:
2646+
2647+
- ``ORTSMaxParticles ( n )`` -- Override for the maximum number of particles this emitter should
2648+
have in the world simultaneously (unitless integer). The default value is 2500 particles, which works
2649+
in many cases but may not be appropriate in some unusual circumstances. The limit can be reduced
2650+
on less extreme particle emitters to reduce memory use, or can be increased for more extreme emitters
2651+
to prevent particles disappearing and/or the reduction in particle emission rate caused by reaching
2652+
the particle limit. Do NOT increase the limit if particles are already overlapping; it is often
2653+
better to simply reduce the number of particles emitted using ORTSRateMultiplier and/or other
2654+
parameters listed here.
2655+
- ``ORTSEmissionSpeedLimit ( v )`` -- Some particle emitters are driven by the simulated flow
2656+
rate of exhaust, which has to make some assumptions about the pressure and volume of exhaust.
2657+
This can lead to unrealistically high speed particles being emitted, so a speed limit can be
2658+
set (default units are meters per second) to keep particle speed reasonable. This is not a hard
2659+
limit, it is gradually enforced as the simulation calculates higher and higher exhaust speed.
2660+
The limit is also applied before considering the emitter velocity factor, so actual exhaust speed
2661+
will vary depending on other settings.
2662+
By default, the limit is 150 meters per second, which will be suitable in most cases.
26382663
- ``ORTSGraphic ( "tex" )`` -- Gives the name and path to the texture that should be used to render
26392664
particles from this emitter. The default texture is "smokemain.ace" for steam-type emitters and
26402665
"dieselsmoke.ace" for diesel-type emitters. If the texture cannot be found from the engine's/wagon's
@@ -2652,29 +2677,31 @@ be included to further customize effect emitters:
26522677
rendered as a square. Rectangular textures will be stretched/squished. Do not change the atlas setting unless you
26532678
are certain of the texture used, as improper settings will be very aesthetically unpleasing.
26542679

2655-
2656-
.. index::
2657-
single: ORTSPosition
2658-
single: ORTSInitialVelocity
2659-
single: ORTSParticleDiameter
26602680

2661-
Alternatively, the legacy MSTS data can be skipped entirely and replaced with
2662-
equivalent OR specific parameters. In this case, order of data entry does not
2663-
matter:
2681+
Note that legacy special effects from MSTS and prior versions of OR use different syntax, simply listing
2682+
a series of numbers rather than using named parameters. The order and arrangement of these values is
2683+
critical, and is interpreted in this order:
2684+
2685+
- Effect location on the locomotive (given as 3 values forming an x, y, z offset in metres
2686+
from the origin of the wagon shape)
2687+
- Effect direction of emission (given as 3 values giving a normal x, y and z)
2688+
- Effect nozzle width (a single number given in metres)
2689+
2690+
To make special effect settings easier to understand, it is recommended to use ``ORTSPosition``, ``ORTSInitialVelocity``,
2691+
and ``ORTSParticleDiameter`` to provide these same values. However, if it is desired to continue using the legacy data,
2692+
all ORTS parameters must be entered *after* the legacy numbers, like so::
26642693

26652694
FXName (
2666-
ORTSPosition ( -1.0485m 1.0m 2.8m )
2667-
ORTSInitialVelocity ( -1 0 0 )
2668-
ORTSParticleDiameter ( 0.1m )
2669-
Comment ( Insert other ORTS parameters as desired, but skip MSTS data! )
2670-
)
2695+
-1.0485 1.0 2.8
2696+
-1 0 0
2697+
0.1
2698+
2699+
Comment ( ORTS parameters come after MSTS data! )
26712700

2672-
- ``ORTSPosition ( x y z )`` -- defines the width, height, length location of the emitter (in meters by default)
2673-
- ``ORTSInitialVelocity ( x y z )`` -- defines the (+/-) right/left, up/down, forward/backward components of emission direction
2674-
(unitless, the particle speed is multiplied by this vector to determine the 3D velocity of particles.
2675-
Speed can be divided by inserting values less than 1, or multiplied by inserting values greater than 1.)
2676-
- And ``ORTSParticleDiameter ( d )`` -- gives the nozzle width (in meters by default), which sets the initial
2677-
size of each particle
2701+
ORTSInitialVelocityVariation ( 0.25 )
2702+
ORTSFinalVelocityVariation ( 1.0m/s )
2703+
...etc...
2704+
)
26782705

26792706
Auxiliary Water Tenders
26802707
'''''''''''''''''''''''

Source/Orts.Simulation/MultiPlayer/Message.cs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// COPYRIGHT 2012, 2013 by the Open Rails project.
1+
// COPYRIGHT 2012, 2013 by the Open Rails project.
22
//
33
// This file is part of Open Rails.
44
//
@@ -3695,17 +3695,18 @@ class MSGExhaustItem
36953695
public int iCar;
36963696
public float exhPart;
36973697
public float exhMag;
3698-
public float exhColorR, exhColorG, exhColorB;
3698+
public float exhColorR, exhColorG, exhColorB, exhColorA;
36993699

3700-
public MSGExhaustItem(string u, int n, int i, float eP, float eM, float eCR, float eCG, float eCB)
3700+
public MSGExhaustItem(string u, int n, int i, float eP, float eM, float eCR, float eCG, float eCB, float eCA)
37013701
{
3702-
user = u; num = n; iCar = i; exhPart = eP; exhMag = eM; exhColorR = eCR; exhColorG = eCG; exhColorB = eCB;
3702+
user = u; num = n; iCar = i; exhPart = eP; exhMag = eM; exhColorR = eCR; exhColorG = eCG; exhColorB = eCB; exhColorA = eCA;
37033703
}
37043704

37053705
public override string ToString()
37063706
{
37073707
return user + " " + num + " " + iCar + " " + exhPart.ToString(CultureInfo.InvariantCulture) + " " + exhMag.ToString(CultureInfo.InvariantCulture) +
3708-
" " + exhColorR.ToString(CultureInfo.InvariantCulture) + " " + exhColorG.ToString(CultureInfo.InvariantCulture) + " " + exhColorB.ToString(CultureInfo.InvariantCulture);
3708+
" " + exhColorR.ToString(CultureInfo.InvariantCulture) + " " + exhColorG.ToString(CultureInfo.InvariantCulture) + " " + exhColorB.ToString(CultureInfo.InvariantCulture)
3709+
+ " " + exhColorA.ToString(CultureInfo.InvariantCulture);
37093710
}
37103711
}
37113712
List<MSGExhaustItem> items;
@@ -3714,18 +3715,19 @@ public MSGExhaust(string m)
37143715
{
37153716
m = m.Trim();
37163717
string[] areas = m.Split(' ');
3717-
if (areas.Length % 8 != 0)
3718+
if (areas.Length % 9 != 0)
37183719
{
37193720
throw new Exception("Parsing error " + m);
37203721
}
37213722
try
37223723
{
37233724
int i = 0;
37243725
items = new List<MSGExhaustItem>();
3725-
for (i = 0; i < areas.Length / 8; i++)
3726-
items.Add(new MSGExhaustItem(areas[8 * i], int.Parse(areas[8 * i + 1]), int.Parse(areas[8 * i + 2]),
3727-
float.Parse(areas[8 * i + 3], CultureInfo.InvariantCulture), float.Parse(areas[8 * i + 4], CultureInfo.InvariantCulture),
3728-
float.Parse(areas[8 * i + 5], CultureInfo.InvariantCulture), float.Parse(areas[8 * i + 6], CultureInfo.InvariantCulture), float.Parse(areas[8 * i + 7], CultureInfo.InvariantCulture)));
3726+
for (i = 0; i < areas.Length / 9; i++)
3727+
items.Add(new MSGExhaustItem(areas[9 * i], int.Parse(areas[9 * i + 1]), int.Parse(areas[9 * i + 2]),
3728+
float.Parse(areas[9 * i + 3], CultureInfo.InvariantCulture), float.Parse(areas[9 * i + 4], CultureInfo.InvariantCulture),
3729+
float.Parse(areas[9 * i + 5], CultureInfo.InvariantCulture), float.Parse(areas[9 * i + 6], CultureInfo.InvariantCulture),
3730+
float.Parse(areas[9 * i + 7], CultureInfo.InvariantCulture), float.Parse(areas[9 * i + 8], CultureInfo.InvariantCulture)));
37293731
}
37303732
catch (Exception e)
37313733
{
@@ -3742,7 +3744,7 @@ public void AddNewItem(string u, Train t, int c)
37423744
if (items == null) items = new List<MSGExhaustItem>();
37433745
MSTSDieselLocomotive l = t.Cars[c] as MSTSDieselLocomotive;
37443746
items.Add(new MSGExhaustItem(u, t.Number, c, l.ExhaustParticles.SmoothedValue, l.ExhaustMagnitude.SmoothedValue,
3745-
l.ExhaustColorR.SmoothedValue, l.ExhaustColorG.SmoothedValue, l.ExhaustColorB.SmoothedValue));
3747+
l.ExhaustColorR.SmoothedValue, l.ExhaustColorG.SmoothedValue, l.ExhaustColorB.SmoothedValue, l.ExhaustColorA.SmoothedValue));
37463748
}
37473749

37483750
public bool OKtoSend()
@@ -3769,7 +3771,7 @@ public override void HandleMsg()
37693771
if (t != null && t.Cars.Count > m.iCar && t.Cars[m.iCar] is MSTSDieselLocomotive)
37703772
{
37713773
MSTSDieselLocomotive remoteDiesel = t.Cars[m.iCar] as MSTSDieselLocomotive;
3772-
remoteDiesel.RemoteUpdate(m.exhPart, m.exhMag, m.exhColorR, m.exhColorG, m.exhColorB);
3774+
remoteDiesel.RemoteUpdate(m.exhPart, m.exhMag, m.exhColorR, m.exhColorG, m.exhColorB, m.exhColorA);
37733775
}
37743776
}
37753777
}

0 commit comments

Comments
 (0)