Coder Social home page Coder Social logo

edap's Introduction

Take the pain out of travelling

Demo: https://youtu.be/k5QqXoVuOv8

A fairly simple autopilot for a game. It uses OpenCV to recognize various GUI elements and a very simple control algorithm to press keyboard buttons.

Unreleased changes include a kalman filter and a linear-quadratic-regulator driving the mouse for smooth and accurate control.

Installation and Usage

  1. click Releases, above,
  2. download the archive (it's about 8 MB because of the opencv dll)
  3. modify the key bindings in EDAP.exe.config (or change your in-game bindings to match)
  4. set your game settings as required (see next section)
  5. run EDAP.exe

Development

  1. Install Visual Studio Community
  2. Clone this repository
  3. Open EDAP.sln
  4. Press F5 to compile and run

Required settings

  1. Key bindings. Edit EDAP.exe.config with your key bindings. A list of recognized keys is in Keyboard.cs and in the readme included with releases.
  2. Resolution is hardcoded to 1920x1080 (changing this is gonna mean changing lots of numbers and template images). Additionally, "1024x768" on a higher-resolution monitor won't cut it-- hope you've still got an old one laying around if you've gotten used to 4k :V
  3. Executable is hardcoded as the 64-bit version
  4. The colours looked for are (if you've changed your HUD colours, these things won't work):
  5. Compass calibration: red channel
  6. Compass dot: blue channel
  7. Triquadrant target: bright yellow/orange (I don't think you can change this)
  8. Saf Diseng: blue channel
  9. Disable GUI effects (the animation when you open a side panel, speeds up panel opening)
  10. Interface brightness should be set to three pips below max (I don't know how much this matters though, there is some leeway in the detectors)
  11. Mouse Widget (the little 5x5px solid yellow square in the middle of the screen) should be enabled as otherwise the fine alignment won't work.
  12. Just after each faceplant, there's a macro to target the star we just arrived at. This macro works better if you remove "Systems" from the left-hand-side Navigation list using "Set Filter".
  13. It's better to avoid scooping the hotter stars (there aren't many of them anyway). Set your galmap filter to only show stars of class F, G, K and M (and select the "Apply Filter To Route" option).

Algorithm

See Pilot.cs. tldr:

  1. press jump, throttle 100%
  2. wait 30 seconds then throttle 0%
  3. wait until centre of screen goes bright (star appears -- (1)) or compass stops moving (non-sequence star -- (2))
  4. 50% throttle, pitch up if IMPACT warning is displayed, wait 20 seconds (scoop)
  5. select star, use compass to point away from star
  6. select next destination, use compass to point at it
  7. go to step 1 until jump counter is 0
  8. set throttle to 75%, point at target continuously
  9. if "safe disengage" is displayed, press docking key sequence (disengage, wait, boost, 0% throttle, request docking)

Watch out

Things that may kill you if you leave this running unattended include:

  1. interdiction (if you use this in the bubble, keep an eye on it)
  2. binaries / multiple stars (it will pitch up to avoid collisions while scooping but otherwise takes no evasive measures)
  3. white dwarfs, black holes, and neutron stars (it won't try to scoop these but may still hit the cones)
  4. overheating near big stars -- the 20-second scoop wait is not long enough for some stars, it will start charging to jump too early
  5. bugs / bad code -- i've tested it fairly extensively but it may stil have weird shit
  6. aliens

edap's People

Contributors

jnnnnn avatar ursineasylum avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

ursineasylum

edap's Issues

Add text recognition

For scooping and throttle control it would be good to be able to recognize numbers on the screen

Fix lockup at end of trip

Constantly pressing "X" locks up the UI until the window is moved. Add a timer and just press it once.

Land on big rocks

Algorithm (starts when target indicator is visible inside blue circles)

  1. Throttle: ETA<6s: Throttle: 0; ETA 6-7s: throttle:50; ETA > 7s: throttle: 100
  2. While target obscured / too close to boundary, pitch away from blue circles centre for 5 seconds at full throttle, then realign to target
  3. While blue circles visible, pitch to edge of window such that target moves towards 2/3 blue circle radius -- rotate ship so that big rock is down
  4. Point above target by 50px / 0.1 compass.

Overheating while scooping large stars

Sometimes the 20 seconds at 50% throttle is not enough to get past the biggest stars, and the ship overheats while charging for the next jump, causing a bit of module damage.

The easiest fix for this is probably to not complete the "scoop" mode until the scooping status display disappears (instead of the 5 second timer at full throttle it has now)

Queue action system

Write a queue system that allows thread-safe queueing up of actions (and clearing the queue etc).

There should be a "wait" action, a "jump" action, etc.

This will allow a refactoring to clean up Pilot.cs

Detect Saf Disengag

Press "G" when the blue text is detected, boost, cut throttle, request docking. If the player has a docking computer this will make the whole trip completely automatic.

VR integration

See if the detection still works in VR. Would be really cool to have the control panel an in-world window!

https://github.com/Hot rian/OpenV RDesk topDisp layPortal/releases

Handle inter dic tions?

Hahaha so I must have been dict ed on the last trip because my ship was at 41%.. but it survived, it must have jumped. The jump count was off by 1 too, the dict must have started after the charge.

Such a stupid mechanic.

Anyway, there are a few possible solutions here, which all rely on being able to detect a dict:

  1. kill process (very safe)
  2. only point at the destination at the last second (antialign before aligning, after charge starts?) -- doesn't help with cruise dicts
  3. handle it properly, by dropping mines?
  4. boost + jump immediately?

Detect faceplant

Jump time is so variable now that a timed wait is no longer satisfactory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.