发新话题
打印

zz 脚本程序语法(比主页上的全)

本主题由 w101011 于 2008-10-31 19:16 解除置顶

zz 脚本程序语法(比主页上的全)

http://www.netti.fi/kalle/navalhq/fc/editors/fc-doctr.txt

From: Mike Kolar <games@sonalysts.com>
Newsgroups: comp.sys.ibm.pc.games.naval
Subject: Doctrine Spec (and more)
Date: Mon, 17 May 1999 20:57:27 -0400
Organization: Sonalysts, Inc.   

First, the teaser:  The doctrine spec is attached.

There's been a lot of questions about Fleet Command and our design
decisions.  For the record, Fleet Command behaves exactly as we
intended.  We purposefully left it up to the player to order platforms
to engage incoming missiles and aircraft, because we felt that without
that, the player could too often have nothing to do.  We opted to
load-out aircraft for multiple roles instead of allowing the user to
select a specific one in the interest of simplicity for the interface
and our simulation and database design (we never imagined the extent of
offense that would be taken at that decision).  We started some
scenarios hot because we didn't want the user to sit around watching
ships steam along for 20 minutes before the action began.  We felt
comfortable with these decisions knowing that we were trying to include
appeal to the broader RTS market with a new slant on naval simulation.
But we also tried to consider at every step how the game would appeal to
the hardcore sim market that liked 688i (don't bother commenting if that
excludes you).  For example, we expanded on the same realistic sensor
detection models and object dynamics, when a normal RTS game could have
got by with much less sophisticated modeling.

Certainly we didn't expect the ferocity of discontent that flared up in
some circles.  But we've also seen plenty of positive replies that make
us think maybe we achieved what we were hoping for.

The doctrine files some of you have begun to investigate were intended
from the start to let you customize the AI's behavior (they could have
more easily been hardcoded instead of editable).  Time and scope
prohibited even thinking about the ability to provide an effective
interface to manipulate them from within the program.  Providing
multiple sets might have been nice, but we decided to concentrate on a
single implementation with the broadest appeal.  Besides, read just a
few messages in this newsgroup, and it's apparent that in some cases you
guys know best what you're going to like (and nobody else).  I hope
you'll be able to use this tool to customize behavior to your
satisfaction.

As for custom load-outs, ideally that would require an interface change
and the simulation of some relatively complicated timing- not the sort
of thing we would patch lightly.  "Realistic" load-outs in several cases
have been argued back and forth for the past week- with the possible
exception of the Phoenix (another decision we're standing by), nobody
seems to have reached a consensus on any of them, and how much
difference would it make to gameplay, really?  Still, we are considering
what might be done about these issues, but are not ready to commit to
anything.

Note that neither Sonalysts nor EA/Jane抯 will support editing of
doctrine files- Fleet Command was intended to run with the files as
shipped.  What you do with them after that is at your own risk.  Having
said that, the doctrine spec is attached as a text file.

Happy Commanding to all!
Regards,
Mike Kolar

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.  FC will evaluate this doctrine at regular intervals.  
Whenever a platform detects a new contact, the platform doctrine is evaluated
with NEW_TRACK equal to 1.  Platform doctrine can chose to assign a particular
doctrine file to that contact using the TACTIC 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.

Note that doctrine priority is by default higher than user commands.  You
can test against the user order currently being executed using the ORDER
term.  In this way all user commands could be overridden and redefined in
doctrine.

Following are some syntax specifications.  Note that neither Sonalysts nor
EA/Jane's will support editing of doctrine files- Fleet Command was intended
to run with the files as shipped.  What you do with them after that is at
your own risk.

Rules
=

Rules consist of expressions and commands in the following form:

RULE <rule name>
IF
        <expressions>
THEN
        <commands>
END

Expressions

Expressions consist of values and operators in the following form:

<value> <operator> <value>

Expressions can be joined by AND or OR, and support nested sub-expressions,
for example:

( BRG < 90 OR BRG >270 ) AND SPD > 400

Fleet Command is capable of following sub-expressions recursively to any
depth.

Possible terms for <operator> are "=3D", "!=3D" (not equal), "<", ">".

Possible terms for <value> are:
        real                    Any real number
        {real1,real2}           A real number of random value from
                                real1 to real2
        "string"                Any character string enclosed in quotes
        BRG                     Solution bearing
        RNG                     Solution range
        CRS                     Solution course
        SPD                     Solution speed
        ALT                     Solution alt/depth
        PERIDEPTH               Platform's periscope depth
        ID                      Solution classification (see below)
        CPA                     Solution projected closest point of approach
        CLASS                   Contact object class (see below)
        SILOS                   Solution speed in the line-of-sight
                                (approach speed)
        AOB                     Angle-on-bow of contact bearing
        LAYER                   Acoustic Layer Depth
        ATTACKRNG               Max attack range of best available weapon
        SOURCE                  Source of reporting sensor (see below)
        MISSILE_CLASS           Class of contact missile: AAM or ASM
        AGE                     Time since last new position
        CONF                    Solution confidence, 0-100
        TIME                    Simulation time
        INIT                    Boolean, TRUE first time doctrine is evaluated
        NEWTRACK                Boolean, TRUE first time solution is evaluated
        TIMERx                  1-8, timer remaining or -1
        VARx                    1-8, user variable
        WEAPON_AWAY             Boolean, TRUE whenever weapon is fired
        WEAPON_CLASS            Object class of weapon fired (see below)
        EXPR                     indicates a mathematical expression will      
                                follow, e.g. {1,10} > 5, which evaluates
                                truth of a random draw from 1 to 10 being > 5.
        ORDER                   Current user order being executed

Commands

Commands consist of commands and values in the following form:

<command> [value1] [value2]

Supported terms for <command> are (so far):
        SETCRS                  Set own course to value1
        STEER_ABEAM             Set course to put contact abeam
        STEER_AWAY              Set course to put contact astern
        STEER_TO                Set course toward contact
        STEER_OBLIQUE           Set course toward contact with given AOB
        INTERCEPT               Set intercept course
        TERMINAL_HOME           Set collision course
        STEER_EVASIVE           Steer contact off rear quarter
        SETPITCH                (A/C or Sub only) Set pitch
        SETSPD                  Set own speed to value1
        MIN_SPD                 Set own speed to minimum speed
        LOITER_SPD              Set own speed to loiter speed
        TRANSIT_SPD             Set own speed to transit speed
        MAX_SPD                 Set own speed to max speed
        SETALT                  Set own alt/depth to value1
        IDENTIFY                Set solution classification to value1 (see below)
        SENSOR                  Turn sensor value1 on or off dependent on value2
        ATTACK                  Attack contact using weapon value1
        ATTACK_BEST             Attack contact using best weapon
        FIRE_BEST               Fire best weapon immediately, no range considerations
        TACTIC                  Apply doctrine value1 to contact
        ENABLE                  Set weapon enable
        COUNTERMEASURE          Launch specified countermeasure
        DETONATE                Detonate now
        SHUTDOWN                Shutdown
        SET_TIMER               Set timer value1 (1-8) to value2 seconds
        VAR_SET                 Set user variable value1 (1-8) to value2
        VAR_ADD                 Add value2 to user variable value1 =

        VAR_SUB                 Subtract value2 from user variable value1
        VAR_MUL                 Multiply user variable value1 by value2
        VAR_DIV                 Divide user variable value1 by value2
        CLEAR_TIMER             Clear timer value1 (1-8)
        LAUNCH                  Launch aircraft of type value1
        LAND                    Instruct an aircraft to return to base
        TACTIC_CENTER           Recenter the platform's original scenario tactic at its
                                current location
        PRIORITY                Set commands in the current scope to priority value1
                                (1-255).  Doctrine commands default to 250.  Other
                                defaults are: Scenario orders, 1; AI orders, 100; User
                                orders, 225.
        PERSIST                 Set commands in the current scope to persist for
                                value1 seconds.  Default persistence is 10 seconds.
               

String constants:

Object Class:
SUB,SURF,AIR,HELO,LAND,MINE,WEAP,MISSILE,PROJECTILE,DOWNED_PILOT

Classification:
UPD,UEV,UAF,UAE,HOSTILE,FRIEND
UPD = Unknown, pending
UEV = Unknown, evaluated
UAF = Unknown, assumed friend
UAE = Unknown, assumed enemy (you'll often get this after missile
separation from an unknown)
HOSTILE = Positively ID'd as hostile
FRIEND = Positively ID'd as friendly

Sensor Class:
Active Sonar,Active Intercept,ESM,Visual,MAD,Infrared,Passive Sonar,
Sonobuoy,Radar,FCRadar

User Orders:
NONE,VID,ENGAGE,RETURNTOBASE,COVER,SCRAM,MOVE,RESCUE,SEARCH

TOP

唉 看不懂

TOP

跟电脑编程类似的语句,比如“如果敌机接近到XX千米,那么自动发射空空导弹,否则弹射跳伞”

多分析Doctrines文件内的txt脚本文件才能理解一二,感兴趣的朋友可以使用论坛的搜索功能,搜索“脚本”2字,查看以前的讨论帖子。
细节决定成败!

TOP

发个中文版的大家提提意见

《舰队指挥官》脚本详细说明书
有人对《舰队指挥官》及其设计决策提出了一些疑问。主要是针对《舰队指挥官》中众多的精确事件或行为。我们有目的的保留了由玩家控制作战平台上导弹和飞机的各种事件或行为的操作,因为我们觉得如果没有这些,玩家可能会经常无所事事。我们宁愿让载入的航空器拥有多种功能,而非让玩家选择一个特殊功能的来使用,这样使游戏的趣味性不再局限于界面、模拟和数据库设计(我们并不认为把这些引入决策过程属于错误的范畴)。为了不让玩家在行动开始阶段的20分钟内无所事事的看着舰船航行的蒸汽,我们启动了一些非常激烈的情节。我们认为这些决策是有益的,因为我们正尝试着使其在即使战略游戏市场上具有更广泛的吸引力,以满足海战模拟游戏发展的新的趋势。而且我们正在努力研究着具体步骤,就是怎样使游戏对那些模拟游戏忠实爱好者更具市场吸引力,就像当年的《688I》一样(基本上没有不满的反映)。例如,我们扩展了同一个真实探测器材的发现模式和运动对象,这些在一般的即使战略游戏中可能没有那么多复杂的模式。从允许自定义人工智能行为开始,很多你们已经开始研究的脚本文件都被列入了计划(其实把这些做成固定编码更容易一些,而不是做成这种可编辑的)。时间和限制范围甚至是思考的能力将提供一个从程序内部操纵它们的有效界面。提供更多的设置可能很好,但我们还是决定把它集成为一个能够满足最为广泛需求的专用工具。另外,从这些讨论中获得的一些信息,很明显在多数情况下你们最了解的是你们喜欢的东西(基本没有什么例外)。我希望你将能够使用这一个工具定制你们满意的行为。为了自定义项的载入,需要一些界面改变和相对复杂的同步模拟,那些现在还没有的东西我们将逐步完善。“真实性”,为了它我们载入的脚本在多数情况下被来来回回的争论很长时间,Phoenix可能是个例外(我们已经准备了另一个决策),人们经常在这上面难以达成一致,提升游戏可玩性会有那么多不同意见,真是的?直到现在,我们还在思考怎样处理这些议题,但目前还没有完全解决。要注意的是Sonalysts和EA/Jane's都不支持对脚本文件的编辑,舰队指挥官被设计成可执行这些文件是为了便于调整,使你除自编任务外还可以作很多事情。脚本详细说明书的文本文件附后。恰当的使用这些命令!此致敬礼,Mike Kolar Sonalysts。
!!!!!!!注意在修改之前备份你的脚本文件!!!!!!!!
首先是脚本工作方式:对象数据库给每一个作战单元平台都设计了默认脚本。我们可以在剧情文件中找到每一个作战单元特定的DOCTRINE<filename>命令。《舰队指挥官》会定时的调用这些脚本。当作战单位遇到一个新的触发条件,平台脚本就会被NEW_TRACK equal to 1(新的轨迹赋值为1)语句调用。平台脚本能够通过使用TACTIC(战术)命令给某一特定脚本文件赋值。之后,原始的平台脚本继续被调用,每次触发条件更新时增加赋值的战术脚本都会被调用。关键是清楚它们的区别:除非遇到新的触发条件,否则在没有任何参数变化情况下,原始的平台脚本会被例行公事的调用。当遇到新的触发条件时,平台脚本在新的事件解决之后还会被再调用一次。这是唯一的设置战术脚本触发条件的机会。注意默认情况下脚本的优先权高于玩家的命令。你可以测试一下用一般玩家命令对抗正在执行的ORDER语句。这样所有的玩家命令都可能在脚本中被不服从和重定义。
下面是一些语法说明。
1、Rules规则:通常由下列形式的表达式和命令组成:
RULE <rule name>
IF
<expressions>
THEN
<commands>
END
2、Expressions表达式:通常由下列形式的数值和运算符组成:
<value> <operator> <value>
表达式可以由AND或者OR组成,并且支持通过括号嵌套子表达式,如:
( BRG < 90 OR BRG >270 ) AND SPD > 400
《舰队指挥官》支持多层循环嵌套子表达式。
运算符<operator>项包括:“=”,“!=”(不等于),“<”,“>”。
数值<value>项包括:
Real:任何实数
{real1,real2}:real1到real2之间一个随机实数
3、“string”字符串:任何一串被引用的固定符号
BRG:方位。Solution bearing
RNG:距离。Solution range
CRS:航向。Solution course
SPD:速度。Solution speed
ALT:高度或深度。Solution alt/depth
PERIDEPTH:潜望镜深度。Platform's periscope depth
ID:分类。Solution classification(see below)
CPA:计划最近接近点。Solution projected closest point of approach
CLASS:接触对象类别。Contact object class(see below)
SILOS:视线内的速度。Solution speed in the line-of-sight(approach speed接近速度)
AOB:舷角。Angle-on-bow of contact bearing
LAYER:声音深度层。Acoustic Layer Depth
ATTACKRNG:最佳武器的最大攻击范围。Max attack range of best available weapon
SOURCE:探测来源。Source of reporting sensor (see below)
MISSILE_CLASS:接触导弹类别(AAM空空导弹或ASM空面导弹)。Class of contact missile: AAM or ASM
AGE:最后位置点的时间。Time since last new position
CONF:可信度(0-100)。Solution confidence, 0-100
TIME:模拟时间。Simulation time
INIT:布尔逻辑值(和,或,非,如果,那么和除非等运算符号),初始脚本都被赋值为TRUE。Boolean, TRUE first time doctrine is evaluated
NEWTRACK:布尔逻辑值,初始脚本都被赋值为TRUE。Boolean, TRUE first time solution is evaluated
TIMERx 1-8,记时器或-1。timer remaining or -1
VARx 1-8,用户变量user variable
WEAPON_AWAY:布尔逻辑值,无论什么时间武器被发射都被赋值为TRUE。Boolean, TRUE whenever weapon is fired
WEAPON_CLASS:武器开火的对象类别Object class of weapon fired (see below)
EXPR:引出一个数学表达式。indicates a mathematical expression will follow,例如引出{1,10} > 5,就是1至10之间随机抽取一个大于5的实数。
ORDER:正在被执行的当前用户命令。Current user order being executed
4、Commands命令:通常由下列形式的命令和数值组成:
<command> [value1] [value2]
命令<command>项支持以下这些语句(就目前来讲):
SETCRS:设置航向值为value1。Set own course to value1
STEER_ABEAM:设置航向用正横保持接触。Set course to put contact abeam
STEER_AWAY:设置航向用船尾保持接触。Set course to put contact astern
STEER_TO:设置航向面对保持接触。Set course toward contact
STEER_OBLIQUE:设置航向用给定的舷角AOB保持接触。Set course toward contact with given AOB
INTERCEPT:设置阶段航向。Set intercept course
TERMINAL_HOME:设置冲击航向。Set collision course
STEER_EVASIVE:设置航向背对脱离接触。Steer contact off rear quarter
SETPITCH:设置飞机潜艇倾斜。(A/C or Sub only) Set pitch
SETSPD:设置速度值为value1。Set own speed to value1
MIN_SPD:设置速度为最小速度。Set own speed to minimum speed
LOITER_SPD:设置速度为巡航速度。Set own speed to loiter speed
TRANSIT_SPD:设置速度为转移速度。Set own speed to transit speed
MAX_SPD:设置速度为最大速度。Set own speed to max speed
SETALT:设置高度或深度值为value1。Set own alt/depth to value1
IDENTIFY:设置类别为value1。Set solution classification to value1 (see below)
SENSOR:在数值为value1时打开探测器并在value2时关闭。Turn sensor value1 on or off dependent on value2
ATTACK:用数值为value1武器实施攻击。Attack contact using weapon value1
ATTACK_BEST:用最好的武器实施攻击。Attack contact using best weapon
FIRE_BEST:用最好的武器开火而不考虑距离。Fire best weapon immediately, no range considerations
TACTIC:调用数值为value1的脚本。Apply doctrine value1 to contact
ENABLE:设置武器为可用。Set weapon enable
COUNTERMEASURE:开始指定的对策。Launch specified countermeasure
DETONATE:立即引爆。Detonate now
SHUTDOWN:停止运转。Shutdown
SET_TIMER:设置记时器时间从value1到value2秒。Set timer value1 (1-8) to value2 seconds
VAR_SET:设定用户变量值从value1到value2。Set user variable value1 (1-8) to value2
VAR_ADD:在用户变量value1中加上value2。Add value2 to user variable value1
VAR_SUB:从用户变量value1中减去value2。Subtract value2 from user variable value1
VAR_MUL:把用户变量value1乘以value2。Multiply user variable value1 by value2
VAR_DIV:把用户变量value1除以value2。Divide user variable value1 by value2
CLEAR_TIMER:清除记时器数值value1。Clear timer value1 (1-8)
LAUNCH:起飞数值为value1的飞行器。Launch aircraft of type value1
LAND:通知一个航空器返回基地。Instruct an aircraft to return to base
TACTIC_CENTER:让平台从当前位置回到初始战术位置中心。Recenter the platform's original scenario tactic at its current location
PRIORITY:设置当前范围内的命令的优先级数值为value1,默认情况下,脚本命令优先级为255、游戏剧情命令为1、人工智能命令为100、用户命令为225。Set commands in the current scope to priority value1(1-255). Doctrine commands default to 250.Other defaults are: Scenario orders 1; AI orders 100; User orders 225.
PERSIST:设置当前范围内的命令持续时间为value1秒,默认情况下持续时间为10秒。Set commands in the current scope to persist for value1 seconds. Default persistence is 10 seconds.

String constants固定字符串:
Object Class对象类别:SUB(潜艇),SURF(舰船),AIR(飞机),HELO(直升机),LAND(地面单位),MINE(鱼水雷),WEAP(武器),MISSILE(导弹),PROJECTILE(发射器),DOWNED_PILOT(非制导武器)。
Classification类别:IDUPD(),IDAF(),IDAE(),IDHOSTILE(敌军),IDFRIEND(盟军)。
Sensor Class探测器类型:Active Sonar(主动声纳),Active Intercept(主动拦截),ESM(电子侦测),Visual(视觉),MAD(磁探仪),Infrared(红外),Passive Sonar(被动声纳),Sonobuoy(声纳浮标),Radar(雷达),FCRadar(火控雷达)。
User Orders用户命令:NONE(无),VID(识别),ENGAGE(接战),RETURNTOBASE(返回),COVER(掩护),SCRAM(脱离),MOVE(移动),RESCUE(援救),SEARCH(搜索)。

TOP

强悍啊,水师提督单独发帖吧,我来置顶。
细节决定成败!

TOP

已经是置顶的帖子了,汗
细节决定成败!

TOP

不错 需要耐心

TOP

感谢cncsman和水师提督~
由于版面有限,此帖已录入精华帖子合集,做自由落体

[ 本帖最后由 w101011 于 2008-11-20 21:49 编辑 ]

TOP

自由落体什么意思??

TOP

引用:
原帖由 gtx926 于 2008-11-20 19:55 发表
自由落体什么意思??
没人顶就自生自灭了

TOP

发新话题