Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

WIP Escort Carrier - Whiplash Military Industries (WMI)

Discussion in 'Community Creations' started by Whiplash141, Jun 11, 2015.

  1. halipatsui Senior Engineer

    Messages:
    1,253
    Could this script be used to make a drone that constantly scans target ship to effectively follow it?
     
  2. Whiplash141 Junior Engineer

    Messages:
    962
    I suppose you could put the scanning command on a timer to semi automate it :)
     
  3. halipatsui Senior Engineer

    Messages:
    1,253
    So it could somewhat end up following its target if it can hold a lock on?
     
  4. Ronin1973 Master Engineer

    Messages:
    4,890
    This might be valuable if you can match speed and direction with a target within the 800 meter range; especially if you're using a swarm.
     
  5. AutoMcD Senior Engineer

    Messages:
    2,369
    Formations? :)
     
  6. Whiplash141 Junior Engineer

    Messages:
    962
    So I made something kinda cool!

    Firstly, I figured out how speed capping is handled by the game and I managed to create an iterative system that can accurately predict the velocity of an object in free-fall
    [​IMG]

    This allows me to accurately predict the distance I'd need to release a free-fall bomb in order to hit my target:


    I'll be automating this system and making a carpet bomber of some sort :)
     
    • Like Like x 2
    • Friendly Friendly x 1
  7. Sarekh Senior Engineer

    Messages:
    1,187
    Okay, okay, carpet bomber script, okay... I am not hyped - again - no. I am not hyped. carpet bomber script....

    *commences drooling*
     
    • Funny Funny x 1
  8. Hydrohawk Trainee Engineer

    Messages:
    31
    I was tinkering with a free-fall bomber a year ago for one of the Vanilla Challenges, but I could never figure out a reliable aiming system. I managed to get the timings and drop system down from set altitudes, but I had a hard time holding a constant course and altitude while aiming. I don't believe the autopilot at the time had the ability to maintain a constant altitude and heading for bombing run that wasn't pre-programed in. I attempted to come up with something like a Norden bombsight from WW2, but as my programing skills in this game are fairly non existent, it didn't turn out well.

    Pretty cool that you're coming up with something that does the trick. I may need to dust off my bomber again once you get a script released.

    On a side note, with the "release" of parachutes, having a bombing run / aiming script for retarded bombs would be pretty cool as well!
     
  9. Whiplash141 Junior Engineer

    Messages:
    962
    Thing is I have no clue the braking force the parachute applies
    --- Automerge ---
    Soon^TM
    [​IMG]
     
    • Like Like x 1
  10. halipatsui Senior Engineer

    Messages:
    1,253

    I bet kiting that thing will be super easy
     
  11. mhalpern Senior Engineer

    Messages:
    2,119
    Once parachutes are figured out, lots of things will become more practical, drop pods, supply drops, deploy-able bases and so on, there still needs to be improvements in the way of wheels and wheeled vehicles, unless I missed something, as last I checked among other things we still cant control suspension wheels through scripts effectively, and trees are problematic, I look forward to the windmills being added, might make planets a bit more energy rich.
     
  12. Hydrohawk Trainee Engineer

    Messages:
    31
    Did some experimenting this weekend (so happy to have a reason to start tinkering again!) I came up with a small bomb/missile that uses a parachute to retard its forward speed. With the use of a handful of timers, I managed to get a reliable drop system to work, with a minimum amount of delay. After several trial runs on the bombing range I set up, I managed get a fairly consistent drop pattern. I determined that at max velocity, and 850-900 m AGL, the bomb would hit ~300 m down range. I was just using a simple camera on the bottom of my test craft and triggering the bomb release sequence once the crosshairs reached the target.

    Not sure if that helps at all, but it seems as though it takes 300 m to slow from max velocity to zero with the chute.
     
  13. Wellstat Apprentice Engineer

    Messages:
    212
    Been experimenting with parachutes, attempts to use math to accurately calculate the landing point has been completely unsuccessful. Too much variables are in play, as stuff such as mass, gravity, parachute position on grid, all will affect the trajectory.
     
  14. Ronin1973 Master Engineer

    Messages:
    4,890

    Dive bombing is a bit easier to pull of than level bombing. Or you can hack a guided missile script so that it follows the initial vector when it's released.
     
  15. Wellstat Apprentice Engineer

    Messages:
    212
    my lidar script Mode 6 does this "glide on initial release vector" thing. Of course, dive bomb is still prefered since there is no need for a complex script to just do gliding, and is much cheaper.
     
  16. Whiplash141 Junior Engineer

    Messages:
    962
    I had a variable for that but it must have been lost in a different branch of the code. I'm going to re-add it
     
  17. jmhill7599 Trainee Engineer

    Messages:
    5
    Hey Whip I just started programming in SE, I have a question about using buttons to trigger an input field using the HUD. I wonder if you have any experience with that and could give me some advice. I'm on steam under supersquid2000, feel free to add me if you like, thanks.
     
  18. Ronin1973 Master Engineer

    Messages:
    4,890

    Ya keep saying that.

    I basically created a bool as a flag and a vector3d variable that copies the coordinates of the remote block when the missile is first commanded to disconnect, then another bool to control whether or not to use the remote as a guide or not (user controllable). I also allowed for multiple remotes and turrets to be selected as guidance. Oh, and a two stage guidance system (available either mode) that controls the left and up offsets. At a certain distance from the remote block (either mode) it switches from one set of offsets to another. This allows the missile to fly safely around a large host-ship as well as fly in a loose formation if several missiles are launched at once.

    Though I did manage to mess up the arming of warheads.
     
  19. Whiplash141 Junior Engineer

    Messages:
    962
    Alright mates, relatively largeish updates to some of my codes

    Optical Missile Guidance (v62-11)
    https://steamcommunity.com/sharedfiles/filedetails/?id=546494746
    Major Changes:
    • There is now a variable to lock vector on launch. This variable is named lockVectorOnLaunch and is found in the custom data of the missile program once you load the newest code version. (Stop bugging me @Ronin1973 :woot:)
    • I fixed an issue with ApplyGyroOverride that caused pitch to be negated in some instances
    • Added PID controller class
    • Guidance now kills instantly after the max runtime has been exceeded. This was mo original intention but I only recently realized that this function was broken.

    Missile Launch Script (v8-1)
    https://steamcommunity.com/sharedfiles/filedetails/?id=713072834
    Major Changes:
    • I essentially rewrote this entire code today
    • You can now kill guidance remotely using the argument "kill"!
    • Missiles are now fired in alphabetical order

    Automatic Drop Pod Script (v52)
    https://steamcommunity.com/sharedfiles/filedetails/?id=931117257
    Major Changes:
    • I fixed an issue with ApplyGyroOverride that caused pitch to be negated in some instances
    • Added support for connectors as mount points for the drop pods
    • Drop pods now use a PD control system for smoother landings. Old control method was full-on/full-off and quite bumpy.

    Auto Door and Airlock Script (v25)
    https://steamcommunity.com/sharedfiles/filedetails/?id=416932930
    Major Changes:
    • Major rewrite of code to make it more efficient
    • Massively improved performance by caching a bunch of stuff instead of allocating it every run. Code now searches for blocks every 10 seconds instead of every run!
    • Added variable "ignoreDoorsOnOtherGrids" to allow you to ignore doors on other grids
    • Added in airlock sound block support :D

    Rotor Thruster Manager (v27)
    https://steamcommunity.com/sharedfiles/filedetails/?id=757123653
    • Added dampenerScalingFactor to scale how fast dampeners react - v25
    • Added a 10 second refresh interval to minimize lag on larger grids - v26
    • Added arguments to the code to control various parts of the code -v27

    Turret AI Slaving Script (v47)
    https://steamcommunity.com/sharedfiles/filedetails/?id=672678005
    • Removed useage of GetWorldMatrix and GetWorldPosition since the bug that necessitated their use is gone
    • Removed lots of unused math and methods
    • Added support for infinite numbers of elevation rotors
    • Turrets will only fire automatically when designator has line of sight
    • Decreased equillibrium turn speed for safety reasons
    • Designators can now rotate idly if the user so desires
     
    Last edited: Aug 28, 2017
    • Like Like x 2
  20. Sarekh Senior Engineer

    Messages:
    1,187
    Good lord, let Keen never hire you - they would make you work on different stuff and the scripts would suffer.

    The lock "vector on launch" variable... does it mean that the missile will stay on the vector no matter the facing of the ship but also try to correct changes to its vector (like if being brought off course)?
     
  21. Whiplash141 Junior Engineer

    Messages:
    962
    Yep!
     
  22. halipatsui Senior Engineer

    Messages:
    1,253
    Hi whip!
    You were working on a javelin-type missile script some time ago.
    Are you still workibg on it/how is it coming along?
    Have you any plans on releasing it/if yes when?
     
  23. Whiplash141 Junior Engineer

    Messages:
    962
    The javelin missile is integrated into my new missile code :)
     
  24. halipatsui Senior Engineer

    Messages:
    1,253

    All praise mighty whiplash!
     
    • Agree Agree x 1
    • Friendly Friendly x 1
  25. Arcturus Senior Engineer

    Messages:
    1,649
    I do. If that is still an issue? https://forums.keenswh.com/threads/parachute-school.7396701
    Just a case of having to re-arrange the terminal velocity equation to solve for (MASS*GRAVITY) as a function of the current velocity and atmosphere (altitude). The drag force was set to be equal to the force of planet gravity on the grid in that equation. I might update that thread later sometime with the solved equation for force.
     
  26. Whiplash141 Junior Engineer

    Messages:
    962
    Already made an equation, but it overestimates the descent velocity by a factor of 1.12

    HTML:
    const double reefAtmosphere = 0.6;
    const double radiusMult = 8.0;
    const double dragCoeff = 1.0;
    
    double CalculateParachuteDescentSpeed(IMyParachute parachute, IMyShipController reference)
    {
        double mass = reference.CalculateShipMass().PhysicalMass;
        double gravity = reference.GetNaturalGravity().Length();
        return Math.Sqrt(mass * gravity / CalculateDragCoefficient(parachute));
    }
    
    double CalculateDragCoefficient(IMyParachute parachute)
    {
        double currentAtmosphere = parachute.Atmosphere;
        double gridSize = parachute.CubeGrid.GridSize;
        double num = 10.0 * (currentAtmosphere - reefAtmosphere);
        num = num < 5 ? 5 : Math.Max(Math.Log(num - 0.99) + 5.0, 5.0);
        double chuteRadius = num * radiusMult * gridSize / 2;
        double chuteArea = Math.PI * chuteRadius * chuteRadius;
        return 2.5 * (currentAtmosphere * 1.225)* chuteArea * dragCoeff;
    }
    
    double CalculateDragForce(IMyParachute parachute)
    {
        var velocityVec = parachute.GetVelocity();
        return CalculateDragCoefficient(parachute) * velocityVec.LengthSquared() ;
    }
    
    --- Automerge ---
    It seems that the reason for this over estimation is that the parachutes continue to grow without bounds at a specific rate because the size of the parachute is linearly interpolated with the last chute size. That means there is no true steady state solution. The computations above should give you the maximum steady descent speed so to speak, and then your ship will continue to slow down after the chute is fully deployed.
     
    Last edited: Aug 30, 2017
  27. Kephyr Apprentice Engineer

    Messages:
    193
    Is this a good place to report issues and give suggestions? Figured it's bettert than the comments sections on Steam.
    I think I found a discrepancy with one of the custom data variables description and how it affects missiles' behavior in your Optical Missile Guidance script.
    The description of "mainignitionDelay" says that during the delay the missile "will drift without any thrusters firing", but during the time it seems like the inertia dampening remains active, causing the missiles to spass out as they're loosing speed.
     
  28. Whiplash141 Junior Engineer

    Messages:
    962
    Good catch. Fixed in version 62-12 :)
    http://steamcommunity.com/sharedfiles/filedetails/?id=546494746
     
    • Like Like x 1
  29. Kephyr Apprentice Engineer

    Messages:
    193
    Welp, time to update all my missile blueprints.
    The hotfix definitely helped - the missile is drifting during the mainignition delay, but it seems to still have trouble finding its orientation. The delay is a cool function in theory, but I don't think it's doing what you want it to do yet.
    --- Automerge ---
    Actually, I think I found the real problem here - it's the "enableSpiralTrajectory" setting! Switching it off really made a difference with the missiles' behavior on low speeds, and especially during the mainignition delay. So it may be best to leave the spiral trajectory off until main ignition kicks in.
     
  30. Whiplash141 Junior Engineer

    Messages:
    962
    Fixed in 62-13 :)