• Frenchgeek@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    2 days ago

    I’m writing a script that automatically take screenshots of the desktop (in particular the Minecraft game window) and then use OpenCV to do template matching to recognize if I’ve caught a fish or not.

    If I use any usual screenshot capabilities of any python library, I simply cannot take pictures fast enough (at least 10 images per second) to have the script work (under Wayland the usual system top out at 2 images per second).

    The only way fast enough I’ve found so far is to use Pipewire to create a livestream of the desktop and get frames of it to do the job.

    And it is a complex mess. (At least I’ve found a (very basic and badly documented) library to do most of the work instead of having to work it all through Dbus myself.)

    It’s just that what once was a single line in my previous X11 script is now a full on script by itself, and I understand almost nothing of it.

      • Frenchgeek@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        1 day ago

        The alternative is to create a multiplayer bot that directly speaks the network protocol. Mine simply looks for the relevant subtitles when fishing, and use template matching avoid bringing out a full on OCR. Others use audio cues to work. There’s no real simple way to solve the problem there. Unless Mojang manage to make fishing not boring.