Profile image

FT With ChatGPT?

34.2k Dissent3R  11 months ago

Alright i think i may have just figured how to code FT with ChatGPT, all you have to do is explain the basic inputs and functions, you can just copy and paste this....

(i decided to call my new inputs system I cooked up "funky trees". Somehow escapes me why, but I'll roll with it. Here I'll describe what you can do in the land of funk.

Essentially what this means is that you can enter any mathematical expression (following this syntax) into an input field and it will be evaluated every frame. You can pull in data from a variety of sources, and process these how you like.

Inputs
What you can now do is use the normal input axes:

Pitch
Roll
Yaw
Throttle
Brake
Trim
VTOL
LandingGear
FireGuns
FireWeapons
LaunchCountermeasures
Activate1
Activate2
Activate3
Activate4
Activate5
Activate6
Activate7
Activate8
Flight data
In addition to this you can access some information from the aircraft:

Altitude - Aircraft's altitude in metres
AltitudeAgl - Aircraft's altitude above ground level in metres
GS - The speed relative to the ground (m/s)
IAS - The speed relative to the air, adjusted for the desnity of the air (m/s)
TAS - The speed relative to the air (m/s)
Fuel - The amount of fuel remaining as a proportion of capacity (0 to 1)
AngleOfAttack - The angle of attack (angle airflow vertically meets the boresight) in degrees
AngleOfSlip - The horizontal equivalent of angle of attack (degrees)
PitchAngle - The pitch of the aircraft (degrees)
RollAngle - The roll of the aircraft (degrees)
Heading - The heading of the aircraft (degrees)
Time - The time since the level loaded (seconds)
GForce - The acceleration and gravitational "force" acting on the cockpit in G. I know it's not a force. Shut up.
VerticalG - The signed vertical component of the "G Force".
SelectedWeaponName - The name of the selected weapon
Latitude - The North/South position of the craft (metres)
Longitude - The East/West position of the craft (metres)
PitchRate - The pitch angular velocity in degrees/second
YawRate - The yaw angular velocity in degrees/second
RollRate - The roll angular velocity in degrees/second (these 3 inputs are better than using rate(PitchAngle) etc, because they account for wrapping around the angle, as well as being in local space: rate(Heading) is different to YawRate)
TargetSelected - true if a target is selected, else false.
TargetHeading - the heading to the selected target in degrees.
TargetElevation - the vertical angle to the selected target in degrees.
TargetDistance - the distance to the selected target in metres.
Constants
Values that are always the same:

pi the mathematical constant pi (half a tau, if you will).
e the mathematical constant e.
true a true boolean value
false a false boolean value
Operators
These are useful for... maths or something.

Mathematical:
+, - addition and subtraction (- can be used as a unary operator, for instance -Pitch
*, / multiplication and division
Comparison:
<, > less than, greater than
<=, >= less than or equal to, greater than or equal to
==, != equal to, not equal to
Boolean:
&, AND
|, OR
!, NOT (this is a unary operator)
Ternary operator: condition ? valueiftrue : valueiffalse - this chooses between two values based on the condition.
Functions
Finally, there's some helpful functions to do maths for you!

abs(x) - The absolute (positive) value of x.
ammo(name) - The amount of ammo of the weapon with name. Remember to put the name in " quotes.
ceil(x) - x rounded up to an integer.
clamp(x, min, max) - x clamped between min and max.
clamp01(x) - Equivalent to clamp(x, 0, 1).
deltaangle(a, b) - The shortest angle delta between angles a and b in degrees.
exp(x) - Returns e raised to the power of x.
floor(x) - x rounded down to an integer.
inverselerp(a, b, x) - Calculates the linear parameter t that produces the interpolant value within the range [a, b].
lerp(a, b, t) - Linearly interpolates between a and b, by a proportion of t.
lerpangle(a, b, t) - Similar to lerp, but interpolates correctly when values pass 360 degrees.
lerpunclamped(a, b, t) - Similar to lerp, but doesn't clamp the value between a and b.
log(x, p) - The logarithm of x in base p.
log10(x) - Equivalent to log(x, 10).
pingpong(x, l) - "Ping-pongs" the value x so it is never larger than l and never less than 0.
max(a, b) - The largest value between a and b.
min(a, b) - The smallest value between a and b.
pow(x, p) - x raised to the power of p.
repeat(x, l) - Loops the value x so it is never larger than l and never less than 0.
round(x) - Rounds x to the nearest integer.
sign(x) - The sign of x (1 if x positive, -1 if x negative)
smoothstep(a, b, t) - Similar to lerp, but with smoothing at the ends.
sqrt(x) - The square root of x.
sin(x) - The sine of x (degrees)
cos(x) - The cosine of x (degrees)
tan(x) - The tangent of x (degrees)
asin(x) - The arc-sine of x (degrees)
acos(x) - The arc-cosine of x (degrees)
atan(x) - The arc-tangent of x (degrees)
Memory Functions
These are functions that are special because their output not only depends on inputs but their previous state.
- sum(x) - Returns the sum of all it's inputs over time (the integral of x)
- rate(x) - Returns the rate of change of x relative to its value last frame (the derivative of x)
- smooth(x, t) - When loaded, it's output is set to x. As x changes, the output tries to move to x, but at a rate of no greater than t. This is vaguely equivalent to changing the speed of a rotator.
- PID(target, current, p, i , d) - Evaluates a PID controller with the setpoint of "target", process variable "current" and the gains p, i, and d. Equivalent to: p * (target - current) + i * sum(target - current) - d * rate(current)\
Remember no spaces and all units are metric

I'm going to ask you some questions to which you would give me the corresponding code)

.When you're done, the AI should be able to understand basic FT and now you can ask it for basic codes to do basic things.

Note: It is also capable of doing much more complex codes, but most times, its complex codes need a little adjustment and revision to work

  • Log in to leave a comment
  • Profile image

    I believe a more useful function of this would be to help beginners learn FT.
    I remember it being really daunting when I first got into it. It took me several months and lots of trial and error, but I eventually got the hang of it.

    Having a chat bot to help break down how the code operates would be a valuable tool for beginners, at least in my opinion.

    That aside, this is actually pretty neat. I recon if you took a few hours and made a simulated input-output environment, feeding it strings of code then evaluating the correctness of the outputs, the bot might eventually become more fluent (if that makes any sense).
    That's just my idea though. I have 0 experience with programming chatbots so idk how they function and what it takes to get one working as desired.

    Pinned 11 months ago
  • Profile image
    34.2k Dissent3R

    @Korzalerke2147483647 i made a video testing it out though, the more complex codes are more likely to need correction though...

    Pinned 11 months ago
  • Profile image
    34.2k Dissent3R

    thanks to @WNP78 for the explanatory text

    Pinned 11 months ago
  • Profile image
    2,004 Numbers2

    I wish snow was still around @CaptainNoble

    11 months ago
  • Profile image
    34.2k Dissent3R

    @Numbers2 yeah, looks like you gotta figure this one out yourself buddy...

    11 months ago
  • Profile image
    2,004 Numbers2

    Yeah... nah it didn't work @CaptainNoble

    11 months ago
  • Profile image
    34.2k Dissent3R

    @Numbers2 I'm not a missile guy, but you can explain the basics of fox 3 and fox 1 missiles to chatGPT and ask it for the code

    11 months ago
  • Profile image
    2,004 Numbers2

    Whats a code i can use to turn a fox 3 into a fox 1 without changing it's shape or appearance? Let alone the codes i have @CaptainNoble

    11 months ago
  • Profile image
    6,361 11qazxc

    Perhaps it can be better if you'll say it's unity's C# and miss some parts of description but tell it basic info about flight dynamics and geometry instead.
    And as Redrocktumbler said you'll perhaps need to repeat your description once in a while, because ANN itself is stateless and "memory" of that one is just last ~3k of tokens glued to your message.

    And no, you must not overestimate ANN, it's more like polynomial approximation than AI you wish to see.

    11 months ago
  • Profile image
    8,845 Yish42

    It work!

    11 months ago
  • Profile image

    oooh that's what ias and tas means

    11 months ago
  • Profile image

    @Redrocktumbler Ah, I see. Thanks for the info.

    11 months ago
  • Profile image

    For instance:
    Once I tried to simulate an alternate history with it. It forgot about a very vital thing after like, 10 messages with out it.
    (also I remember reading on C.AI FAQs that it will forget something if you dont mention it enough so.)

    11 months ago
  • Profile image

    @TheFlightGuySP as someone who has been on chatgpt reguarly since it released... I would advise against "a few hours" of feeding it info, as GPT tends to forget a lot of things after a while. I would recomend doing it in as few messages as possible? (again, if it wasn't trained on it it will forget it.)

    11 months ago
  • Profile image
    34.2k Dissent3R

    @DatMaluchGuy19 Of course things will definitely go wrong, however, the point of this is to make it easier to use.

    11 months ago
  • Profile image
    28.1k YarisSedan

    Ah Yes, Ai Generated Sp Funkytree Code, Nothing Is Gonna Go Wrong Whatsoever!

    11 months ago
  • Profile image
    34.2k Dissent3R

    @TheFlightGuySP 110 percent true, some people may tend to underestimate A.I, but it even understands when it is explained to it

    11 months ago
  • Profile image
    8,845 Yish42

    No way!

    11 months ago
  • Profile image
    35.1k Icey21

    I tried to start a project like this before, "Project Icarus" and I thought adding samples of complex and simple code and explaining what they do would help alot.
    Maybe that could be the missing piece to perfect this.

    11 months ago
  • Profile image
    26.6k ToeTips

    When I was new I had tried this but after some struggles I eventually decided to just learn it.
    Might come back to it but it does feel like cheating in a way.

    +1 11 months ago
  • Profile image

    @CaptainNoble Yeah, it checks if a AND b are true, if so it returns a 0. If not, it checks if either a OR b are true, if so it returns a 1 (true), if not a -1 (false).

    11 months ago
  • Profile image
    34.2k Dissent3R

    @Korzalerke2147483647 That actually performs an OR function and an AND at the same time,

    11 months ago
  • Profile image

    @CaptainNoble | also returns true when both conditions are true. For it to check when either is active but not both, you'd need something like this I think:

    (a & b) ? 0 : (a| b)

    11 months ago
  • Profile image

    Okay, messing around with this some more, it doesn't understand the syntax too well, but the answers seem pretty good actually.

    I asked this and it gave me this response. Not in funky trees, but the math appears to do exactly what I wanted.

    11 months ago
  • Profile image
    34.2k Dissent3R

    @Korzalerke2147483647 That will usually be "|" but you can tell it to replace + with | and & with *

    11 months ago
  • Log in to see more comments