Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

fn-auto-queue

Python script that watches the Fortnite game window and reacts to what it sees on screen:

  1. In the lobby it clicks READY.
  2. In the match it watches the squad list (bottom left). When the chosen teammate (the target) disappears from the list, it presses ESC, opens the hamburger tab and clicks Return to lobby.
  3. On the match recap screen after an elimination (RETURN TO LOBBY / PLAY AGAIN) it clicks Return to lobby.
  4. On a reward screen (for example "TREASURE FOUND!") it clicks CLAIM or CLAIM ALL.
  5. Back in the lobby the loop starts again.

Requirements

  • Windows 10 or 11 with an English OCR language pack (installed with English display language; otherwise run in an admin PowerShell: Add-WindowsCapability -Online -Name "Language.OCR~~~en-US~0.0.1.0").
  • Python 3.10+.
  • Fortnite set up as described in Fortnite settings.

Fortnite settings

The script finds buttons and text at fixed positions and reads English words with OCR, so change these settings in Fortnite before the first run:

Setting Where Value Why
Window Mode Settings > Video > Display Windowed The script captures and clicks inside the game window
Resolution Settings > Video > Display Any 16:9 size, for example 1280x720 or 1920x1080 Positions are defined for 1280x720 and scaled; other aspect ratios shift them (the console warns)
Language Settings > Game > Region & Language English Detection looks for English words such as READY, SHOP, RETURN TO LOBBY
HUD Scale Settings > Game UI > HUD 100% (default) The squad list and health bar are expected at their default size and place
HUD elements Settings > Game UI > HUD Squad list (teammates) and own health bar on The squad list is used to watch the target; the health bar tells the script it is in a match
HUD layout HUD Layout Tool Default layout Moved HUD elements are not found

Also keep the game window visible on screen, not minimized and not covered by other windows. With move_window_to_origin on, the script moves the window to the top-left corner of the screen.

Setup

py -3 -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt

Run

Easiest: double-click run.bat. It:

  • pulls the latest version from GitHub (fast-forward only; skipped when offline, when there are local changes, or with run.bat --no-update),
  • finds Python 3.10+ and creates .venv if it is missing or broken,
  • installs requirements.txt whenever it changed since the last install,
  • starts auto_queue.py.

If the folder came from a ZIP download, run.bat links it to the GitHub repo on the first start (needs Git for Windows). config.json is never touched.

Manual start:

.\.venv\Scripts\python.exe auto_queue.py

At start the script asks for the target player name. The name is saved in config.json; on the next start press Enter to keep it, or type a new name.

The console UI is coloured (rich): a banner, a settings panel, a colour-coded event log (STATE, ACTION, OK, WARN, ALERT) and a live status bar at the bottom with the current state, target status, check time, leave count and uptime.

Stop: F8, or Ctrl+C in the console. Moving the mouse into a screen corner also aborts (fail-safe).

Before every click or key press the script brings the game window to the foreground. If that fails, no input is sent.

How detection works

All positions are defined for a 1280x720 client area and scaled to the real window size. Detection uses the Windows built-in OCR (no extra install, about 40 ms per read) plus a pixel colour check:

State Detection Action
No window Fortnite window not found or minimized wait
Lobby (any) OCR finds at least 2 of SHOP, LOCKER, QUESTS, ... in the top bar –
Lobby, not ready lobby + READY in the left panel + yellow button pixel click READY
Lobby, party in match lobby + WATCH button (party members still in a match) no click
Lobby, waiting for party lobby + CANCEL + Waiting for Players, cream button pixel wait
Lobby, matchmaking lobby + CANCEL (for example with Finding Server), cream button pixel wait
Loading OCR finds CONNECTING / LOADING bottom left wait
Error dialog OCR finds CONTINUE in the screen centre on a yellow button (e.g. "There was a problem – Network Connection Lost"); checked first click CONTINUE
Reward screen OCR finds a button with CLAIM in it (CLAIM or CLAIM ALL) at the bottom centre, cream button pixel click it (the screen closes after a short animation)
Match recap OCR finds RETURN TO LOBBY and PLAY AGAIN on the right click Return to lobby
In match OCR reads names in the bottom-left squad list, or the own health bar is visible watch target (only once the battle bus was seen)
Unknown none of the above (transitions) wait

Leave logic. Every error is designed to keep the bot in the match, not to make it leave:

  1. Nothing is watched on the pregame island, where players load in late and drop out of the squad list. The key prompt right of the screen centre is read instead: Space TO JUMP marks the battle bus (the falling prompts ENTER FREE FALL / TO DEPLOY ... also show on pregame launch pads, TO JUMP does not). By the bus every player has loaded in, so the tracker starts there. If the bus is never seen, it starts bus_gate_timeout_sec after the match loaded.
  2. The tracker is armed only after OCR has read the target name in this match.
  3. When the target is read, a pixel template of the name is saved.
  4. A check counts as "missing" only when both checks fail:
    • OCR (up to 4 preprocessing variants merged, the last one inverted with high contrast) does not read the target, and
    • the saved name template is not found at its row, or at a row shifted by whole row steps (the list moves when someone above leaves).
    • the target's row is gone: when OCR reads the name cleanly, a pixel template of the portrait left of the name is saved (position relative to the name, in row heights). If the portrait is still found and no other name is read in that row, the row is still there (name greyed out, covered, or red because the target was eliminated) and the check does not count. An eliminated target (red name, reboot timer) counts as gone only when leave_when_target_dead is true.
  5. A check counts only when another squad member is visible. Names that look like an OCR misread of the target are never used as such a reference.
  6. With no other squad member visible (duo, or the list collapsed because the teammate is far away), the own health bar is the reference. A full-screen OCR then searches for the target name, for example in the screen-edge marker < Name that Fortnite shows instead of the list. A check counts only if the health bar is visible and the name is nowhere on screen. If the HUD is hidden (map open, spectating), nothing is counted.
  7. The bot leaves after 5 counted checks in a row and at least 1.5 seconds (4 seconds when only the health bar was the reference). Any sighting of the target resets both.

Speed. In a match, while the target is visible, each check is only a screen grab and a pixel template match (about 5–15 ms), repeated every 50 ms. OCR runs only when the template does not match, plus every 3 seconds to refresh the templates. The squad list OCR stops after the first variant that reads the target and every known teammate; all variants run only when a name is missing. The leave menu is polled every 50 ms, so ESC → hamburger → Return to lobby fires as soon as each step is on screen. In tests the leave started about 1.6 s after the target's row disappeared. Raise missing_seconds_to_leave for more safety, lower it for more speed.

Names are compared in a normalized form (lowercase, no accents, lookalike letters such as ø, ł or Cyrillic а mapped to Latin, letters and digits only, and characters OCR often swaps folded together: y/v/u, 0/o, 1/l/i, 5/s) with fuzzy matching, because OCR often mangles accented letters and the Fortnite font.

Debug screenshots

With debug_screenshots on (default), each run writes to debug/<date_time>/: a PNG of the game area plus a .txt with the OCR text and tracker scores, for:

  • every state change and READY click,
  • the target being armed,
  • every counted "missing" check,
  • battle_bus: bus prompt first read, which starts the watch,
  • ocr_miss_pixel_present: OCR missed the target but the template still saw it (the case that caused false leaves before; max one per 5 s),
  • hud_hidden (max one per 10 s),
  • target_elsewhere: target found only by the full-screen OCR (max one per 10 s),
  • target_row_present / target_row_dead: name not read, but the target's portrait row is still in the squad list (max one per 10 s),
  • click_recap_return: Return to lobby clicked on the match recap screen,
  • click_error_continue: CONTINUE clicked on an error dialog,
  • click_claim: CLAIM / CLAIM ALL clicked on a reward screen,
  • the last 15 in-match frames before a leave (before_leave_histNN) and every menu step.

Replay a run offline:

.\.venv\Scripts\python.exe auto_queue.py --test debug\20261126_201300 --target Ivakaa

Settings (config.json)

Key Default Meaning
target_player – Teammate to watch
check_interval_sec 0.5 Time between checks outside the fast in-match loop
fast_check_interval_sec 0.05 Time between checks in a match while watching the target
ocr_refresh_sec 3.0 OCR re-read interval while the target is visible
missing_checks_to_leave 5 Consecutive counted misses before leaving
missing_seconds_to_leave 1.5 Minimum time the target must be missing before leaving
missing_seconds_hud_only 4.0 Same, when only the own health bar is the reference (duo or collapsed list)
bus_gate_timeout_sec 300 Start watching this many seconds after the match loaded even if the battle bus was never seen
leave_when_target_dead true Target eliminated (red name, reboot timer) but still in the match: true leaves, false stays until the target's row disappears (the target left)
debug_screenshots true Save debug screenshots into debug/
name_match_threshold 0.75 Fuzzy name match score (0–1)
ready_click_cooldown_sec 4.0 Minimum time between READY clicks
skip_press_cooldown_sec 1.5 Minimum time between SPACE rounds on the placement screen
move_window_to_origin true Move the game window to the top-left corner of the screen (0, 0) when it is found

Testing detection on screenshots

.\.venv\Scripts\python.exe auto_queue.py --test images\Ingame.png --region 640,336,1280,720 --target Ivakaa

--region x,y,w,h is the game client area inside a full-desktop screenshot. Leave it out if the screenshot contains only the game.

Not handled yet

  • Local player eliminated or match ended before the target leaves.
  • Other lobby edge cases.

Reference screenshots

Screenshots go in the images/ folder. This folder is in .gitignore and is not committed; it is local reference material only.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages