Coder Social home page Coder Social logo

bf2autospectator's People

Contributors

cetteup avatar dependabot[bot] avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

nihlen benrotblut

bf2autospectator's Issues

Round end screen is sometimes detected as map loading

When the round end screen is visible between two rounds on the same map, the bot sometimes performs a map rotation reset because it determined that the map is loading. Due to the map reset, it then tries to spawn with random coordinates.

2022-11-15 12:41:19,090 INFO     Game is on round finish screen
2022-11-15 12:41:23,291 INFO     Game is on round finish screen
2022-11-15 12:41:27,493 INFO     Game is on round finish screen
2022-11-15 12:41:31,675 INFO     Game is on round finish screen
2022-11-15 12:41:35,842 INFO     Game is on round finish screen
2022-11-15 12:41:40,090 INFO     Map is loading
2022-11-15 12:41:40,091 INFO     Performing map rotation reset
2022-11-15 12:41:47,370 INFO     Enabling hud
2022-11-15 12:41:51,186 INFO     Determining team
2022-11-15 12:41:51,254 INFO     Spawning once
2022-11-15 12:41:51,474 WARNING  Spawn point coordinates not available current combination of map/size/game mode (None/-1/None), switching to spawn point coordinate randomization

It may make sense to base the map loading detection on histograms of the header icons/buttons instead of the current OCR approach.

Unhandled exception when conman is not found

When conman is not available (e.g. because it was removed based on an AV detection false positive), the bot crashes due to an unhandled exception.

2022-12-03 00:51:47,107 INFO     Starting new game instance
Traceback (most recent call last):
  File "BF2AutoSpectator\spectate.py", line 636, in <module>
  File "BF2AutoSpectator\spectate.py", line 225, in run
  File "BF2AutoSpectator\game\instance_manager.py", line 91, in launch_instance
  File "BF2AutoSpectator\game\instance_manager.py", line 77, in prepare_game_launch
  File "BF2AutoSpectator\common\utility.py", line 428, in run_conman
  File "subprocess.py", line 503, in run
  File "subprocess.py", line 971, in __init__
  File "subprocess.py", line 1440, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
[7532] Failed to execute script 'spectate' due to unhandled exception

Bot sometimes clicks outside the game window

Since the game is running in windowed mode, the bot can move the cursor anywhere on screen if it's in the menu/on the loading screen. In rare cases, it does move the mouse outside the game windows and clicks there. At least I noticed the bot being paused due to text in Powershell being highlighted without any recent user login on a headless VM.

Possible solution: ensure cursor is within game window rectangle before executing any clicks.

Bot randomly detects map loads/end of round during the game

The recently updated end of round screen detection based on histograms (Detect map loading based on eor screen item histograms) is leading to some false positives. The eor screen is randomly detected mid game, leading to a map rotation reset followed by a random-based spawn (map info is reset by rotation reset and thus not available).

Related to #31

2022-11-24 15:14:18,759 INFO     Nothing to do, stay on player
2022-11-24 15:14:21,521 INFO     Rotating to next player
2022-11-24 15:14:22,497 INFO     Game is on round finish screen
2022-11-24 15:14:29,336 INFO     Enabling hud
2022-11-24 15:14:33,318 INFO     Determining team
2022-11-24 15:14:33,384 DEBUG    Detected team is 1
2022-11-24 15:14:33,384 DEBUG    Current team index is 1 (MEC/CHINA/...)
2022-11-24 15:14:33,384 INFO     Spawning once
2022-11-24 15:14:33,589 WARNING  Spawn point coordinates not available current combination of map/size/game mode (None/-1/None), switching to spawn point coordinate randomization
2022-11-24 15:14:33,589 INFO     Attempting to spawn by selecting randomly generated spawn point coordinates

This issue is a 0.6.5 regression.

Normal gameplay is detected as default camera view

Normal gameplay is sometimes detected as the default camera view, causing additional switches between players. This is most common on maps with very strong/uniform color schemes (Operation Smoke Screen, Mignight Sun). Due to the uniform colors, random gameplay screenshot's histograms are often very similar to the default camera view histogram.

Possible solutions/improvements

  • improve default camera view detection by splitting screen into multiple histograms, all/most of which have to be similar to the known default camera view
  • do nothing when default camera view is detected once/base default view detection on multiple screenshots (similar to afk detection)

Bot falls back to random spawn when map rotation stays on same map

When the server switches to the next level and that next level happens to also be the current level, the map rotation reset removes details required for non-random spawning. However, since the game is staying on the same map, it does not reload it. Thus, the end of screen stays stays on the score list before entering the game again. The map briefing never becomes visible.

Possible fix: Actively open map briefing if on eor screen and join game button is visible.

Bot gets stuck if server disconnect fails

If the bot continuously fails to disconnect (e.g. because the disconnect/join now button area is blocked by something like the cursor), it never recovers and just keeps trying to disconnect.

Possible solution: Restart game after 1-2 disconnect attempts.

Mouse cursor sometimes freezes on spawn menu

The bot sometimes gets stuck on the spawn menu because the cursor stops moving. It is completely unclear what is causing this, it could be that the game window is not focused properly. Or the cursor get's stuck somehow.

Possible workaround: Check whether cursor is desired position after issuing the move command. If not, restart the game (after a few tries).

Keeps trying to connect

I installed the latest stand-alone version. After starting the controller, it is starting BF2 with the correct username, it selects the multplayer server list and from there it keeps telling "connecting to server, re-connecting to server etc
It is not connecting to the gameserver.

Send details about current state to controller

The controller currently has extremely limited information about what the bot is doing. In order to e.g. be able to run ads during map loads, the bot needs to send details about the current state to the controller.

It should at least send details about:

  • game restarts
  • round ending (including result?)
  • spawning
  • getting kicked/banned
  • other important in-game error messages

Randomize spawn flag is not reset if bot never fully entered the map

If the bot sets switches to radomizing spawn coordinates and does not spawn before the next map loads, the randomize flag is never reset.

The map rotation reset, which resets the flag, is not triggered in such cases.

elif mapIsLoading:
logger.info('Map is loading')
# Reset state once if it still reflected to be on the (same) map
if gis.rotation_on_map():
logger.info('Performing map rotation reset')
gis.map_rotation_reset()
time.sleep(3)

The map rotation reset should probably be run when the map changes without ever entering it.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/release.yaml
  • actions/checkout v4
  • actions/setup-python v5
  • softprops/action-gh-release v1
pip_requirements
requirements.txt
  • Pillow ==10.1.0
  • PyAutoGUI ==0.9.54
  • numpy ==1.26.1
  • opencv_python ==4.8.1.78
  • pytesseract ==0.3.10
  • requests ==2.31.0
  • pywin32 ==306
  • psutil ==5.9.6
  • python-socketio ==5.10.0
  • jellyfish ==1.0.1
  • obsws-python ==1.6.2

  • Check this box to trigger a request for Renovate to run again on this repository

Bot stays on itself after respawn if player rotation is paused

If the bot respawns while the player rotation is paused, it stays on itself after the spawn-suicide.

Instead, it should either:

  1. switch to the next player and stay on them
  2. switch to the next player and continue the player rotation, since it is very unlikely the camera will be on the player the rotation was paused on before the respawn

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.