Code Monkey home page Code Monkey logo

Comments (6)

emiln avatar emiln commented on July 28, 2024

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.

emiln avatar emiln commented on July 28, 2024

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.

emiln avatar emiln commented on July 28, 2024

After some deliberation and a chat with @PoliGamiOn, I'm actually leaning towards a percentage-based solution again.

from cljck.

emiln avatar emiln commented on July 28, 2024

Some thoughts on actually finding the game window's borders:

Take a screenshot and pick n random coordinates within it.

  1. 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.
  2. 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.

emiln avatar emiln commented on July 28, 2024

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.

emiln avatar emiln commented on July 28, 2024

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)

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.