Jump to content

JellyCubes

Members
  • Posts

    141
  • Joined

  • Last visited

Posts posted by JellyCubes

  1. So, is this the final version???

    Currently spending most of my time messing around with the plugin system so changing it isn\'t high on my priority list.

    Sorry if I sound like a idiot, but what would the instructions be for a Munar orbit at 5KM going over the poles? I\'m not good at the whole 'Eccentricity' thing.....

    Semi-major axis = 205000

    Eccentricity = 0

    Inclination = 90 or 270

  2. So if you try this when you have 2 ships with the same name, will they just translate up to the new orbit height, without changing their position on the orbit, or will they both occupy the same point, and therefore destroy each other, or C, none of the above? I dont know, i havent tried it (I have a mac, and want to wait a little before i try it out)..

    All the ships are moved to the chosen orbit. It does not change the position along the orbit.

  3. [list type=decimal]

    [li]Put the Instant Orbit program in the /saves/default folder in Kerbal Space Program.[/li]

    [li]Launch a ship in KSP and immediately return to the Space Center (don\'t end the flight). The ship should still be on the launchpad. Check the Flight Tracking building to confirm.[/li]

    [li]If KSP is still open, return to the main Space Center scene and then open the Instant Orbit program.[/li]

    [li]Enter the name of the ship that was just launched and then follow the prompts.[/li]

    Step 2 is only required if you want to put something directly into orbit. Ships that are already in orbit and have their orbits changed.

    All ships with the same name will have their orbits changed.

  4. Added a railgun version that works with 0.14. Ships now experience recoil when firing. The recoil force may force rip the railgun off your ship.

    Ideally, I would like to create a railgun that spawns railgun shells so you don\'t have to manually add them in the VAB and make ammunition a consumable like fuel. A user controlled, turreted railgun version would probably also be possible or maybe a railgun that automatically detects other ships and fires on them.

  5. A very simple program that can put ships into orbit and change the orbits of any existing ships in orbit. You can put a ship into low Kerbin orbit, geosynchronous orbit, low Mun orbit, Kerbol orbit, anything.

    Put the file into the same folder as the persistent save files. Enter the name of the ship and change the orbital parameters. Program will change the orbital parameters of all ships with the same name. Program can be used while in the Space Center so you don\'t have to close KSP.

    Backup your save just in case of any errors.


    #include <fstream>
    #include <string>
    #include <stdio.h>

    using namespace std;

    int main()
    {
    ifstream saveFile('persistent.sfs');
    ofstream writeFile('intermediate.sfs', ios::out | ios::binary);

    string lineWhole;
    int shipNumber = 0;

    string shipName;
    int shipOrbit;
    string shipSemiMajorAxis;
    string shipEccentricity;
    string shipInclination;

    cout << 'Enter name of ship:\n';
    getline(cin,shipName);

    cout << '\nEnter orbiting body:\n 0 - Kerbol\n 1 - Kerbin\n 2 - Mun\n';
    cin >> shipOrbit;

    cout << '\nEnter semi-major axis (in metres):\n';
    cin >> shipSemiMajorAxis;

    cout << '\nEnter eccentricity:\n';
    cin >> shipEccentricity;

    cout << '\nEnter inclination (in degrees):\n';
    cin >> shipInclination;

    while(getline(saveFile,lineWhole)){;

    if(lineWhole.find(shipName)==8){
    shipNumber = 1;
    writeFile << lineWhole << '\n';
    }
    else if(shipNumber==1 && lineWhole.substr(1,5)=='sit ='){
    writeFile << '\tsit = ORBITING' << '\n';
    }
    else if(shipNumber==1 && lineWhole.substr(1,8)=='landed ='){
    writeFile << '\tlanded = False' << '\n';
    }
    else if(shipNumber==1 && lineWhole.substr(1,10)=='landedAt ='){
    writeFile << '\tlandedAt = ' << '\n';
    }
    else if(shipNumber==1 && lineWhole.substr(2,5)=='SMA ='){
    writeFile << '\t\tSMA = ' << shipSemiMajorAxis << '\n';
    }
    else if(shipNumber==1 && lineWhole.substr(2,5)=='ECC ='){
    writeFile << '\t\tECC = ' << shipEccentricity << '\n';
    }
    else if(shipNumber==1 && lineWhole.substr(2,5)=='INC ='){
    writeFile << '\t\tINC = ' << shipInclination << '\n';
    }
    else if(shipNumber==1 && lineWhole.substr(2,5)=='REF ='){
    writeFile << '\t\tREF = ' << shipOrbit << '\n';
    shipNumber = 0;
    }
    else{
    writeFile << lineWhole << '\n';
    }
    }

    saveFile.close();
    writeFile.close();

    int deleteResult = remove('persistent.sfs');
    int renameResult = rename('intermediate.sfs','persistent.sfs');

    if(renameResult!=0){
    perror('Rename error');
    }

    if(deleteResult!=0){
    perror('Delete error');
    }

    return 0;
    }
    #include <iostream>

    Code if you want to compile it yourself. Code is probably crappy since it\'s the first program I\'ve made with C++.

    Instant Orbit / Orbit Modifier V0.1


    A debris field generator that puts debris into orbit. It is limited to debris with only one part. Need to enter every orbital parameter, which may be a good or bad thing depending on your point of view.

    Space is so vast that unless you have tens of thousands of parts in the same orbit, you\'re unlikely to hit anything when travelling through a debris field. As a reference, our own asteroid belt only is only around 4% of the mass of the moon.

    U5Osz.jpg

    Debris Field Generator

    500 meter Asteroid


    #include <fstream>
    #include <string>
    #include <cstdlib>
    #include <ctime>
    #include <stdio.h>
    #include <iomanip>

    using namespace std;

    double randomNumberFunction();

    int main()
    {
    srand(time(0));

    ifstream openFile('persistent.sfs');

    if(openFile.is_open()){
    openFile.close();
    }
    else{
    openFile.close();
    ofstream writeFile('persistent.sfs', ios::out | ios::binary | ios::app);
    writeFile << '// KSP Flight State\n\nversion = 0.14.0\nUT = 0\nactiveVessel = 0\n';
    writeFile.close();
    }

    int shipuid = time(0);

    string shipName;
    cout << 'Enter name of debris:\n(Name of the debris displayed in the game.)' << endl;
    getline(cin,shipName);

    string shipID;
    cout << '\nEnter debris ID name:\n(Name of the part. The name in the config file.)' << endl;
    getline(cin,shipID);

    double shipMass;
    cout << '\nEnter debris mass:' << endl;
    cin >> shipMass;

    int shipAmount;
    cout << '\nAmount of debris to add:' << endl;
    cin >> shipAmount;

    double shipSMA;
    cout << '\nEnter semi-major axis:' << endl;
    cin >> shipSMA;

    double shipSMAVar;
    cout << '\nEnter semi-major axis variance:\n(Will add or subtract a random value up to this number to the semi-major axis.)' << endl;
    cin >> shipSMAVar;

    double shipECC;
    cout << '\nEnter eccentricity:' << endl;
    cin >> shipECC;

    double shipECCVar;
    cout << '\nEnter eccentricity variance:\n(Will add or subtract a random value up to this number to the eccentricity.)' << endl;
    cin >> shipECCVar;

    double shipINC;
    cout << '\nEnter inclination:' << endl;
    cin >> shipINC;

    double shipINCVar;
    cout << '\nEnter inclination variance:\n(Will add or subtract a random value up to this number to the inclination.)' << endl;
    cin >> shipINCVar;

    double shipLPE;
    cout << '\nEnter longitude of periapsis (in degrees):' << endl;
    cin >> shipLPE;

    double shipLPEVar;
    cout << '\nEnter longitude of periapasis variance:\n(Will add or subtract a random value up to this number to the longitude of periapsis.)' << endl;
    cin >> shipLPEVar;

    double shipLAN;
    cout << '\nEnter longitude of ascending node (in degrees):' << endl;
    cin >> shipLAN;

    double shipLANVar;
    cout << '\nEnter longitude of ascending node variance:\n(Will add or subtract a random value up to this number to the longitude of ascending node.)' << endl;
    cin >> shipLANVar;

    double shipMNAStart;
    cout << '\nEnter start of mean anomaly where debris will spawn:\n(Mean anomaly refers to where the debris will spawn along the orbit. Enter a number between 0 and 6.2832.)\n(0 will spawn debris at periapsis, 3.1415 will spawn debris at apoapsis and 6.2832 will spawn debris back at periapsis.)' << endl;
    cin >> shipMNAStart;

    double shipMNAEnd;
    cout << '\nEnter end of mean anomaly:' << endl;
    cin >> shipMNAEnd;

    double shipMNAVar;
    cout << '\nEnter mean anomaly variance:\n(Will add or subtract a random value up to this number to the mean anomaly.)' << endl;
    cin >> shipMNAVar;

    string shipRef;
    cout << '\nEnter orbiting body:\n 0 - Kerbol\n 1 - Kerbin\n 2 - Mun\n';
    cin >> shipRef;

    double shipMNAInc = (shipMNAEnd - shipMNAStart)/shipAmount;

    ofstream writeFile('persistent.sfs', ios::out | ios::binary | ios::app);

    for(int ii=0; ii<shipAmount; ii++){
    writeFile << setiosflags(ios::fixed) << setprecision(8) << 'VESSEL {' << endl;
    writeFile << '\tname = ' << shipName << endl << '\tsit = ORBITING\n\tlanded = False\n\tlandedAt = \n\tsplashed = False' << endl;
    writeFile << '\tmet = 0\n\tlct = 0\n\troot = 0\n\tpos = 0,0,0\n\tlat = 0\n\tlon = 0\n\talt = 0' << endl;
    writeFile << '\trot = ' << 2*randomNumberFunction()-1 << ',' << 2*randomNumberFunction()-1 << ',' << 2*randomNumberFunction()-1 << ',' << 2*randomNumberFunction()-1 << endl;
    writeFile << '\tCoM = 0,0,0\n\tstg = 0\n\tORBIT {' << endl;
    writeFile << '\t\tSMA = ' << shipSMA + 2*randomNumberFunction()*shipSMAVar - shipSMAVar << endl;
    writeFile << '\t\tECC = ' << shipECC + 2*randomNumberFunction()*shipECCVar - shipECCVar << endl;
    writeFile << '\t\tINC = ' << shipINC + 2*randomNumberFunction()*shipINCVar - shipINCVar << endl;
    writeFile << '\t\tLPE = ' << shipLPE + 2*randomNumberFunction()*shipLPEVar - shipLPEVar << endl;
    writeFile << '\t\tLAN = ' << shipLAN + 2*randomNumberFunction()*shipLANVar - shipLANVar << endl;
    writeFile << '\t\tMNA = ' << shipMNAStart + ii * shipMNAInc + 2*randomNumberFunction()*shipMNAVar - shipMNAVar << endl;
    writeFile << '\t\tEPH = 0' << endl;
    writeFile << '\t\tREF = ' << shipRef << endl << '\t\tOBJ = 1\n\t}' << endl;

    writeFile << '\tPART {\n\t\tname = ' << shipID << endl;
    writeFile << '\t\tuid = ' << shipuid + ii << endl;
    writeFile << '\t\tparent = 0\n\t\tposition = 0,0,0\n\t\trotation = 0,0,0,1\n\t\tistg = 0\n\t\tdstg = 0\n\t\tsqor = 0\n\t\tsidx = 0\n\t\tattm = 0\n\t\tcData = \n\t\tsrfN = None, -1\n\t\tattN = None, -1' << endl;
    writeFile << '\t\tmass = ' << shipMass << endl;
    writeFile << '\t\ttemp = 0\n\t\texpt = 0.5\n\t\tstate = 2\n\t\tconnected = False\n\t\tattached = True' << endl;
    writeFile << '\t}\n}' << endl;
    }

    return 0;
    }

    double randomNumberFunction()
    {
    double randomNumber = ((double)rand())/(double)RAND_MAX;
    return randomNumber;
    }
    #include <iostream>

  6. Instant orbits in 0.14 just got a whole lot easier now since orbital information is stored in the save file. Custom parts may be able to give an instant orbit, but since there\'s no documentation available right now, manual editing will have to suffice. No Battlestar Galactica style jump drives just yet.

    I recommend using an editor such as Notepad++ to edit save files.

    Instant Orbits

    Launch a ship, and while still on the launchpad return to the Space Centre. Open the persistance.sfs file and search for the name of the ship you just launched. You should have something like this:


    VESSEL {
    name = Instant Orbiter
    sit = PRELAUNCH
    landed = True
    landedAt = LaunchPad
    splashed = False
    met = 0
    lct = 4.17999990656972
    root = 0
    pos = 0,0,0
    lat = -0.236453328375202
    lon = 27.8244657605096
    alt = 66.4334788515698
    rot = 0.3673681,0.6042479,0.6059003,-0.3644312
    CoM = 0.0008940728,-4.480832,-0.007221261
    stg = 1
    cPch = 0, FLOAT
    cHdg = 0, FLOAT
    cMod = 1, INT
    ORBIT {
    SMA = 300809.642266737
    ECC = 0.994822866051143
    INC = 0.236455925375334
    LPE = 90.2300765984522
    LAN = 117.664053966235
    MNA = 3.14159348003525
    EPH = 4.17999990656972
    REF = 1
    OBJ = 0
    }

    Change the sit, landed and landedAt fields to:

    	sit = ORBITING
    landed = false
    landedAt =

    Then under the ORBIT section, change the parameters to whatever you want.

    SMA = semi-major axis

    ECC = eccentricity

    INC = inclination

    LPE = longitude of periapsis?

    LAN = longitude of ascending node

    MNA = mean anomaly?

    EPH = epoch

    REF = body the spacecraft is orbiting (0 for Kerbol, 1 for Kerbin, 2 for Mun)

    OBJ = what kind of object spacecraft is (0 for a controllable ship, 1 for ship to be debris)

  7. A spreadsheet to calculate various properties of rockets. Calculates delta-v, thrust to weight ratio, mass ratio and some other stuff. Now you can play KSP without actually playing KSP.

    Delta-V Spreadsheet

    Use together with my delta-v map of the current solar system.

    Only stock part data is included but other part data can be easily added. Can also be useful for balancing parts without having to continuously load and reload KSPs.

    Disclaimer: Use of this spreadsheet may or may not take the fun out of KSP.

×
×
  • Create New...