Jump to content

[kOS] The Automated Mission Challenge


Recommended Posts

I also managed to get some points. Here is video:

I decided that video would be best to show "brute force" approach in node creation (jump to 3:48 time ) :).

Kerbin stable orbit: 3 points

Mun SOI: 1 point

Mun stable orbit: 3 points

Total: 7 points.

Amazing work! Those maneuver node techniques were brilliant! I'm going to have to start trying that. :)

Link to comment
Share on other sites

Wait what? You can run stuff straight from the archive? :o What happens if you have an archive program running and you go OoR of the archive? What happens if you have a running archive program that you edit externally? :huh:

Absolutely - here's my launcher program

COPY att TO 1. COPY tail TO 1. COPY periapsis TO 1. COPY tryinlight TO 1.
//amusements...
IF STATUS = "PRELAUNCH" {
clearscreen.


IF STATUS = "PRELAUNCH"
OR STATUS = "FLYING" {
RUN tan_ascent(72000,2.2). //Target Altitude, Gs of thrust
}.
print "Well, at least Jeb looks happy".
if STATUS = "SUB ORBITAL" {
RUN periapsis(73000,19). //target altitude, m/s acceleration
}.
SWITCH TO 1. //do not rely on ground control...
if STATUS = "ORBITING" {
PRINT "you can have some snacks when it's a neat circle".
UNTIL PERIAPSIS > 74000 and APOAPSIS > 74000 {
//yeah, I will write better circulariser one day...
WAIT 15.
RUN periapsis(74000,19).
}.
}.

Link to comment
Share on other sites

Am I allowed to click on the "Keep" button from science experiments? There is no control over this dialogue box in KOS, so although I can make an action group take the experiment, I can't make the popup box go away without clicking it with the mouse.

I'd allow it. :)

the system loads the program into memory before running it, so you can safely go out of range, or edit it back at ground control.

Neat, I'll have to keep this in mind :) Would have saved a few (hundred) "copy ascent from archive." while tuning my ascent script.

Still though, I'm not sure if accessing the archive with a program and/or running everything from the archive is a major issue. Okay you'd be circumventing the 10k size limit, but adding additional kOS modules for more hard disk space on a rocket isn't going to alter the dV much since a kOS unit doesn't weigh much.

Do you have an example in mind where one could get a noticeable benefit from purely using the archive instead of storing the programs locally? :)

I'm not against something like "programs can access the archive only in situations where the user would be allowed to input commands, i.e. in stable orbit or landed.", just can't think of a harm or benefit from accessing the archive with a program so I'm not sure if limiting it matters to me. :P

Speaking of stable orbits... Does a Munar(or Eeloo if time matters) injection right after the burn that is heading straight for the Muns surface count as a "stable" "orbit" for the purpose of user interaction? Since you'll have several hours of travel time between then and when the non-stability of the orbit becomes a very real issue. Then again, not sure where to cut it off if such a thing was allowed.. "if you have 6 hours to impact you can, if you have 5h 59min 59 sec then you can't!" :huh::D

Oo! How about "Orbit is considered "stable" when the vessel will not impact the surface or enter the atmosphere of it's current parent body." So on my earlier example you could load programs and input commands up to the point where you entered the Muns SoI, at which point it's hands off and any programs needed to be running should already be running. Miss the injection and don't get an encounter while your periapsis is below 70km? Tough. You're not on a stable orbit and aren't allowed to give commands even though you have ages before hitting the atmosphere... Yeah it has it's faults... -_- (though what were you doing making a munar injection straight off the ascent? showoff. :wink: )

Edited by Sacred Aardvark
freaking typos...
Link to comment
Share on other sites

Do you have an example in mind where one could get a noticeable benefit from purely using the archive instead of storing the programs locally? :)

Miss the injection and don't get an encounter while your periapsis is below 70km? Tough. You're not on a stable orbit and aren't allowed to give commands even though you have ages before hitting the atmosphere...

SET burnNode TO NODE(TIME:SECONDS, 0)
<launch>
<circularise>

UNITL WonTheGame = 1 {
PRINT "Waiting for transfer window at "+ETA:SECONDS.

UNTIL burnNode:ETA > TIME:SECONDS {
WAIT 10.
RUN VESSEL:NAME+"nextburn".
}
ADD burnNode.
LOCK STEERING TO burnNode.
SET dT TO burnNode:DELTAV:MAG*MASS/MAXTHRUST.
WHEN TIME:SECONDS > burnNode:ETA - (dT/2) THEN LOCK THROTTLE TO 1.
WAIT burnNode:ETA+(dt/22)-TIME:SECONDS.
LOCK THROTTLE TO 0.
REMOVE burnNode.
}
}

Then when you messed up your encounter you can edit your "myshipnextburn" file to add a line to the bottom - SET burnNode(12553, 10, 50, 300). WHEN TIME:SECONDS < 12553 THEN BREAK.

(The when/break isn't needed, you could just replace the file, but this way is cool because you can then replay the mission....)

Link to comment
Share on other sites

I have a successful mission that I've been tweaking a bit to make it reliable and now I'm ready to go off and start recording the video for it. Before I do, I'd like to chime in on this lightspeed delay thing and show what I did about it.

I decided that to simulate the idea that you can get data from the archive, but you shouldn't be able to do it in a way that's happening during the fiddly bits where you need the script to be responsive and quick, I made a program called simRadioDelay.

I only use the archive drive during times when this challenge would allow manual typing, and whenever I do I always use it via the program called simRadioDelay, which is stored on the archive to be run from there (not on the local 10k drive).

The way it's used is this:


run simRadioDelay("any command goes here.").

For example, this snippet. which I run when the craft has finished liftoff and circularazation and is in a stable orbit around Kerbin:


// Hohmann Transfer to Mun:
// ========================
run simRadioDelay( "copy angleUntilHohmann from archive." ).
run simRadioDelay( "copy tfDirToUnitV from archive." ).
run simRadioDelay( "copy transfer from archive." ).
run simRadioDelay( "run transfer(Mun:name,25000 )." ).
run simRadioDelay( "delete transfer." ).
run simRadioDelay( "delete tfDirToUnitV." ).
run simRadioDelay( "delete angleUntilHohmann." ).
print "=======================================".
print "STEP FINISHED. PRESS AG 9 TO CONTINUE".
print "=======================================".
ag9 off. wait until ag9. ag9 off.

It works with any arbitrary command, except for those which require a string literal (because KOSscript does not support a way to embed quote marks inside strings. There's some code in KOS that attempts to support using backslashed quote marks to do it but it still

isn't quite working right at the moment. So for now I have to avoid running a command that contains a string literal in it this way.)

Although it works with any arbitrary command (using the LOG self modifying code trick mentioned many weeks ago in this thread), I end up using it just to tell the craft "please load this software onto yourself and then run it and then delete it to make way for the next thing." like you see in my example snippet there.

The way it looks is this:


//KOS - simulate lightspeed delay between
// craft and home based on distance craft
// is from archive. Any time I tell the craft
// to run something and I am currently in
// "switch to archive" mode, I call this first which
// waits a bit.
//
// Also adds an extra 3 seconds to the delay
// to simulate handshakes and such (and so I can
// see it working when testing close to home).
declare parameter rdCmd. // command the vessel is doing.

set lSpd to 299792458. // light speed in m/s.
set extraPad to 3. // Extra seconds to wait on top of lightspeed delay

// BODY:DISTANCE is bugged at the moment and returns
// a number that isn't allowed to play maths with
// other numbers (some sort of cast error). Therefore
// I'm faking it with POSITION minus kerbin radius:
set kerbDist to KERBIN:POSITION:MAG - 600000.


clearscreen.
print "SIMULATING LIGHTSPEED RADIO DELAY".
print "+-----------------------------------+".
print "| KERBIN IS SENDING ME THIS COMMAND |".
print "+-----------------------------------+----------".
print "| " + rdCmd.
print "+-----------------------+----------------------".
print "| MY DISTANCE TO KERBIN |".
print "+-----------------------+----------------------".
print "| " + round(kerbDist,0) + " meters".
print "+-----------------------+---------------------+".
print "| RADIO DELAY REMAINING:| |".
print "+---------------------------------------------+".
// Let's assume a round-trip transmit is required,
// so we'll use half ot lightspeed.
set totDelay to ( kerbDist / (lSpd/2) ) + extraPad.
set startTime to time:seconds.
set dLeft to totDelay.
until dLeft <= 0 {
print round(dLeft,2) + " s " at (26,10).
set dLeft to totDelay - (time:seconds - startTime).

// Update display less frequently when there's more time to wait.
// The 'if dLeft > 0' is there because a bug in KOS makes
// WAIT 0 behave like WAIT Infinity:
if dLeft > 0 { wait dLeft / 20. }.
}.
print "Done " at (26,10).
print "DELAY OVER.".

// ===== Self modifying code to run dCmd: =====
// Clear old file, making sure it exists first
// so delteing it won't give an error if it doesn't:
log "dummyline" to delayCmd.
delete delayCmd.
// wrap command with 'switch to 1' and 'switch to archive.':
log "switch t" + "o 1." to delayCmd.
log rdCmd to delayCmd.
log "switch t" + "o archive." to delayCmd.
// run it:
run delayCmd.

(The reason for that odd syntax you see where I do this:

log "switch t" + "o 1." to delayCmd.

instead of this:

log "switch to 1." to delayCmd.

is because I wrote this when there was a bug where you can't contain the word "to" inside the string or the parser will mistake that "to" for the "to" in the syntax LOG blah TO blah. It has been fixed but I forgot to change the code to match.

Edited by Steven Mading
Link to comment
Share on other sites

My entry. (Note: Youtube is still processing the video so the following link might not work right away. If it doesn't work, try back again in a few hours.)

~snip~

Code and craft file posted here:

https://drive.google.com/?authuser=0#folders/0Bxkeai7oN35fUFNtZW15Tm12WGM

Some screenshots:

~snip~

Nice work! Your's is certainly the most impressive entry thus far. :)

Looks like you've earned a total of 32 points. I've added you to the leader board.

In other news I added a new point award: 10 points if your craft enters interplanetary space.

Edited by Thrfoot
Link to comment
Share on other sites

In other news I added a new point award: 10 points if your craft enters interplanetary space.

Well if I'd have known that I'd have done a different mission.

If you reserve the right to add new sources of points after submissions have come in, then I only think it's fair that get the right to re-submit after such a change has been made.

Link to comment
Share on other sites

Well if I'd have known that I'd have done a different mission.

If you reserve the right to add new sources of points after submissions have come in, then I only think it's fair that get the right to re-submit after such a change has been made.

There are no limits to the number of submissions you make. By all means, if you think you can do better, go for it! :)

The only reason I added that point award was to motivate people to leave Kerbin's SOI. It wouldn't be all that interesting if nobody ever visited other the planets, now would it?

Edited by Thrfoot
Link to comment
Share on other sites

My entry. (Note: Youtube is still processing the video so the following link might not work right away. If it doesn't work, try back again in a few hours.)

well, the video is there now, but apparently the audio keeps cutting out at various parts of it - it seems mostly when in atmosphere - I guess the program didn't like all the CPU load of that plus the vid recorder at the same time. Eventually I may re-dub the video with new commentary but since it's 40 min long that's nontrivial so I'm probably not doing that tonight. It's good enough to constitute proof so I'll let it be for now.

Link to comment
Share on other sites

@Steven Mading

Can't wait until i will have time to look at your program. But until then - I think that technically your "PRESS AG 9 TO CONTINUE" violates challenge rules.

2. You may not make any control inputs to the craft after launch, including (but not limited to) staging, fuel transfers, and docking/undocking. You may manually use timewarp.

I know that there is rule:

3. You (meaning you yourself – does not apply to running programs) may only run new programs when the current one has ended and when your craft is either in a stable orbit, or landed on a body. You may run as many kOS programs and/or commands as you want prior to liftoff.

But as i understand it allows you to input to kOS console, not ship controls. Also even if it could be understanded that way, it still has to be on stable orbit, not on for example to Mun trajectory.

Its minor violation, so congratulations on mission!

Link to comment
Share on other sites

@Steven Mading

Can't wait until i will have time to look at your program. But until then - I think that technically your "PRESS AG 9 TO CONTINUE" violates challenge rules.

I know that there is rule:

But as i understand it allows you to input to kOS console, not ship controls. Also even if it could be understanded that way, it still has to be on stable orbit, not on for example to Mun trajectory.

Its minor violation, so congratulations on mission!

It would only be a violation if I did it at a time other than when you're allowed to type commands.

I only do it at times where the challenge allows you to type commands. And all it does is type the command. All it does is load the next bit of software and run it. If anything I actually made it HARDER for myself by doing that, as I can't adjust to changed circumstances and all I can do is tell the program to continue to the next step. I can't change my mind and tell it to run with different parameters.

If anyone challenges it I'll go waste some time re-recording it with the pauses replaced with hardcoded waits to prove it.

Link to comment
Share on other sites

It would only be a violation if I did it at a time other than when you're allowed to type commands.

I only do it at times where the challenge allows you to type commands. And all it does is type the command. All it does is load the next bit of software and run it. If anything I actually made it HARDER for myself by doing that, as I can't adjust to changed circumstances and all I can do is tell the program to continue to the next step. I can't change my mind and tell it to run with different parameters.

If anyone challenges it I'll go waste some time re-recording it with the pauses replaced with hardcoded waits to prove it.

No, it's fine. Because you cannot get kOS to read input yet (e.x. "Input 'yes' to continue or 'no' to abort") I see no reason this would be a rule violation. For all intents and purposes it is, in fact, a console command.

As far as confirming a command for a burn while not in a stable orbit goes, I think that's ok since it does not alter the way the code executes. If you were to input important information mid-transfer (e.x. when to burn or how long) then it would be in violation of the rules.

Hope this clears things up. :)

Link to comment
Share on other sites

In other news I added a new point award: 10 points if your craft enters interplanetary space.

What? Thought we didn't get points for stable orbit around Kerbol? Or did you mean Interstellar?

Still, getting to both is basically "lock steering to up. when altitude>70000 then lock steering to prograde. lock throttle to 1. if stage:liquidfuel < 1 {stage.}" and then over engineering the ship to have enough dV to burn into Kerbol SOI (interplanetary space) or blast out of the solar system into interstellar space.

Interplanetary space is easier than a circular orbit around Kerbin, from kOS programming point of view anyway. (and if you're just going for cheap points, not a real mission)

I'll happily go fetch my quick 10 points if this change sticks, while building my RT network is taking my time away from attempting this for realz :/

I'd say max 1 point for entering interplanetary(or -stellar) space, but returning from interplanetary space could be worth points :)

Link to comment
Share on other sites

What? Thought we didn't get points for stable orbit around Kerbol? Or did you mean Interstellar?

Still, getting to both is basically "lock steering to up. when altitude>70000 then lock steering to prograde. lock throttle to 1. if stage:liquidfuel < 1 {stage.}" and then over engineering the ship to have enough dV to burn into Kerbol SOI (interplanetary space) or blast out of the solar system into interstellar space.

Interplanetary space is easier than a circular orbit around Kerbin, from kOS programming point of view anyway. (and if you're just going for cheap points, not a real mission)

I'll happily go fetch my quick 10 points if this change sticks, while building my RT network is taking my time away from attempting this for realz :/

I'd say max 1 point for entering interplanetary(or -stellar) space, but returning from interplanetary space could be worth points :)

That's actually a good point. I'm going to go change a few things about how points are awarded real quick.

I'm trying to create incentives to head out to other planets, so that people are more motivated to attempt more complex missions. Currently you will earn more points by returning to Kerbin than you do by simply entering interplanetary space, so unless you're actually headed somewhere it isn't too much of a advantage to go there.

Edited by Thrfoot
Link to comment
Share on other sites

I wonder about "multi probe-kOS" mission. Will it be valid?

Lets say i create ship with 2 kOS modules. I launch it to Kerbin orbit, split and head one to Mun, second to Minmus. (Apparently not in one time, because kOS rather wont work simultanously on two distant ships - but no problem, i can wait on stable orbit with one ship. ). Or maybe i could launch one into injection trajectory, then switch to second. Kerbal Alarm Clock would be probably usefull. But i'm not sure what will happen with running program in kOS after switching to another vessel....

Link to comment
Share on other sites

That's actually a good point. I'm going to go change a few things about how points are awarded real quick.

I'm trying to create incentives to head out to other planets, so that people are more motivated to attempt more complex missions. Currently you will earn more points by returning to Kerbin than you do by simply entering interplanetary space, so unless you're actually headed somewhere it isn't too much of a advantage to go there.

Two Suggestions:

1. When you add more ways to score points, always be careful to only ADD new types of points, and never subtract or reduce previous point methods, otherwise the scores you already handed out will look like they weren't added up correctly to a new reader of the thread.

2. When posting a score, post the parenthesized list of the achievements that summed up to the score, so it makes a more meaningful entry. So for example, instead of:

18: Somebody.

It's more like this:

18: Somebody. (3:Stable orbit around Kerbin, 15: safe return to Kerbin surface).

Also, your new 7 point achievement should probably include a definition of what you mean by interplanetary space ("outside the sphere of influence of Kerbin or any of Kerbin's moons" would be a good definition.)

Link to comment
Share on other sites

I wonder about "multi probe-kOS" mission. Will it be valid?

Lets say i create ship with 2 kOS modules. I launch it to Kerbin orbit, split and head one to Mun, second to Minmus. (Apparently not in one time, because kOS rather wont work simultanously on two distant ships - but no problem, i can wait on stable orbit with one ship. ). Or maybe i could launch one into injection trajectory, then switch to second. Kerbal Alarm Clock would be probably usefull. But i'm not sure what will happen with running program in kOS after switching to another vessel....

Well, CURRENTLY, a bug will cause it to grind to a halt when you return focus to a ship that had been running software that you had then put onto rails. It doesn't re-load the variables from the persistence store correctly and when it attempts to it breaks KSP's vessel loading procedure leaving half your craft missing, and grinding your FPS to 0.5 or so.

But that's a bug that could potentially get fixed, and once it does then your concern would become relevant, so it's a good idea to think about it before that bug gets fixed.

Link to comment
Share on other sites

I'm trying to create incentives to head out to other planets, so that people are more motivated to attempt more complex missions. Currently you will earn more points by returning to Kerbin than you do by simply entering interplanetary space, so unless you're actually headed somewhere it isn't too much of a advantage to go there.

I think the simplest way is to reward returning from interplanetary space, since thrusting to interplanetary isn't much effort, but returning or getting an encounter is trickier. Unless you flip the craft right after exiting Kerbin SOI... Damn it, why do I keep trying to break the scoring? :D

Sooo... "# points for returning to Kerbin SOI from an encounter outside Kerbins SOI." or something? Probably might want to give more points for entering the SOI of other planets, keep the 1 point for moons though. Maybe up the points for landings outside Kerbin SOI as well, though I'm not sure about that, since the actual landing on eve and kerbin is basically the same for kOS.

Actually, looking at the scoring you have currently in the first post, I think I'd do these changes and leave the rest as is:

1 point: Enter the SOI of any moon. //was: "body (excluding Kerbol and Kerbin)."

5 points: Perform an interplanetary transfer. // was: "As a part of your mission, enter interplanetary space."

That way you have the added incentive for traveling interplanetary space, without some derp like me burning three meters outside the Kerbins SOI and going "yay points! back to kerbin" :P And as a bonus you get 5 extra points returning your kOS from another planet than you get returning from Mun/Minmus, due to the extra planetary transfer returning from where ever to Kerbin.

*shrug* who knows... Any thoughts on those?

Link to comment
Share on other sites

1. When you add more ways to score points, always be careful to only ADD new types of points, and never subtract or reduce previous point methods, otherwise the scores you already handed out will look like they weren't added up correctly to a new reader of the thread.

2. When posting a score, post the parenthesized list of the achievements that summed up to the score, so it makes a more meaningful entry. So for example, instead of:

18: Somebody.

It's more like this:

18: Somebody. (3:Stable orbit around Kerbin, 15: safe return to Kerbin surface).

I think that since we're still early in the challenge the first suggestion can be taken care of by just recalculating the points if the scoring changes and updating the scores accordingly, and the second suggestion of listing the achievements amounting to that score would make updates and comparing scores easier.

Link to comment
Share on other sites

Ok, I'm just going to completely overhaul the scoring system. This will probably result in changing the existing scores, but I don't think the order will change. I'll also list what people earned points for under their entries in the leader boards.

I wonder about "multi probe-kOS" mission. Will it be valid?

Lets say i create ship with 2 kOS modules. I launch it to Kerbin orbit, split and head one to Mun, second to Minmus. (Apparently not in one time, because kOS rather wont work simultanously on two distant ships - but no problem, i can wait on stable orbit with one ship. ). Or maybe i could launch one into injection trajectory, then switch to second. Kerbal Alarm Clock would be probably usefull. But i'm not sure what will happen with running program in kOS after switching to another vessel....

You're allowed to have more than one kOS module on your ship, and can use them to create multiple vessels once in orbit. However, due to limitations in how kOS runs (as you have already discovered) you cannot switch vessels with active code running. Thus, you are probably limited to only deploying probes/ships/landers while in a stable orbit. Once they are deployed you can execute their programming separately.

Edit: Done with the scoring modifications. How does everyone like it? :)

Edited by Thrfoot
Link to comment
Share on other sites

However, due to limitations in how kOS runs (as you have already discovered) you cannot switch vessels with active code running.

It's even more limited than that. The bug also surfaces if the KOS module had ever had *in the past* any code running on it that used a variable who's value was large enough or small enough to get represented in scientific notation when KOS tries to write it out to the persistence store. So if your code ever said this line:

set Gconst to 0.00i0000000000667384.

that would be enough to make it trigger to the bug from then on even after the program finishes. The bug happens when KOS writes that out as "6.67384E-11" but then doesn't know how to parse the scientific notation back in.

Link to comment
Share on other sites

My comments on the new scoring:

(A) So, thrfoot, with your new scoring, do you mean a cumulative total of achieving all those things on different missions or achieving them in one single mission? Because this one for example:

10 points - Enter the SOI of all bodies in the Kerbol system

I'm not even sure is possible to do on a single *manual* mission, given the massive fuel requirements, and that since it's worth more than doing it for "only" 10 bodies, you must be including the moons as well. You can't enter the SOI of all moons of Jool, for example, unless you get captured by Jool. So when you have to do that for all moons, you're not just talking flybys but captures( which then gets rid of any slingshot fuel savings). That just sounds utterly impossible even without doing it in software.

(B) New bodies get added by KSP updates sometimes, and there's more bodies planned for the future. So be careful with phrasings like "all the bodies in the Kerbol system", as their meaning changes when updates come out. It's probably best to use explicit numbers so the challenge doesn't become harder or easier as Squad changes the number of bodies..

©

Edited by Steven Mading
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...