I just stumbled across this article describing how to milk-run with automation:
http://www.jeffmcaffee.com/creating-a-simple-bot/
Impressive, the concept works by simply pushing keyboard events into Oolite. Plus the script looks at the screen to validate where it's going. Just like - ummm - me when flying here and there.
Would that be a base for an OXP or be more suitable for an external tool as it is now? Or should we pretend it does not exist? Or is this a job for the debug console?
Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.
More details in this thread.
Autopilot for Oolite
Moderators: winston, another_commander
- hiran
- Theorethicist
- Posts: 2150
- Joined: Fri Mar 26, 2021 1:39 pm
- Location: a parallel world I created for myself. Some call it a singularity...
Autopilot for Oolite
Sunshine - Moonlight - Good Times - Oolite
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4729
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: Autopilot for Oolite
You could OXP the entire thing, if you wanted, without needing to use an external tool. If fact, you could do it better, because you could interrogate the game state in a far more exhaustive and accurate way.
I'd challenge the idea that the script is looking at the screen. The script is "assuming" a certain game state based on the results of keypresses beforehand. For instance, the script to buy/sell furs will fail every time if you have SW Economy installed, which adds 3 extra commodities. The script is not checking to see if "Furs" is highlighted - it's "assuming" furs is highlighted because in the default game that's where you end up if you press "8" and then "down arrow" 11 times.
- hiran
- Theorethicist
- Posts: 2150
- Joined: Fri Mar 26, 2021 1:39 pm
- Location: a parallel world I created for myself. Some call it a singularity...
Re: Autopilot for Oolite
That's what I thought as well. And then I thought we might want to create a custumizable set of autopilot maneuvers, with one of the possibilities being the milk run. Another one could be evading pirates.
If done properly we could even communicate the game state as text and feed it into a generic pre-trained processor to see what keys it would press.
I referenced the first of four pages. On the third this guy discusses taking screenshots and interpreting those. That is necessary to reliably navigate to the planet/station. And may be reused elsewhere.phkb wrote: ↑Tue May 14, 2024 10:19 pmI'd challenge the idea that the script is looking at the screen. The script is "assuming" a certain game state based on the results of keypresses beforehand. For instance, the script to buy/sell furs will fail every time if you have SW Economy installed, which adds 3 extra commodities. The script is not checking to see if "Furs" is highlighted - it's "assuming" furs is highlighted because in the default game that's where you end up if you press "8" and then "down arrow" 11 times.
With that technology he can create autopilots for any game.
And this seems to have worked. The guy published the scripts here: https://github.com/jmcaffee/oolite_bot
I have not tested them though.
Sunshine - Moonlight - Good Times - Oolite
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4729
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: Autopilot for Oolite
The trouble is, this method is completely dependent on a number of factors:
(1) The screen size *cannot* change. He even says so: "As long as you always play with the game window at the same size, these coordinates will not change." So, every instance of the autopilot would need to be customised for the local game window.
(2) The HUD cannot change. He is assuming the space compass will be in exactly the same location, with the exact colors as he used to build the script. Any deviation from that standard and you need to reconfigure the script to work with the new layout.
(3) The list of commodities cannot change. The script expects Textiles to be after food, then radioactives, then slaves, and so on. Any additional commodities that throw out this order will result in breakage.
While his method is clever and instructive, and achieves his goal within a limited set of parameters, I can't see this method coping with the mix of mods that tend to get loaded. It's really only effective for the base game, and even then it's limited to a fixed game window.
If you're after a fully integrated auto-pilot/auto-trade system, our scripting environment is much better suited to the job.
- hiran
- Theorethicist
- Posts: 2150
- Joined: Fri Mar 26, 2021 1:39 pm
- Location: a parallel world I created for myself. Some call it a singularity...
Re: Autopilot for Oolite
Yes I also believe what he achieved could have been done better in an OXP. He took a different approach and that's what I like:
He controlled Oolite without requiring internal knowledge.
He used simply Bash and a few command line tools.
Likely I'd not try to OXP this as that would be quite a lock-in. OXPs cannot access the disk or network.
Via debug console this could be controlled from outside yet still have access to the game's internal state.
He controlled Oolite without requiring internal knowledge.
He used simply Bash and a few command line tools.
Likely I'd not try to OXP this as that would be quite a lock-in. OXPs cannot access the disk or network.
Via debug console this could be controlled from outside yet still have access to the game's internal state.
Sunshine - Moonlight - Good Times - Oolite