![]() |
Doctrine modding guide ?
Could please Amizaur (or somebody else who understand it) put together some basic guide to doctrine language and environment ? I think the language is quite strightforward (except that every minor syntax flaw leads to crash), but what about the game environment ? What is TgtSilos ? What does NEWTRACK exactly do ? And things like this .. does anybody understand this ?
|
Something to get you started...
AUTHOR: Sonalysts Additions: JSteed First a little about how doctrines work: Every platform has a default doctrine assigned by the object database. It can also be specified per platform in the scenario file by the DOCTRINE <filename> command. SC will evaluate this doctrine at regular intervals. Whenever a platform detects a new contact, the platform doctrine is evaluated with "NewTrack" equal to true. Platform doctrine can chose to assign a particular doctrine file to that contact using the SetTactic command. Thereafter, the original platform doctrine continues to be evaluated as before, plus the assigned tactic doctrine is evaluated every time the contact is updated. It's important to understand the distinction: the original platform doctrine is routinely evaluated without a reference solution, except when a new contact is detected. When a new contact is detected, the platform doctrine is called only once referring to the new solution. This is the only opportunity to set a tactic doctrine for that contact. Following are some syntax specifications. Note that neither Sonalysts nor EA will support editing of doctrine files- Sub Command was intended to run with the files as shipped. What you do with them after that is at your own risk. Sub Command doctrine is very particular about whitespace. Everything must be separated by whitespace! Parentheses or brackets not surrounded by spaces or tabs will result in unrecognized terms. Operators: + Addition - Subtraction * Multiplication / Division = Assignment x = y += Addition assignment (e.g. a += b is a = a + b) -= Subtraction assignment as above *= Multiplication assignment as above /= Division assignment as above > Greater than < Less than >= Greater than or equal to <= Less than or equal to == Equal to (numbers only) $= Equal to (strings only, e.g. OwnName $= "Fred") And Boolean and Or Boolean or Not Boolean not & Logical AND (e.g. 255 & 128 == 128) | Logical OR (e.g. 32 | 16 == 48) () Expression delimiters {} Command delimiters Constants: on 1 off 0 true 1 false 0 Math Funcs: rnd <value> Returns a random floating point number between from 0 to <value> abs <value> Returns the absolute value of <value> sqrt <value> Returns the square root of <value> <value1> mod <value2> Returns <value1> modulo <value2> (e.g. 5 mod 3 = 2) RelativeBearing <value1> <value2> Returns the relative bearing from <value1> to <value2> XYBrg <value1> <value2> Returns true bearing from 0,0 to <value1>,<value2> XYRng <value1> <value2> Returns range from 0,0 to <value1>,<value2> Conditionals: If <expression> Then <command> [Else <command>] [ElseIf <expression> Then <command>] EndIf The basic conditional structure is: If <expression> Then <command> EndIf If <expression> evaluates to non-zero, then <command> will be executed. Note that this basic structure only expects one expression and one command- to work with multiple expressions and commands, the expressions must be enclosed by parentheses, and the commands must be enclosed by brackets. For example: If ( <expression1> ) And ( <expression2> ) Then { <command1> <command2> } EndIf There is a also a conditional loop: While <expression> <command> As long as <expression> evaluates to non-zero, <command> will be executed over and over again. Be especially careful- an infinite loop will halt the sim! Note that none of the original doctrines use this structure. Use it sparingly if at all. Special Terms: Var <variablename> You can create as many variables as you like in a doctrine file. All variables are double precision. func <functionname> <command> You can define procedural functions to group commands that might be needed often in larger doctrine files, for example: func Evade { SteerEvasive SetOwnSpd MaxSpeed SetOwnAlt AltLayer } A single command "Evade" will perform all 3 commands. Grouping commands into a function isn't any faster (nor is it appreciably slower), but it can make doctrines more compact and easier to read in some cases. Functions must be defined before they are referenced, and are only available in the doctrine where they are defined. Booleans: Init Automatically set True the first time doctrine is accessed. Thereafter it is set False. NewTrack Platform doctrine will be called with NewTrack true when a new target is detected LostTrack Platform and tactic doctrines are called with LostTrack true when a target is about to be removed Engaging Tactic doctrines are called with Engaging true when a platform is attempting to engage a target (this feature must be enabled in the .ini file) WeaponAway Tactic doctrines are called with WeaponAway true at time of fire Target Terms: TgtBrg True Bearing from platform to target TgtRng Range from platform to target (in yards) TgtCrs Course of target TgtSpd Speed of target (in knots) TgtAlt Altitude/Depth of target, in feet, negative means below sea level TgtX Target X position, in yards from bottom left of map TgtY Target Y position, in yards from bottom left of map TgtID ID of target. Possible values listed below. This is a string value, and must be tested using $=, e.g. IF TgtID $= "HOSTILE" THEN ... TgtClass Class of target. Possible values listed below. This is a string value, and must be tested using $=, e.g. IF TgtClass $= "AIR" THEN ... TgtMissileClass "<value>" Returns true or false based on whether "value" is a member of string expression TgtMissileClass listed below. TgtAOB Target angle on the bow. This is the target's relative bearing from platform's course TgtSILOS Target speed in line-of-sight (closing speed) TgtSource Target sensor source. Possible values listed below. This is a string value, and must be tested using $=, e.g. IF TgtSource $= "Radar" THEN ... TgtAge Time since last detection TgtConf Confidence, 0-100. This level is based on detection strength, and for passive sonar, number of platform legs AttackRng Optimal range to attack target from using best available weapon ThreatRng Optimal range for target to attack platform from using its best available weapon TargetName Target's name. This is a string value, and must be tested using $=, e.g. IF TargetName $= "Asheville" THEN ... AssignedTarget True if the current target is the platform's assigned target (from the mission editor "TargetMode" feature) OwnShip Terms: OwnCrs Platform's course OwnSpd Platform's speed (in knots) OwnAlt Platform's altitude/depth, in feet, negative means below sea level OwnX Platform's X position, in yards from bottom left of map OwnY Platform's Y position, in yards from bottom left of map PeriDepth Platform's periscope depth, in feet MaxSpd Platform's max speed LoiterSpd Platform's loiter speed MinSpd Platform's min speed (0 except for aircraft) MaxAlt Platform's max altitude MinAlt Platform's min altitude Pitch Platform's current pitch, -90 to 90 Alliance Platform's side (0-8) OwnName Platform's name. This is a string value, and must be tested using $=, e.g. IF OwnName $= "Asheville" THEN ... Order Platform's current order. Possible values listed below. This is a string value, and must be tested using $=, e.g. IF Order $= "Track" THEN ... DBCMFlags Bitfield of platform's countermeasure capabilities. Bit values listed below. Use logical operators to test these bit values, e.g. IF DBCMFlags & 1 THEN ... DBTargetFlags Bitfield of platform's target capabilities. Bit values listed below. Use logical operators to test these bit values, e.g. IF DBTargetFlags & 1 THEN ... DBOBjectFlags Bitfield of platform's object attributes. Bit values listed below. Use logical operators to test these bit values, e.g. IF DBOBjectFlags & 1 THEN ... DBUser1Flags Platform's user1 database value. DBUser2Flags Platform's user2 database value. GetEntVar "<platvar>" Returns value of variable <platvar> in platform doctrine (from target doctrine) Misc Terms: Time Time in seconds from start of scenario Layer Depth of thermal layer TerrainAlt Altitude/Depth of ground at platform or target position TacticName Name of target tactic doctrine Reserved Variables: WaypointReached True when a helo has reached a random box waypoint PreEnableCourse Weapons preset pre-enable course PreEnableSpeed Weapons preset pre-enable speed, in knots PreEnableDepth Weapons preset pre-enable altitude/depth, in feet Enabled True when a weapon is enabled RunToEnable Weapons preset run-to-enable range, in yards Runout Weapons preset shutdown range, in yards Floor Weapons preset floor, in feet Ceiling Weapons preset ceiling, in feet AcousticMode Torpedo preset - true for passive mode These next 2 variables must be declared in Var instructions before they can be used. DestX Missile preset target x, in yards from lower left of map DestY Missile preset target y, in yards from lower left of map SearchDepth Weapons preset search altitude/depth, in feet OrderedDepth Weapons preset ordered altitude/depth, in feet DetonateDepth Weapons preset destruct altitude/depth, in feet CircleSearchPattern Torpedo preset search pattern - true for circle, false for snake DoctrinePriority Target-dependent recommended priority Commands: SetCrs <value> Set own course to <value> SetSpd <value> Set own speed to <value> SetAlt <value> Set own alt/depth to <value> SetAltLayer Set own alt/depth to opposite side of layer SetPitch <value> Set pitch to <value> SteerAbeam Set course to put contact abeam SteerTo Set course toward contact SteerOblique <value> Set course toward contact with AOB of <value> SteerAway Set course to put contact astern SteerEvasive Steer contact off rear quarter SteerXY <value1> <value2> Steer to point <value1>,<value2> (yards from lower left of map) Intercept Set intercept course TerminalHome Set collision course WakeFollow Set course to follow target's wake TacticCenter Move search pattern to center on current position Identify "<value>" Set solution classification to value. Possible values listed below, must be in quotes. Attack "<value>" Attack target using weapon <value>, must be in quotes AttackBest Attack contact using best available weapon FireBest Fire best weapon at target, ignoring firing constraints Drop Drop current target Countermeasure "<value>" Launch specified countermeasure Detonate Explode platform TimedDetonateTgt <value> Explode target at time <value> (in seconds from start of scenario) Shutdown Shut platform down, without detonating Enable Enable all sensors PreEnable Disable all sensors Snake <value> Perform a snake pattern centered on course <value> Circle Perform a circle pattern PassiveEnable Enable all passive sensors SensorEnable "<value1>" <on/off> Turn sensor <value> on or off Launch "<value>" Launch aircraft of name <value> LaunchWithLoadout "<value1>" "<value2>" <value3> Launch aircraft of name <value1> with mission <value2>. Possible mission values listed below. What value3 represents is unknown. Land Land at parent airstrip SetDoctrine "<value>" Set platform doctrine to <value> SetTactic "<value>" Set target tactic doctrine to <value> SetPriority <value> Set current command priority to <value> SetPersist <value> Set current command persistence to <value> seconds DebugOut <value> Output <value> to debug stream DebugValueOut "<value>" Output <value> to debug stream, must be in quotes SetEntVar "<value1>" <value2> Set variable <value1> in platform doctrine to <value2> (from target doctrine) String expression values: Mission: ASW, SUW, AAW, Strike, Recon, Comms, MineSweep Order: NONE, VID, TRACK, ENGAGE, RETURNTOBASE, COVER, SCRAM, RETURNTOSTATION, MOVE, TRANSIT, RESCUE, SEARCH TgtClass: UNKNOWN, SUB, SURF, AIR, HELO, MOBILE_LAND, LAND, MINE, WEAP, MISSILE, PROJECTILE, DOWNED_PILOT TgtID: UPD, UEV, UAF, UAE, HOSTILE, FRIEND, FIGHTER, STRIKE TgtMissileClass: AAM, ASM, SSM, SAM TgtSource: Active Sonar, Active Intercept, ESM, Visual, MAD, Infrared, Passive Sonar, Radar, FCRadar, IFF, CM Bitfield values: DBCMFlags Types of countermeasures a platform is equipped with 1=Chaff 2=IRFlare 4=AcousticCM 8=TowedAcousticCM 16=ECMJammer DBTargetFlags Types of targets a weapon is capable of targeting 1=Sub 2=Surf 4=Air 8=Helo 16=Land 32=Torpedo 64=Mine 128=Missile DBOBjectFlags 1=AAM This object is an air-to-air missile 2=ASM This object is an air-to-surface missile 4=SSM This object is a surface-to-surface missile 8=SAM This object is a surface-to-air missile 16=Tanker This aircraft is a tanker capable of refueling other aircraft 32=Terrain Follow This weapon can terrain follow 64=Guided This weapon is guided by the firing platform 128=Thrown This weapon has no propulsion, but is thrown by the firing platform 256=Refuelable This aircraft can refuel in-flight 512=Feedback This weapon feeds its target info back to the firing platform 1024=Prelock This weapon must acquire before it fires 2048=Smokeless This weapon doesn't leave a smoke trail 4096=Reattack This weapon can re-attack if it misses 8192=Remote This weapon can be fired on remote targeting info 16384=Snapshot This weapon receives a snapshot of the target at time of fire 32768=Ballistic This weapon follows a ballistic trajectory |
GOD ! BLESS ! YOU !
|
God bless Sonalysts and jsteed who composed the original document/post, I merely copy/pasted it here ;)
O. |
Awesome
|
All times are GMT -5. The time now is 02:45 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.