marcincichocki / breach-protocol-autosolver Goto Github PK
View Code? Open in Web Editor NEWSolve breach protocol minigame in second(s). Windows/Linux/GeForce Now/Google Stadia. Every language.
License: MIT License
Solve breach protocol minigame in second(s). Windows/Linux/GeForce Now/Google Stadia. Every language.
License: MIT License
@/core
=> core functionality, sequence, solving, ocr. Platform agnostic. Move registry here@/common
=> common functionality, utils, helper fns, shared code@/common/node
=> nodejs shared code@/common/electron
=> shared electron code@/electron/main
=> main process@/electron/renderer
=> react@/electron/worker
=> workerimporting from @/core in renderer is problematic since its webpack configuration is not handling externals at all.
Besides, core should be neutral and have no node deps.
In some cases forms will be disabled(flag or status dependent).
TODO:
Icon will be used in electron setup, electron bin and tray.
If user start ocr not on breach protocol screen or ocr could not resolve symbols, we should skip current job.
ocr validatation could work like this:
const isGridValid = grid.every(s => ALLOWED_SYMBOLS.include(s));
Describe the bug
When using language like chinese or japanese(or other with custom font) ocr report errors.
To Reproduce
Set interface language with custom font and then try to use autosolver.
Expected behavior
Should work like it does with english interface.
Software information
Cyberpunk 2077 information
Additional context
Some kind of flexbox issue
remove old TODOS, refactor game, etc
remove node client, remove build from actions, remove build script
There are few edge cases that ocr testing doesn't cover now:
bpa should support multiple platforms because Cyberpunk 2077 can be played on linux/mac through proton/wine/stadia/geforce now.
TODO:
try upstream version on gforce now.
UPDATE: Recognition is working. Robot clicks in incorrect places(prob gnow issue with resolution). Tried scaling on/off, neighter works.
UPDATE 2: nircmd does not work well with gnow. Mouse moves into wrong places, and keyboard does not work at all. Possible solution is to implement different bin than nircmd(autohotkey?)
see if ocr works through compression
UPDATE works, might require fixed threshold.
see if outputs get send to stadia/gforce now
UPDATE clicks are send
UPDATE 2 keystrokes are NOT
see if stadia/gforce now support fullscreen and how it affects robot clicks UPDATE only tried gnow in app, and robot clicks in incorrect places.
add required native deps for linux/mac and update robot(xdotool and imagemagik on linux, use sudo-propmt)
update docs on required deps(imagemagik for linux)
research multiplatform release and builds
Buffer fragment uses brute force approach for its recognition. Since threshold changes image from white to black, image bits are kinda sorted. This means we can use binary search for significant boost in performance(worst case O(7) since even lowest gamma don't force threshold lower than 128).
UI needs custom form controls:
In new electron client, history feature will keep track of all attempted BPs. Source (png or jpg) can weight up to few MB which is unacceptable, therefore it's better to remove all sources for BPs that succeeded(failures are usefull for bug reports).
Sometimes, it's good to keep them(debug mostly) so it's useful to put it behind flag.
Describe the bug
Autosolver broke after successful ocr read
To Reproduce
Try to solve attached png
Expected behavior
Should solve it.
Software information
Cyberpunk 2077 information
EDIT: looks like bottleneck is sequence production(not enough fallback values). Also lack of error handling makes it weird for end user.
If worker has not finished loading, and user goes into settings, error will be thrown, since activeDisplayId is not yet set(first launch).
Furthermore updating settings outside of settings page can lead to incorrect values in form controls
ideas:
There are no tests for OCR which is vital part of this project. We should ensure that most common resolutions are supported:
That will propably require adjusting ./src/config.json
for each resolution. In worst case it would require retraning tesseract.
Day 1 notes:
.traineddata
because it's so bad(it's a miracle that it worked so well anyway)Day 2 notes:
It would be great idea to create debug mode. In that mode all screenshots would be saved along with ocr data. That would be invaluable for issue reproduction.
Stuff to do/research:
"C:\Program Files"
)Describe the bug
Max buffer size is 9 not 8(base 8 from cyberdeck + 1 from inteligence passive lv19). This cause every breach protocol to fail.
To Reproduce
Buy cyberdeck with 8 buffer and get level 19 in inteligence, than try breach anything
Expected behavior
Should work
Software information
Cyberpunk 2077 information
Additional context
History feature in electron app will require schema and migration configuration for future releases.
interface HistoryEntry {
id: string; // uuid
source: string | null; // path to source image(png or jpg) in `userData`. `null` if job succeded, unless flag is specified
dateStart: string; // when job has started
dateEnd: string; // when job has ended
options: ?; // with what options job was started
ocr: ?; // serialized BreachProtocolRecognitionResult map. *MUST* include base64 8bit fragment images. Should contain threshold?
sequences: Sequence[]; // list of produced sequences. Need toJSON method
game: BreachProtocol; // ? is this required?
result: BreachProtocolResult;
exitStrategy: ExitStrategy;
status: boolean; // ok/err
}
Describe the bug
After each usage of autosolver(successful) memory usage goes up, and doesn't decrease over time.
To Reproduce
Make screenshot of breach protocol, then open task manager and set it to be always on top, then open screenshot on full screen and run autosolver. Observe memory usage go up.
Expected behavior
Memory should be released after each run.
Software information
Cyberpunk 2077 information
Additional context
EDIT: Couldn't locate leak by node built it inspector, memory usage is stable while running from a script. Next attempt will require hooking up devtools into nexe binary somehow, this might be challenging since nexe won't build binary with tesseract debug flag, and that is required to launch devtools in the first place.
With removal of node client these dependencies are no longer required:
@octokit/rest
commander
inquirer
iohook
open
ora
sound-play
and these devDependencies:
@types/copy-webpack-plugin
@types/inquirer
concurrently
copy-webpack-plugin
nexe
nodemon
ts-node
tsc-alias
upx
(?)zip-a-folder
query github api and open link to asset if user said so(add inquirer question)
https://docs.github.com/en/rest/reference/repos#get-the-latest-release
https://github.com/sindresorhus/open
kill process afterwards
Using node binary as client has become way to much of a burden, withconstant updates, new features, flags etc. Creating new client in electron would give user simpler shortcuts, auto updates, explicit calibration and more.
It would be great if sound could be played when screenshot is taken to notify user about ocr success or error.
todo:
Clicking on key bind input, entering some combination and clicking outside cause incorrect keycombination to appear.
Either restore last combination or save current.
Is your feature request related to a problem? Please describe.
Clicking takes too much time, there is no point slowing computer down.
Describe the solution you'd like
boost delay from default 75ms to something faster.
Describe alternatives you've considered
none
Additional context
Describe the bug
If unused daemons overlap with sequence and there is space in the buffer, BP will not exit automatically.
To Reproduce
Use attached screenshot
Expected behavior
Leftover daemons overlap should be taken into account.
Software information
Cyberpunk 2077 information
Custom form control use defaultValue
prop, refactor to use value
Some dependencies cannot be included in the package like vc_redist.x64.exe, it should be noted in in readme or FAQ,
desktop-screenshot
have multi monitor support. Therefore it would be nice if we could support it as well. preferably by a flag like: --use-monitor n
Note: moving flag thing into separate issue, because there are a lot of flags that could potentially be implemented, and that overlap nicely with switch to commander
. For now, every time user launches autosolver it will inqueire about which monitor to use if there is more than one.
Stuff that CI/CD could help with:
Some daemons or more valuable than others, simple index order might not be sufficient. Also, there are cases in which there are 2 sequences with same amount of parts and same length. Sequence that will be chosen is kind of random(alphabetic order) which might not represent "weight" of sequence. For example, sequence with daemons of indexes 0,1 might be worse that 1,2. Ideal solution might require OCRing daemon type, which in turn require language recognition(might be slow).
Currently --debug-limit
flag and debug functionality in general only work when there is no OCR error which is counterintuitive.
Is your feature request related to a problem? Please describe.
When sequence length is shorter than available buffer, breach protocol doesn't exit automatically.
Describe the solution you'd like
Mini game should close when:
Describe alternatives you've considered
clicking on exit button or pressing esc is annoying
Additional context
When user have n
items in history, and changes historySize
option to number that is lower than n
than extra items will not be deleted.
Flags that have to be changed in some way:
--key-bind
electron is using different format--lang
(?) that would require i18n in react--skip-update-check
(?)Electron client settings:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.