Comments (6)
What's preferable, come to think of it: pixel coordinates inside the window or a percentage of the width and height? The former avoids issues of precision, while the latter scales obviously to different resolutions. I would really like to have both properties. My 4k monitor allots twice the amount of pixels in both directions for the game window due to high-DPI scaling compared to a regular monitor, and ideally a script should work flawlessly on both.
All of the above pertains to relative coordinates of course.
from cljck.
I think it is preferable to work with pixels, so perhaps a sort of "normalized pixel" coordinate is tolerable to work with. You'll use coordinates as if the window was scaled normally, and the bot will know how to scale the coordinates to possibly bigger or smaller actual game windows. I can't think of a better way of doing it at this point.
from cljck.
After some deliberation and a chat with @PoliGamiOn, I'm actually leaning towards a percentage-based solution again.
from cljck.
Some thoughts on actually finding the game window's borders:
Take a screenshot and pick n random coordinates within it.
- Calculate the fitness of each coordinate. If the best coordinate has optimal fitness, assume we've found the point we're looking for and stop.
- Pick the n/3 best coordinates so far ranked by fitness + n/3 random coordinates + mutations of the n/3 best coordinates. Repeat 1.
An idea for fitness could be the following:
Sample both a horizontal and vertical line centered on the pixel and see how many pixels match the background color of the area around the game window. The contributes positively to fitness.
Sample the pixels below and to the right of the pixels. These should not match the background color above.
Assuming we find a pixel of optimal fitness, it should be the pixel next to the top left corner of the game window. From here it should be easy to trace the outline of the game window.
from cljck.
The approach described above almost works. When hitting the left side of the game window border, however, there is no increase in fitness by moving slightly up towards the upper left corner, so the generations don't gravitate towards the corner. They remain somewhere on the left border unless you're really lucky. Fitness should have added how many pixels down there's a game window to the immediate right of the coordinate, perhaps.
from cljck.
This is proving a fairly large task, which is something I by no means have the time for at the moment. I'm closing this for now due to lack of time.
from cljck.
Related Issues (20)
- Process files with scripted events. HOT 1
- Ability to assess similarity of images. HOT 1
- Boot task to create uberjar capable of processing EDN files
- Send key presses HOT 1
- Issue with "kill switch"
- Allow the processing of multiple script files.
- Write a README
- Conditionals
- Ability to scroll HOT 1
- Symbols instead of keywords? HOT 1
- Compare area on screen to histogram
- Add "while holding" command HOT 1
- Update JNativeHook HOT 1
- Add "with-killswitch" command
- Add `with-game-borders` command
- Remove the GUI
- Fix the removal of gen-class
- Add the library on Clojars HOT 1
- Global keybinding to stop processing events HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cljck.