Wednesday, 21 August 2024

Tarkov Profile Parsed (ToastedSherpa)

I want to learn 🐍Python🐍, and following the approach of previous posts, I decided to do a fun project for it.

To find some motivation, I though it could be a good idea to do something related to the game Escape From Tarkov, for the ones don't know, it's a shooter-looter quite challenging.

💡Idea

The problem with this game is that, there are many cheaters. Most of the Discord servers related to this game, I am in, have like a channel dedicated for people to post screenshots of profiles that are suspicious.
The profile gives some statistics about the player, like the number of raids played, or the number of players killed. Here it's an example on how my profile in 0.14 wipe looks like:




I thought it could be fun to make a Discord bot that parses that image to extract player's information, in order to check if there is like a way to "identify" patterns in those profiles.

👷Implementation

So, basically the profile picture has always the same format. On the left side you have the picture of the player and the name, and on the center and right side you have the achievements and more statistics.
We are going to focus on parsing the left side of the screenshot.

For that we are going to use OpenCV, to manipulate the image to being able to extract data from it, and Tesseract (and open-source OCR), to convert the manipulated image to text.



Parsing The Name

The name is always in the same position, at the bottom of the player's image. So we can crop that part to make it easier for the OCR.
Tesseract has problems to identify characters in a black background, so in order to facilitate that, we are going to make the image black and white, and invert the colours.

This is the code used:


def transform_name_image(cropped_image: cv2.typing.MatLike) -> cv2.typing.MatLike:
  bw_image = cv2.cvtColor(cropped_image, cv2.COLOR_RGB2GRAY)
  return cv2.bitwise_not(bw_image)

def parse_name(image) -> str:
  cropped_image = crop_name(image)
  transformed_image = transform_name_image(cropped_image)
  output = pytesseract.image_to_string(transformed_image)
  return parse_name_output(output)
With these changes, Tesseract is able to guess the name properly.


Parsing The Level

Same principle to parse the level, but in this case, we are going to tell Tesseract that it should find only numbers in the parsed image.

Parsing Extra Info

TODO

Technologies/Frameworks Used:

🔗References



Tuesday, 20 August 2024

Tarkov Team Kill Tracker

I want to learn 🦀Rust🦀, and for that I decided to do a fun project.

I confess I really like the game Escape From Tarkov, for the ones don't know, it's a shooter-looter quite challenging.

Here you can find a video of me, killing one of the most difficult bosses in the game, Killa:



When you play with friends, there is no way to identify who is your teammate (apart from asking questions like: is that you?, are you in <insert place>?). 

For that reason, it's quite common to have team kills. 👀

💡Idea

I though it could be a good idea to create a Discord bot to keep track of the team-kills that happens. To make it a bit more fun it could have achievements. I came up with some of them, as an example:

  • 🎉First team kill registered🎉
  • 👺Killed by five different friends👺
  • ...
Also, to promote people using this bot, I though it could be nice if the "killer" get roasted by that team-kill. So then, once the team kill is registered, ChatGPT would reply to the command by roasting the player that made the team-kill.

👷Implementation

The flow is the following:
  1. User registers who team-killed him using a discord command: > /tk @Manuelarte
  2. App registers the team kill and
    1. Checks for achievements
    2. Requests to ChatGPT a Roast to the user.
    3. Replies the message to the author plus the achievements achieved with that team-kill.


Technologies/Frameworks Used:

Here is a list of some of the libraries used for this project:

 🙌Introducing GitHub Kudos One thing about being a developer, is how frustrating the job search process can be. One of the things I encount...