Robot Rocket

Mario Hobbs

Untrained and Retired Electrician
Modder
Choo-Choo
Hot Stuff
Space Glider
Swingin' on a Star
Copycat
Voyager Quest
#1
Alrighty, hello folks of the forums; After making an abysmal custom parts mods i am fueled by the spirit of hubris and I want to make something neat, If you've ever used an old computer programming guide then you'll likely know about a program called robot. Robot was a simple program, you'd write commands for it then it'd execute those commands. Very simple. And i figure i want to do something like that for SFS, like here's an example of something i want to be able to do with it: (mind you the forum doesn't support tabbing for some reason so i'll use "-" for whitespace.)

#Execute a simple turn
turn(15)
print("Turn successfully executed")
#Land a rocket
def land(height,velocity,retrograde):
-while not height = 0 and not velocity > -5:
–-if not velocity > 0:
––-thrust = 100
–-else:
––thrust = 0


mind you i would be alright if it didn't use python syntax, I just use python a lot, the snakes writhe around my brain and seek the holy grail.

And if it is possible to do this, How could i balance it to not be cheat-y.

-Thanks, In advance, mariohobbs.

P.S. If this is impossible i'll be fine, I just figure "Probably easier to do software ingame than it is to do hardware ingame (see my failed experiments with SFS computing)"
 

Mario Hobbs

Untrained and Retired Electrician
Modder
Choo-Choo
Hot Stuff
Space Glider
Swingin' on a Star
Copycat
Voyager Quest
#3
Well the mod smart SAS can turn a rocket, so it must be possible to make a mod that can control thrust as well
 

Lemniscate Biscuit

RL10C-5-1 "Lemni"
Staff member
Sentinelle
Ace
Modder
Hot Stuff
Moon Maker
Atlas
MOTY 2023
#5
Alrighty, hello folks of the forums; After making an abysmal custom parts mods i am fueled by the spirit of hubris and I want to make something neat, If you've ever used an old computer programming guide then you'll likely know about a program called robot. Robot was a simple program, you'd write commands for it then it'd execute those commands. Very simple. And i figure i want to do something like that for SFS, like here's an example of something i want to be able to do with it: (mind you the forum doesn't support tabbing for some reason so i'll use "-" for whitespace.)

#Execute a simple turn
turn(15)
print("Turn successfully executed")
#Land a rocket
def land(height,velocity,retrograde):
-while not height = 0 and not velocity > -5:
–-if not velocity > 0:
––-thrust = 100
–-else:
––thrust = 0


mind you i would be alright if it didn't use python syntax, I just use python a lot, the snakes writhe around my brain and seek the holy grail.

And if it is possible to do this, How could i balance it to not be cheat-y.

-Thanks, In advance, mariohobbs.

P.S. If this is impossible i'll be fine, I just figure "Probably easier to do software ingame than it is to do hardware ingame (see my failed experiments with SFS computing)"
Autopilot mod soon?
 

Mario Hobbs

Untrained and Retired Electrician
Modder
Choo-Choo
Hot Stuff
Space Glider
Swingin' on a Star
Copycat
Voyager Quest
#6
Probably, I'll have to make it in steps though, something like this:

Step 1: Turn by Console
-allow user to turn their ship using the console
-allow user to point their ship in a certain direction using console

Step 2: Thrust Control
-allow user to turn on or off all engines
-allow user to burn an amount of delta V
-allow user to burn for a set amount of seconds
-allow user to set thrust amount

Step 3: Advanced Control
-allow user to activate stages using console
-allow user to create functions
-add a wait command
-allow user to get variables for: height, speed, TWR, delta V in current stage, angle and more
-allow user to enable and disable cheats

Step 4: Conditionals and math
-allow user to use if/else statements
-allow user to use comparisons and math

Step 5: Mod Support
-allow user to upload and download custom programs via a text file
-allow user to transfer using console and ANAIS

I'll get started with step 1 soon, but I'm not quite sure if I can write custom functions to run in the default console or if i'll have to make a custom console window. It'll likely take a while to do either since i've never made a proper mod for this game; wish me luck, either i'll successfully make SFS' autopilot, or i'll completely fail.
 

Orion

Die-hard WALL-E fan.
Staff member
Sentinelle
Modder
Hot Stuff
Space Glider
Swingin' on a Star
Atlas
#7
Probably, I'll have to make it in steps though, something like this:

Step 1: Turn by Console
-allow user to turn their ship using the console
-allow user to point their ship in a certain direction using console

Step 2: Thrust Control
-allow user to turn on or off all engines
-allow user to burn an amount of delta V
-allow user to burn for a set amount of seconds
-allow user to set thrust amount

Step 3: Advanced Control
-allow user to activate stages using console
-allow user to create functions
-add a wait command
-allow user to get variables for: height, speed, TWR, delta V in current stage, angle and more
-allow user to enable and disable cheats

Step 4: Conditionals and math
-allow user to use if/else statements
-allow user to use comparisons and math

Step 5: Mod Support
-allow user to upload and download custom programs via a text file
-allow user to transfer using console and ANAIS

I'll get started with step 1 soon, but I'm not quite sure if I can write custom functions to run in the default console or if i'll have to make a custom console window. It'll likely take a while to do either since i've never made a proper mod for this game; wish me luck, either i'll successfully make SFS' autopilot, or i'll completely fail.
Good luck, my only request is that it's more like kOS than Mechjeb.

Edit: How would you feel about making it use Assembly style coding?
 

Mario Hobbs

Untrained and Retired Electrician
Modder
Choo-Choo
Hot Stuff
Space Glider
Swingin' on a Star
Copycat
Voyager Quest
#8
Good luck, my only request is that it's more like kOS than Mechjeb.

Edit: How would you feel about making it use Assembly style coding?
I think i'll try to use something more readable, since although assembly is neat, it isn't exactly the easiest thing to learn, and a pseduo-code sort of emulation of it doesn't seem very intuitive.

For an example of this here's a hello world example i've found online for x86's assembly
Code:
jmp 115
db 'Hello world!$'
-a 115
mov ah, 09
mov dx, 102
int 21
int 20
And here's a hello world in python, which is what i plan to base the programming for this mod on due to its readability
Code:
print("Hello World")
But mind you i've made literally no progress so far, so the question of syntax really doesn't matter yet.
 

Altaïr

Space Stig, Master of gravity
Staff member
Head Moderator
Moderator
Veteran
Modder
Deja Vu
Hot Stuff
Swingin' on a Star
Atlas
Forum Legend
#9
This is an ambitious project, but it should be really cool if you manage to do it!

-allow user to transfer using console and ANAIS
You're lucky that this part already exists :p
Don't hesitate to ask for support if you need. It's possible to read the burn maneuver suggested by ANAIS by retrieving the values used in the velocity arrow, that's how smartSAS works when used with ANAIS. For other things I may have to think about how to make them available for other mods...
 

Mario Hobbs

Untrained and Retired Electrician
Modder
Choo-Choo
Hot Stuff
Space Glider
Swingin' on a Star
Copycat
Voyager Quest
#10
This is an ambitious project, but it should be really cool if you manage to do it!
Yep, It is quite a big undertaking; If I can accomplish it, It could really revolutionize SFS; You could pre-program a perfect gravity turn, A perfect transfer, a perfect landing; Though that is still very far away lol.

Anyways could a mod move this thread out of help and support? I've decided it is going to be a development thread for this mod.

After some testing i've found out that the F1 Console pauses the game when you open it. So i'll likely have to make my own that can run in-game without pausing the game.
 

Altaïr

Space Stig, Master of gravity
Staff member
Head Moderator
Moderator
Veteran
Modder
Deja Vu
Hot Stuff
Swingin' on a Star
Atlas
Forum Legend
#11
Anyways could a mod move this thread out of help and support? I've decided it is going to be a development thread for this mod.
Where do you want to move it? General discussions? I wouldn't like to move it to the mods section, that's where people search for downloadable content. I don't want to recreate what happens in the planets and worlds section: development threads are mixed with planet pack threads, there are even some packs that were never released despite having a development thread.
 

Mario Hobbs

Untrained and Retired Electrician
Modder
Choo-Choo
Hot Stuff
Space Glider
Swingin' on a Star
Copycat
Voyager Quest
#12
Where do you want to move it? General discussions? I wouldn't like to move it to the mods section, that's where people search for downloadable content. I don't want to recreate what happens in the planets and worlds section: development threads are mixed with planet pack threads, there are even some packs that were never released despite having a development thread.
Probably general discussion
 

Orion

Die-hard WALL-E fan.
Staff member
Sentinelle
Modder
Hot Stuff
Space Glider
Swingin' on a Star
Atlas
#14
I think i'll try to use something more readable, since although assembly is neat, it isn't exactly the easiest thing to learn, and a pseduo-code sort of emulation of it doesn't seem very intuitive.

For an example of this here's a hello world example i've found online for x86's assembly
Code:
jmp 115
db 'Hello world!$'
-a 115
mov ah, 09
mov dx, 102
int 21
int 20
And here's a hello world in python, which is what i plan to base the programming for this mod on due to its readability
Code:
print("Hello World")
But mind you i've made literally no progress so far, so the question of syntax really doesn't matter yet.
Very true, I was mostly joking. It'd be cool to be able to make an Apollo flight computer. Also python is the best code, so good on you.
 

Mario Hobbs

Untrained and Retired Electrician
Modder
Choo-Choo
Hot Stuff
Space Glider
Swingin' on a Star
Copycat
Voyager Quest
#15
Very true, I was mostly joking. It'd be cool to be able to make an Apollo flight computer. Also python is the best code, so good on you.
Yep python is pretty neat, very readable, easy to write, and custom functions are hard to tell apart from built in ones, which leans well to the way I'm attempting to make this work. If only i could run actual python in SFS, it'd be way easier