posted 10-31- 01:54 PM
Between the double lines is a template for engine damage modeling. I created it for myself as a learning experience, but it is my hope this can be used in part or whole by all plane builders to improve SDOE's realism and enjoyment. I also hope this post can help anyone wanting to learn about damage modeling. This template is built off of the P51D and can be cut and pasted directly into the engine object of any P51D plane. To use this for other planes the parameters will need to be adjusted accordingly. ie the engine horsepower in the "engMaxHP" command will be different as well as the fuel consumption rate in the "engSFC" command and any others specific to an individual plane. The damage probabilities and damage levels may also need adjusting as desired.
This model is a combination of what I felt was the best features of all the engine damage models created thus far. The most important feature of this template is that reaching any given damage level has the possibility of causing more than one type of engine damage. I am not inventing anything new here, just combining the best from WakeupTailgunner, Bjorn, Raider, Laika, Jedi and many others. I appoligize if I have missed anyone.
The damage levels use the obProb function to call the actual damage functions and each damage level has its own set of related damage functions. This allows for simulating increasing damage more easily.
Below this template I have split the commands up into individual sections for ease of understanding and below that section there is a section with explanations under each command. The explanations will be inside of [] symbols.
I hope you all enjoy it! It is really fun to play with all the probabilities to make an engine more rugged or less rugged as you see fit. As a diagnostic tool, you can even change the colors of the smoke for each damage level so you can visually see what damage level has been reached.
Condor out
============================================================================================
(obProto 'CEngine) (engTarget 'prop) (engMaxHP 1720,3000) (engSFC 211) (engFuelSource 'P51D) (engGearRatio 2.1) (obFunc (Cooler (engSFC 211))) (obFunc (RadiatorDmg (obKillDelay 480))) (obFunc (NoFuel (engFuelSource 'none))) (obFunc (SmokeFL1 (obSmokeTrail (smkDiameter .7 smkLifetime 360 smkOrigin 1.7, -1, .7 smkDensity .2 smkColor 250, 235, 255)))) (obFunc (SmokeFL2 (obSmokeTrail (smkDiameter .7 smkLifetime 360 smkOrigin 1.7, 0, .7 smkDensity .2 smkColor 250, 235, 255)))) (obFunc (SmokeFL3 (obSmokeTrail (smkDiameter .7 smkLifetime 360 smkOrigin 1.7, 1, .7 smkDensity .2 smkColor 250, 235, 255)))) (obFunc (SmokeNF1 (obSmokeTrail (smkDiameter .7 smkLifetime 120 smkOrigin -1.7, -1, .7 smkDensity .2 smkColor 250, 235, 255)))) (obFunc (SmokePL1 (obSmokeTrail (smkDiameter 2 smkLifetime 0 smkOrigin 0, -1, 1 smkDensity .4 smkColor 0, 0, 0)))) (obFunc (SmokePL2 (obSmokeTrail (smkDiameter 4 smkLifetime 0 smkOrigin 0, -1, 1 smkDensity .7 smkColor 0, 0, 0)))) (obFunc (SmokePL3 (obSmokeTrail (smkDiameter 7 smkLifetime 0 smkOrigin 0, -1, 1 smkDensity 1 smkColor 0, 0, 0)))) (obFunc (PowerLoss1 (obProb ( 15 (engMaxHP 1720, 2900) 20 (engMaxHP 1720, 2800) 30 (engMaxHP 1720, 2700) 35 (engMaxHP 1720, 2650) )))) (obFunc (PowerLoss2 (obProb ( 15 (engMaxHP 1720, 2600) 20 (engMaxHP 1720, 2500) 30 (engMaxHP 1720, 2400) 35 (engMaxHP 1720, 2350) )))) (obFunc (PowerLoss3 (obProb ( 15 (engMaxHP 1720, 2300) 20 (engMaxHP 1720, 2266) 30 (engMaxHP 1720, 2233) 35 (engMaxHP 1720, 2200) )))) (obFunc (FuelLeak (obProb ( 15 (engSFC 300) 20 (engSFC 375) 30 (engSFC 450) 35 (engSFC 525) )))) (obFunc (FuelLeak2 (obProb ( 15 (engSFC 600) 20 (engSFC 675) 30 (engSFC 750) 35 (engSFC 825) )))) (obFunc (FuelLeak3 (obProb ( 15 (engSFC 900) 20 (engSFC 975) 30 (engSFC 1050) 35 (engSFC 1125) )))) (obHidden) (obFireResistant 15) (obFunc (smallExplosion (obExplode 0.15 2))) (obFunc (smallFire (obSmokeTrail (smkDensity 1 smkColor 0,50,40 smkOrigin 0,1.9,1.3 obProb ( 19 smkDiameter 0.75) 20 (smkDiameter 1) 20 (smkDiameter 1.25) 20 (smkDiameter 1.5) 20 (smkDiameter 1.75) ) smkFire smkLifetime 40 140)))) (obFunc (Fire (obSmokeTrail (smkDensity 1 smkColor 30,10,0 obProb ( 19 (smkDiameter 2) 20 (smkDiameter 2.25) 20 (smkDiameter 2.5) 20 (smkDiameter 3) 20 (smkDiameter 3.5) ) smkFire smkLifetime 40 140)))) (obDamage (obHits 40 obKillDelay 1 obExplodes .5 21 onDmg 1 (obUnhide 'String2 obProb ( 5 (obExec (Name 'engine Func 'SmokeNF1 Name 'engine Func 'NoFuel) ) ) obProb ( 10 (obExec (Name 'engine Func 'SmokeFL1 Name 'engine Func 'FuelLeak) ) ) obProb ( 4 ( obExec (Func 'smallExplosion) obProb (5 (obExec (Func 'smallFire)))) ) obProb ( 40 (obExec (Name 'engine Func 'SmokePL1 Name 'engine Func 'PowerLoss1)) )) onDmg 2 (obUnhide 'String3 obProb ( 5 (obExec (Name 'engine Func 'SmokeNF1 Name 'engine Func 'NoFuel) ) ) obProb ( 10 (obExec (Name 'engine Func 'SmokeFL2 Name 'engine Func 'FuelLeak2) ) ) obProb ( 4 ( obExec (Func 'smallExplosion) obProb (5 (obExec (Func 'smallFire)))) ) obProb ( 40 (obExec (Name 'engine Func 'SmokePL2 Name 'engine Func 'PowerLoss2)) )) onDmg 3 (obUnhide 'String5 obProb ( 5 (obExec (Name 'engine Func 'SmokeNF1 Name 'engine Func 'NoFuel) ) ) obProb ( 10 (obExec (Name 'engine Func 'SmokeFL3 Name 'engine Func 'FuelLeak3) ) ) obProb ( 4 ( obExec (Func 'smallExplosion) obProb (5 (obExec (Func 'smallFire)))) ) obProb ( 40 (obExec (Name 'engine Func 'SmokePL3 Name 'engine Func 'PowerLoss3)) )) onDmg 10 (obNoCollide))) (plus ( phyBoxInertia 1.526300,4.832780,2.615110 phyCG 0.000000,0.000000,0.000000 )) (phyLBS 1650)
============================================================================================
Individually broken out commands section:
********************************************************************************************
(obProto 'CEngine)
(engTarget 'prop)
(engMaxHP 1720,3000)
(engSFC 211)
(engFuelSource 'P51D)
(engGearRatio 2.1)
(obFunc (Cooler (engSFC 211)))
(obFunc (RadiatorDmg (obKillDelay 480)))
(obFunc (NoFuel (engFuelSource 'none)))
(obFunc (SmokeFL1 (obSmokeTrail (smkDiameter .7 smkLifetime 360 smkOrigin 1.7, -1, .7 smkDensity .2 smkColor 250, 235, 255))))
(obFunc (SmokeFL2 (obSmokeTrail (smkDiameter .7 smkLifetime 360 smkOrigin 1.7, 0, .7 smkDensity .2 smkColor 250, 235, 255))))
(obFunc (SmokeFL3 (obSmokeTrail (smkDiameter .7 smkLifetime 360 smkOrigin 1.7, 1, .7 smkDensity .2 smkColor 250, 235, 255))))
(obFunc (SmokeNF1 (obSmokeTrail (smkDiameter .7 smkLifetime 120 smkOrigin -1.7, -1, .7 smkDensity .2 smkColor 250, 235, 255))))
(obFunc (SmokePL1 (obSmokeTrail (smkDiameter 2 smkLifetime 0 smkOrigin 0, -1, 1 smkDensity .4 smkColor 0, 0, 0))))
(obFunc (SmokePL2 (obSmokeTrail (smkDiameter 4 smkLifetime 0 smkOrigin 0, -1, 1 smkDensity .7 smkColor 0, 0, 0))))
(obFunc (SmokePL3 (obSmokeTrail (smkDiameter 7 smkLifetime 0 smkOrigin 0, -1, 1 smkDensity 1 smkColor 0, 0, 0))))
(obFunc (PowerLoss1 (obProb ( 15 (engMaxHP 1720, 2900) 20 (engMaxHP 1720, 2800) 30 (engMaxHP 1720, 2700) 35 (engMaxHP 1720, 2650) ))))
(obFunc (PowerLoss2 (obProb ( 15 (engMaxHP 1720, 2600) 20 (engMaxHP 1720, 2500) 30 (engMaxHP 1720, 2400) 35 (engMaxHP 1720, 2350) ))))
(obFunc (PowerLoss3 (obProb ( 15 (engMaxHP 1720, 2300) 20 (engMaxHP 1720, 2266) 30 (engMaxHP 1720, 2233) 35 (engMaxHP 1720, 2200) ))))
(obFunc (FuelLeak (obProb ( 15 (engSFC 300) 20 (engSFC 375) 30 (engSFC 450) 35 (engSFC 525) ))))
(obFunc (FuelLeak2 (obProb ( 15 (engSFC 600) 20 (engSFC 675) 30 (engSFC 750) 35 (engSFC 825) ))))
(obFunc (FuelLeak3 (obProb ( 15 (engSFC 900) 20 (engSFC 975) 30 (engSFC 1050) 35 (engSFC 1125) ))))
(obHidden)
(obFireResistant 15)
(obFunc (smallExplosion (obExplode 0.15 2)))
(obFunc (smallFire (obSmokeTrail (smkDensity 1 smkColor 60,50,40 smkOrigin 0,1.9,1.3 obProb ( 19 (smkDiameter 0.75) 20 (smkDiameter 1) 20 (smkDiameter 1.25) 20 (smkDiameter 1.5) 20 (smkDiameter 1.75) ) smkFire smkLifetime 40 140))))
(obFunc (Fire (obSmokeTrail (smkDensity 1 smkColor 30,10,0 obProb ( 19 (smkDiameter 2) 20 (smkDiameter 2.25) 20 (smkDiameter 2.5) 20 (smkDiameter 3) 20 (smkDiameter 3.5) ) smkFire smkLifetime 40 140))))
(obDamage (obHits 40 obKillDelay 1 obExplodes .5 21
onDmg 1 (obUnhide 'String2
obProb ( 5
(obExec (Name 'engine Func 'SmokeNF1 Name 'engine Func 'NoFuel) ) )
obProb ( 10
(obExec (Name 'engine Func 'SmokeFL1 Name 'engine Func 'FuelLeak) ) )
obProb ( 4
(obExec (Func 'smallExplosion)
obProb (5
(obExec (Func 'smallFire)))) )
obProb ( 40
(obExec (Name 'engine Func 'SmokePL1 Name 'engine Func 'PowerLoss1)) ))
onDmg 2 (obUnhide 'String3
obProb ( 5
(obExec (Name 'engine Func 'SmokeNF1 Name 'engine Func 'NoFuel) ) )
obProb ( 10
(obExec (Name 'engine Func 'SmokeFL2 Name 'engine Func 'FuelLeak2) ) )
obProb ( 4
( obExec (Func 'smallExplosion)
obProb (5
(obExec (Func 'smallFire)))) )
obProb ( 40
(obExec (Name 'engine Func 'SmokePL2 Name 'engine Func 'PowerLoss2)) ))
onDmg 3 (obUnhide 'String5
obProb ( 5
(obExec (Name 'engine Func 'SmokeNF1 Name 'engine Func 'NoFuel) ) )
obProb ( 10
(obExec (Name 'engine Func 'SmokeFL3 Name 'engine Func 'FuelLeak3) ) )
obProb ( 4
( obExec (Func 'smallExplosion)
obProb (5
(obExec (Func 'smallFire)))) )
obProb ( 40
(obExec (Name 'engine Func 'SmokePL3 Name 'engine Func 'PowerLoss3)) ))
onDmg 10
(obNoCollide)))
(plus ( phyBoxInertia 1.526300,4.832780,2.615110 phyCG 0.000000,0.000000,0.000000 ))
(phyLBS 1650)
********************************************************************************************
Individual commands section with explanations(as best I can):
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(obProto 'CEngine)
[required by sdoe]
(engTarget 'prop)
[required by sdoe]
(engMaxHP 1720,3000)
[engine maximum horsepower-1720 and rpm-3000 settings]
(engSFC 211)
[engine fuel consumption rate]
(engFuelSource 'P51D)
[the engines fuel source object name]
(engGearRatio 2.1)
[engines gear ratio]
(obFunc (Cooler (engSFC 211)))
[this is the Cooler function created by Raider for the new p51d]
(obFunc (RadiatorDmg (obKillDelay 480)))
[the Radiator damage function which causes the engine to stop after 480 seconds]
(obFunc (NoFuel (engFuelSource 'none)))
[No fuel function - shuts off fuel source and engines stops immediately]
(obFunc (SmokeFL1 (obSmokeTrail (smkDiameter .7 smkLifetime 360 smkOrigin 1.7, -1, .7 smkDensity .2 smkColor 250, 235, 255))))
[Function Smoke fuel leak 1. It is called when damage level 1 is reached. It creates a smoke trail with a diameter of .7 feet, a smoke lifetime of 360 seconds, an origin of 1.7 feet to the right, 1 foot backward, .7 feet up from the center of the engine object, a density of 20%, a color which is a light purple. This is the color of high octane fuel in the p51d. The positioning makes it appear there is a stream of fuel leaking from the back of the right exhaust manifold.]
(obFunc (SmokeFL2 (obSmokeTrail (smkDiameter .7 smkLifetime 360 smkOrigin 1.7, 0, .7 smkDensity .2 smkColor 250, 235, 255))))
[same as SmokeFL1 above except the origin is 0 feet forward from the center of the engine
object. The positioning makes it appear there is a stream of fuel leaking from the middle of the right exhaust manifold.]
(obFunc (SmokeFL3 (obSmokeTrail (smkDiameter .7 smkLifetime 360 smkOrigin 1.7, 1, .7 smkDensity .2 smkColor 250, 235, 255))))
[same as SmokeFL1 above except the origin is 1 foot forward from the center of the engine
object. The positioning makes it appear there is a stream of fuel leaking from the front of the right exhaust manifold.]
(obFunc (SmokeNF1 (obSmokeTrail (smkDiameter .7 smkLifetime 120 smkOrigin -1.7, -1, .7 smkDensity .2 smkColor 250, 235, 255))))
[Function Smoke No Fuel 1. It is called when damage level 1 is reached. It creates a smoke trail with a diameter of .7 feet, a smoke lifetime of 120 seconds, an origin of 1.7 feet to the left, 1 foot backward, .7 feet up from the center of the engine object, a density of 20%, a color which is a light purple. The positioning makes it appear there is a stream of fuel leaking from the back of the left exhaust manifold.]
(obFunc (SmokePL1 (obSmokeTrail (smkDiameter 2 smkLifetime 0 smkOrigin 0, -1, 1 smkDensity .4 smkColor 0, 0, 0))))
[Function Smoke power loss 1. It creates a smoke trail with a diameter of 2 feet, a smoke lifetime of forever, an origin of 0 feet to the left, 1 foot backward, 1 foot up from the center of the engine object, a density of 40%, a color which is black. The positioning makes it appear there is smoke in the cockpit. It impairs vision slightly.]
(obFunc (SmokePL2 (obSmokeTrail (smkDiameter 4 smkLifetime 0 smkOrigin 0, -1, 1 smkDensity .7 smkColor 0, 0, 0))))
[Very similiar to SmokePL1 above except the smoke trail is wider and thicker. It impairs
vision to a moderate extent.]
(obFunc (SmokePL3 (obSmokeTrail (smkDiameter 7 smkLifetime 0 smkOrigin 0, -1, 1 smkDensity 1 smkColor 0, 0, 0))))
[Very similiar to SmokePL1 above except the smoke trail is wider and thicker. It impairs vision to a large extent.]
(obFunc (PowerLoss1 (obProb ( 15 (engMaxHP 1720, 2900) 20 (engMaxHP 1720, 2800) 30
(engMaxHP 1720, 2700) 35 (engMaxHP 1720, 2650) ))))
[PowerLoss function. It is called when damage level 1 is reached, it has a 15% probability of lowering the max engine rpm's to 2900, 20% to 2800, 30% to 2700, and 35% to 2650.]
(obFunc (PowerLoss2 (obProb ( 15 (engMaxHP 1720, 2600) 20 (engMaxHP 1720, 2500) 30
(engMaxHP 1720, 2400) 35 (engMaxHP 1720, 2350) ))))
[Very similiar to PowerLoss1 above except it is called during damage level 2 and the range of reduced engine rpm's is lower.]
(obFunc (PowerLoss3 (obProb ( 15 (engMaxHP 1720, 2300) 20 (engMaxHP 1720, 2266) 30
(engMaxHP 1720, 2233) 35 (engMaxHP 1720, 2200) ))))
[Very similiar to PowerLoss1 above except it is called during damage level 3 and the range of reduced engine rpm's is much lower. At 2200 rpm's the plane can barely sustain level flight.]
(obFunc (FuelLeak (obProb ( 15 (engSFC 300) 20 (engSFC 375) 30 (engSFC 450) 35 (engSFC 525) ))))
[Fuel Leak function. It is called during damage level 1. It uses the probability function to randomly assign increased fuel consumption settings. These are minor fuel leaks.]
(obFunc (FuelLeak2 (obProb ( 15 (engSFC 600) 20 (engSFC 675) 30 (engSFC 750) 35 (engSFC 825) ))))
[Very similiar to FuelLeak above except it is called during damage level 2 and the fuel
leaks are moderate.]
(obFunc (FuelLeak3 (obProb ( 15 (engSFC 900) 20 (engSFC 975) 30 (engSFC 1050) 35 (engSFC 1125) ))))
[Very similiar to FuelLeak above except it is called during damage level 3 and the fuel
leaks are much much worse.]
(obHidden)
[hides the engine object from being seen]
(obFireResistant 15)
[makes the engine fire resistant for around 15 seconds - the time seems to vary by the
diameter of the smoke trial created. A smaller smoke diameter creates a smaller fire and therefore the fire takes longer to destroy the engine.]
(obFunc (smallExplosion (obExplode 0.15 2)))
[Function small explosion - this destroys the engine immediately and if set large enough can destroy the plane as well. The obExplode command is using a dynamite equivalent of 0.15 pounds and the explosion is set to display like two pounds of dynamite]
(obFunc (smallFire (obSmokeTrail (smkDensity 1 smkColor 60,50,40 smkOrigin 0,1.9,1.3 obProb ( 19 (smkDiameter 0.75) 20 (smkDiameter 1) 20 (smkDiameter 1.25) 20 (smkDiameter 1.5) 20 (smkDiameter 1.75) ) smkFire smkLifetime 40 140))))
[This is the small fire function. It creates a smoke trail with a density of 100%, color mostly black, with an origin of 0 feet to the right, 1.9 feet forward, 1.3 feet up from the center of the engine object. It inbeds a probability function to determine the diameter of the smoke, then starts the fire with the smkFire command and then sets the smoke lifetime to range randomly between 40 seconds and 140 seconds.]
(obFunc (Fire (obSmokeTrail (smkDensity 1 smkColor 30,10,0 obProb ( 19 (smkDiameter 2) 20 (smkDiameter 2.25) 20 (smkDiameter 2.5) 20 (smkDiameter 3) 20 (smkDiameter 3.5) ) smkFire smkLifetime 40 140))))
[same as smallfire above except larger smoke diameters which cause larger fires.]
(obDamage (obHits 40 obKillDelay 1 obExplodes .5 21
[obDamage is really the start of the damage model. obHits 40 means the engine will take
damage up to a value of 40. Bullets cause a certain amount of damage each, Cannon shells
cause more damage than bullets and fire steadily causes damage up to the point where 40 obhits has been reached. ObHits is a little bit miss named here because 1 bullet does not raise the obHits value by 1 point. Just think of it as a damage measuring variable.
When obHits 40 is reached the engine is killed in 1 second(obKillDelay 1) and it also explodes with .5 pounds of dynamite force and it displays the explosion like 21 pounds of dynamite.]
onDmg 1 (obUnhide 'String2
[damage level one - this is 10% of the obHits value of 40. So, when the obHits value is 4, String2 is unhid and the remaining obProb functions below are run as well. String2 is the visual bullet holes (on the right front of the nose) created by Raider for his new P51d.]
obProb ( 5
(obExec (Name 'engine Func 'SmokeNF1 Name 'engine Func 'NoFuel) ) )
[There is a 5% chance the no fuel and the smoke no fuel 1 function will be executed.
The object "Name" which the "Func 'SmokeNF1" exists in is 'engine.]
obProb ( 10
(obExec (Name 'engine Func 'SmokeFL1 Name 'engine Func 'FuelLeak) ) )
[There is a 10% chance the fuel leak and the smoke fuel leak 1 function will be executed.]
obProb ( 4
(obExec (Func 'smallExplosion)
[There is a 4% chance the small explosion function will be executed.]
obProb (5
(obExec (Func 'smallFire)))) )
[There is a 5% chance the small fire function will be executed.]
obProb ( 40
(obExec (Name 'engine Func 'SmokePL1 Name 'engine Func 'PowerLoss1)) ))
[There is a 40% chance the power loss 1 and the smoke power loss 1 function will be
executed.]
[Damage levels 2 and 3 below are similiar to damage level 1 exception they reference
different bullet strings to unhide and most function have a 2 or 3 after them. The
functions called in damage level 2 and 3 simulate increased engine damage than what is in damage level 1. String3 bullets holes are on the left front of the nose and String5 is towards the left back of the nose.]
onDmg 2 (obUnhide 'String3
obProb ( 5
(obExec (Name 'engine Func 'SmokeNF1 Name 'engine Func 'NoFuel) ) )
obProb ( 10
(obExec (Name 'engine Func 'SmokeFL2 Name 'engine Func 'FuelLeak2) ) )
obProb ( 4
( obExec (Func 'smallExplosion)
obProb (5
(obExec (Func 'smallFire)))) )
obProb ( 40
(obExec (Name 'engine Func 'SmokePL2 Name 'engine Func 'PowerLoss2)) ))
onDmg 3 (obUnhide 'String5
obProb ( 5
(obExec (Name 'engine Func 'SmokeNF1 Name 'engine Func 'NoFuel) ) )
obProb ( 10
(obExec (Name 'engine Func 'SmokeFL3 Name 'engine Func 'FuelLeak3) ) )
obProb ( 4
( obExec (Func 'smallExplosion)
obProb (5
(obExec (Func 'smallFire)))) )
obProb ( 40
(obExec (Name 'engine Func 'SmokePL3 Name 'engine Func 'PowerLoss3)) ))
onDmg 10
[The obHits value of 40 has been reached.]
(obNoCollide)))
[I think this means the engine no longer can be collided with to cause damage.]
(plus ( phyBoxInertia 1.526300,4.832780,2.615110 phyCG 0.000000,0.000000,0.000000 ))
[I believe this is flight modeling stuff. I think the flight model is essentially turned
off here.]
(phyLBS 1650)
[I believe this is also flight modeling stuff.]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[This message has been edited by Condor (edited 10-31-2000).]