----- Original Message ----- 
From: "David Culp" <[EMAIL PROTECTED]>
To: "FlightGear developers discussions" <[EMAIL PROTECTED]>
Sent: Wednesday, November 12, 2003 11:48 PM
Subject: Re: [Flightgear-devel] ACScript RFC (or FGScript ??)


> > I would like to request your ideas and wishes for an aircraft AI
scripting
> > language sufficiently generic in scope to handle piloting any aircraft
> running on FG.
>
> My generalized AI airplanes were originally going to be defined in
> preferences.xml (like the ai-tanker), something like this for each
instance
> desired:
>
> <ai-plane>
>   <type>prop-transport</type>
>   <model>Aircraft/DC6/Models/DC6-model.xml</model>
>   <start-time>2.00</start-time>
>   <script>Scripts/ai_script01.xml</script>
> </ai-plane>
>
> The above would instantiate the plane (or truck, boat), assign it a visual
> model, indicate how many minutes into the sim session it should appear,
and
> indicate the path to this object's script.  The script would look like:
>
> <script>
>
>   <entry>
>     <on>
>       <type>elapsed-time</type>
>       <value>0.50</value>
>     </on>
>     <lat>35.35628</lat>
>     <lon>125.573899</lon>
>     <elev>369.5</elev>
>     <heading>350.0</heading>
>   </entry>
>
>   <entry>
>     <on>
>       <type>message</type>
>       <value>takeoff-you-hoser</value>
>     </on>
>     <task>
>       <type>takeoff</type>
>       <altitude>5000.0</altitude>
>     </task>
>   </entry>
>
> ....... and so forth.
>
> The "waypoints" could be triggered by elapsed time, UTC time, reaching a
> waypoint, or message.  The details of the takeoff would be handled by the
> FDM, knowing what speeds and climb rate are suitable for a
"prop-transport".
>
>
>
>
> Dave
> -- 
> ****************************
> David Culp
> davidculp2[at]comcast.net
> ****************************
>

Ok -- all you have done is state that takeoff is a procedure to be followed
without defining the procedure (i.e. its hard coded and there is no
variation from that procedure)

procedure takeoff(heading, target_altitude) {
        ground=altitude;
        throttle=90;
        brakes=off;
        flaps=15;
        on (speed = 140) {
            elevators = 20; // pull back on the stick
        }
        on (alititude > ground+50) {
            gear=up; // if the plane has retractable gear
        }
        on (alititude > ground+100) {
            turnto(heading); // nested procedure, does its actions and
events
            // note -- that events are stacked -- any events defined here
are
            // still active unless overridden by the nested procedure. When
the
            // nested procedure completes, overridden events take effect
again
            // also note that since this is in an event check, it gets
checked every
            // update loop to maintain the heading
        }
        on (climbrate > 100) {
            elevators--;
        }
        on (climbrate < 100) {
            elevators++;
        }
        on (altitude == target_altitude) {
            levelplane(target_altitude); // yet another scritped procedure
            return;
        }
    }
}

I'm sure there are further refinements that could be made, but you get the
general idea :)


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to