-
Notifications
You must be signed in to change notification settings - Fork 37
Bot State's
The state is generated by the detector.
It is very fast, taking about 0.5 seconds to return the state.
It consists of 5 sub-detectors: card, screen, unit, number and side.
To work out what cards we can play, we use the card_detector.
Before the game starts, an image of each card in the deck is hashed.
Then when the detector is run, we hash the screen at each card position and compare it to the precomputed hashes.
To automate moving from between end of game screen, the lobby and the game, we use the screen_detector.
Again, we do this by comparing hashes of various parts of the screen.
If we're in the lobby, the chest icon is at fixed position.
If we're at the end of the game, the OK button is at a fixed position.
Otherwise, we assume we're in game.
To work out what units are in the battlefield, we use the unit_detector.
It uses YOLOv10 (an object detector), trained on many labelled screenshots. The ONNX runtime is used to perform fast inference.
Here you can see the confusion matrix of the performance. If you are interested in a certain deck where your cards have not been labelled, post your deck in the Issues section and I'll see what I can do.
To work out what the numbers are, we use the number_detector.
Again, it uses YOLOv5 and is trained on various fixed crops of the screen (4 for the princess towers, 2 for the king HPs and 4 for the king levels).
We make all the crops the same size, so that ONNX can perform batched inference.
To work out if the unit is an ally or an enemy, we use the side_detector.
It isa small CNN that runs on 16x16 images. We assume that the unit is an enemy if the unit is not in our deck.