Discussion ChatGPT Can help writing Code for Orbiter

Trekkie

Starfleet Head of Ship Design
Addon Developer
Donator
Joined
Feb 6, 2016
Messages
359
Reaction score
96
Points
43
Location
Starfleet Ship Design Bureau
Hi!

i was just fooling around on ChatGPT when i wanted to try out if it knew some code for Orbiter2016

here are my results (first are the questions i asked then the answers)

Question 1: Can you write a basic Planet Code for Orbiter 2016?

Sure! Here's a basic planet code for Orbiter 2016:
; === Configuration file for planet ===
Name = MyPlanet
EllipticOrbit = TRUE ; ignore perturbations
HasElements = TRUE ; orbital elements follow

; === Planetary Mean Orbits ===
Epoch = 2451545.0 ; epoch Julian date
SemiMajorAxis = 149597870700 ; in metres
Eccentricity = 0.01671022
Inclination = 0.0
LongAscNode = 0.0
LongPerihelion = 102.94719
MeanLongitude = 100.46435

; === Physical Parameters ===
Mass = 5.9722e24 ; in kg
Size = 6371000.0 ; mean radius in metres
AlbedoRGB = 0.7 0.7 0.7

; === Rotation Elements ===
SidRotPeriod = 86164.09 ; 23h 56m 4.09s
SidRotOffset = 0.0 ; default orientation
Obliquity = 0.40910518 ; in radians
LAN = 0.0 ; vernal equinox

; === Atmospheric Parameters ===
AtmPressure0 = 101.325e3 ; pressure at sea level in Pa
AtmDensity0 = 1.225 ; density at sea level in kg/m^3
AtmGasConstant = 287.058 ; specific gas constant in J/(K kg)
AtmGamma = 1.4 ; specific heat ratio c_p/c_v
AtmAltLimit = 100000.0 ; altitude at which atmosphere ends in metres
AtmHorizonAlt = 2000.0 ; altitude at which horizon is visible in metres
AtmHazeExtent = 0.1 ; extent of atmospheric haze
AtmColor0 = 0.61 0.8 1.0 ; base color of atmosphere
AtmHazeColor = 0.75 0.9 1.0 ; color of atmospheric haze

; === Data for the Visual ===
MaxPatchResolution = 8 ; highest sphere patch level

; === Visualisation Parameters ===
MinCloudResolution = 1 ; cloud layer from this resolution
MaxCloudResolution = 6 ; highest cloud resolution level
This code defines a planet with basic physical and atmospheric parameters, as well as an elliptical orbit with elements specified. You can customize these parameters to create your own planet in Orbiter 2016.

Question 2: can you make me a Basic Spacecraft4 .ini Vessel file?

Answer: Sure, here's an example of a basic spacecraft4 vessel .ini file for Orbiter 2016:
[VESSEL]
Meshname = spacecraft4\spacecraft4.msh
Mass = 1000
EmptyMass = 500
Thrust = 5000
Isp = 300
EngineAnimation = spacecraft4\engine_anim.msh
DockingPort = 0.0 0.0 10.0 0.0 0.0 1.0
This example includes the basic parameters for a spacecraft4 vessel, including its mesh file name, mass, thrust, specific impulse, engine animation, and docking port position. You can modify these parameters to customize the vessel for your specific needs.

Question3: Can you write me a scenario file for Orbiter 2016?
Answer: Sure! Here's a sample scenario file for Orbiter 2016
BEGIN_DESC
Basic scenario for Orbiter 2016
END_DESC

BEGIN_ENVIRONMENT
System Sol
Date MJD 59000
END_ENVIRONMENT

BEGIN_FOCUS
VESSEL Shuttle-A
NAVMODE 1
TRACKMODE 2
END_FOCUS

BEGIN_HUD
PROJMODE 0
NEAR_CLIP 1
FAR_CLIP 200000000
FOV 60.0
COCKPIT_PANEL 0
PANEL_TRANSPARENCY 0.0
PANEL_COLOR 0 0 0
END_HUD

BEGIN_CAMERA
TARGET Shuttle-A
MODE Cockpit
END_CAMERA

BEGIN_MFD_LEFT
TYPE Surface
END_MFD_LEFT

BEGIN_MFD_RIGHT
TYPE Map
END_MFD_RIGHT

BEGIN_SHIPS
Shuttle-A "Default Shuttle"
{
MODEL ShuttleA
STATUS Landed Earth
POS 28.5 -80.6 0
HEADING 90
ALT 200
PTDOWN 0
}
END_SHIPS

This scenario places the player's spacecraft, Shuttle-A, on the launchpad at Kennedy Space Center in Florida, USA. The HUD is set up to display a cockpit view and two MFDs on the left and right sides of the screen. The camera is set to focus on Shuttle-A and is in cockpit mode. The environment is set to the Sol system and the date is set to MJD 59000.

Its not really SDK but i thought it was interesting, what do you all think of this?
 
Hi!

i was just fooling around on ChatGPT when i wanted to try out if it knew some code for Orbiter2016

here are my results (first are the questions i asked then the answers)

Question 1: Can you write a basic Planet Code for Orbiter 2016?



Question 2: can you make me a Basic Spacecraft4 .ini Vessel file?




Question3: Can you write me a scenario file for Orbiter 2016?


Its not really SDK but i thought it was interesting, what do you all think of this?
It is helping me to learn C++. I'm not in a hurry and neither is ChatGPT, so I ask him a lot of questions and he answers them 98% correctly. In my case I prefer to learn C++ and not ask ChatGPT to write the code for me, unless I ask it to demonstrate some function, like system calls for writing a file or creating a folder on the file system and see how it is done by asking him for a detailed explanation of what he did. It helps me a lot to understand when it's hard for me to understand and pay attention.
I think it's a good method for learning simple things.
 
Can it make 3D models and textures?
How about surface bases, airports and buildings? The hab from The Martian, or some other movie?
 
I just asked it and this was the first paragraph of the response:
"As an AI language model, I do not have the capability to create a 3D model or export it in Orbiter msh format. However, I can suggest some software tools that can help with this task."
 
Tried asking it to write code, and, according to a few modders and long-standing members, it wasn't functional code. I don't know much coding myself, but even I could see that it was at the very least pulling numbers out of its virtual behind, regardless of code structure. At least for the vanilla version freely available, while it can give a lot of good answers, it can also screw-up badly and/or lie. I asked him to write some code for the Ryze Tello quadcopter, then, in a separate conversation, to use the DJI SDK for the Mavic Air2 to write an app or script. It wrote the same code as for the Tello, despite the fact that it shouldn't normally remember previous conversations.

As for the 3D stuff, I guess there may be an AI for that, but it's not ChatGPT at the moment. It doesn't 'get' visuals, perhaps it can't 'see' at all. When asked about certain youtube videos, it seems to give out random answers, all wrong. I once asked it for directions, just out of curiosity, and the response it gave was woefully wrong. Looked like it was trying to do a sort of touristic presentation/guide of the area, but even that wouldn't work , since the indications are all wrong.
 
As for the 3D stuff, I guess there may be an AI for that, but it's not ChatGPT at the moment. It doesn't 'get' visuals, perhaps it can't 'see' at all.

Keep in mind that ChatGPT isn't more self-aware than a rock or a car and has absolutely no idea (from ancient greek ἰδεῖν = to see) of what it is talking about. So, no, it doesn't "see" anything in the usual meaning of the word. It has no "mental picture", so it acts "blindly".
 
I just asked it and this was the first paragraph of the response:
"As an AI language model, I do not have the capability to create a 3D model or export it in Orbiter msh format. However, I can suggest some software tools that can help with this task."
You might need to be more specific with your request. Being a language model, it can only handle text. You might ask it to create a node and connectivity table in Orbiter API format corresponding to a 3d mesh.
 
so it just so happens i have been messing with this for about a month with gpt-4 then i saw this thread post. what i have found is the ai forgets its place and is unable to retain the api for very long. I tried to "inform" the ai about the project and have it analyze the files on github pertaining to the api and source. not the best results. So my next "tinkering session" im am going to try other ai models that are supposedly comparable to gpt-4 and host and run them locally on my machine once i do this i can then "train" the model on the orbiter api source so the model is able to retain the information and recall it. I want to make a graphics client in unity then from there incorporate a basic collision system. ambitious, i know! For anybody else thats interested in tinkering with AI on their machine and making their own ai (coding) assistant start here: https://huggingface.co/ there are plenty of videos on youtube that offer tutorials on how to accomplish this. here is one example
i do recommend a good graphics GPU for running the AI on the GPU. it will run on cpu but performance will be poor and the models you are capable of running will be diminished
 
Last edited:
I guess you would have more return of investment of your time if you learn the API yourself and get familiar with collision systems. At least then you know if the LLM is just bullshitting or not.
 
I guess you would have more return of investment of your time if you learn the API yourself and get familiar with collision systems. At least then you know if the LLM is just bullshitting or not.
you would have to be a coder for that face. i am not. i know basics but thats it. as a test i got KSP2 decompiled and i have it doxygen'd into a api. now its time to train it
 
Last edited:
Hi!

i was just fooling around on ChatGPT when i wanted to try out if it knew some code for Orbiter2016

here are my results (first are the questions i asked then the answers)

Question 1: Can you write a basic Planet Code for Orbiter 2016?



Question 2: can you make me a Basic Spacecraft4 .ini Vessel file?




Question3: Can you write me a scenario file for Orbiter 2016?


Its not really SDK but i thought it was interesting, what do you all think of this?
Although I have become (mostly) newbie again for not using Orbiter for a long time, the scenario code generated by ChatGPT looks unfamiliar to me when I compare it with the vanilla scenarios.
Code:
BEGIN_SHIPS
Shuttle-A "Default Shuttle"
{
MODEL ShuttleA
STATUS Landed Earth
POS 28.5 -80.6 0
HEADING 90
ALT 200
PTDOWN 0
}
END_SHIPS
I'll open Orbiter 2016 and try it. While I do ask ChatGPT to write some C++ programs for me, I have never asked them (him/her/it) to create Orbiter add-ons and scenarios. In fact, I was already away from Orbiter when ChatGPT was launched and when I adopted the technology.
 
Last edited:
the scenario code generated by ChatGPT
That's not going to work;) Looks like it's mixing formats. The "accuracy" of chatgpt corrolates directly to the mass of data it's trained on, I guess it hasn't enough experience with Orbiter .scn files. It probably works better with C++, maybe feed it the shuttle.cpp and ask it to make additions and see how it goes.
 
Today I tried ChatGPT for the first time (not for Orbiter purpose), and I'm surprised a lot how it creates images on demand. Here's Titanic in space:

1.webp

And under water:

2.webp
 
It helps a lot with checking your syntax, especially when you're not a native english speaker and still have some writing skills. Which is the main point and primary focus of a language model I guess.

Which, once processed through the AI, gives : "It is particularly beneficial for checking your syntax, especially if you're not a native English speaker but possess some writing skills. This, I believe, is the primary purpose and focus of a language model."

It is also good at maths (your CPU is ,first and foremost, a super-calculator) and can see some logic flaws in a script. It can solve some problems, or at least give an order of magnitude :

How much delta V do I need to land a rocket on the Moon ?

The amount of delta-v required to land a rocket on the Moon depends on several factors, including the spacecraft's design, the landing site, and the specific mission profile. However, a general estimate for the delta-v required for a lunar landing can be broken down into several segments:

Descent from Lunar Orbit to the Moon's Surface: The delta-v required for a controlled descent varies depending on the desired landing site and approach, but it is generally around 1,500 to 2,000 m/s for a soft landing.

Launch from the Moon's Surface to Orbit: To return to lunar orbit after landing, a spacecraft typically requires about 1,600 to 2,500 m/s of delta-v, depending on the ascent profile and efficiency of the propulsion system.

In summary, if you're planning a mission that includes landing on the Moon and returning to lunar orbit, you would need approximately 3,100 to 4,500 m/s of delta-v just for the landing and ascent phases. This estimate doesn't account for other mission phases, such as the transfer from Earth to lunar orbit, which requires additional delta-v. When planning a mission, it's essential to consider these additional stages for a complete delta-v budget.


You have to learn which tasks you can delegate to it, and then, yes, it can save you a lot of time in specific contexts.
 
Last edited:
I didn't note this thread earlier! Aaaaah ChatGPT miracles ....... :)

That's not going to work;) Looks like it's mixing formats. The "accuracy" of chatgpt corrolates directly to the mass of data it's trained on, I guess it hasn't enough experience with Orbiter .scn files. It probably works better with C++, maybe feed it the shuttle.cpp and ask it to make additions and see how it goes.

I confirm that ChatGPT was of great help to structure my C++ code in OMX (management of thread and TCP connections) AND I also confirm that everything suggested by ChatGPT must be thoroughly tested. For instance, for OMX, I used the server's address orbiterx.obspm.fr and structured my TCP connection according to ChatGPT suggestions. The point is that ChatGPT didn't tell me that the "domain" must be translated into an IP address, i.e. xxx.xxx.xxx.xxx, by my application itself (naively I thought it was routers' job). It took me 2 weeks with fellows to find that bug!

Then, if talking about Orbiter's scn files, just expect the very basic.
 
Back
Top