Valor Bot is a chatbot focussed on giving a natural l interface for the user to build teams and answer questions about VALORANT Esports players.

Note: I was once an avid Valorant player with Brimstone as my main.

New Updates

Preparing the data

Instead of building a system to analyse the json files as it is, I planned to extract the relevant data out of the files and insert it into a database. I chose to go with postgresql due to easier availability and out of box support for vector embedding.

I built an extraction script with node.js and ran it as a lambda function to avoid downloading the huge data t my local pc. Below is the schema of the database

Entity Diagram

The "game_round_results" holds all the data extracted from the json files. Every record in the table corresponds to a player's performance in a single round of a game. I calculated Kills, Deaths, Assists, Damages, KAST, First Kill, First Death, Clutch Won/Played etc from the json data. I also built an algorithm to give rating to the user.

Rating algorithm

For the LLM to pick the best player for the team a ranking system was needed. Initially I planned to just use the total kills and k/d ratio for this. But it didn't make much sense as killing is not the only contribution a player makes in a game like valorant. I went through the article VLR.gg player rating explained and derived a algorithm of my own based the idea obtained from the article and the available data.

Ranking Algorithm

where,

APR Formula ADRa Formula

I gave a approx value for constants and came up with the final formula like this

(0.6 * kills) + (0.15 * (assists / rounds)) + (0.15 * ((damages - kill_damages) / rounds)) + (0.1 * kast) - (0.1 * deaths)

This took into account the kills, assists, damages, kill_damages and kast to give a better rating to the user. Damages done during a kill is reduced from the overall damage as kill is already added to the score. It also considers death as a negative contribution and reduces the rating appropriately.

Multi-agent System

This is built as a multi agent system. I planned to build separate agents like Player Agent, Team Agent, Game Agent, etc. But for now I have created two agents Team Agents and Player Agents. I used AWS's multi agent orchestration system https://awslabs.github.io/multi-agent-orchestrator/

I used AWS's Bedrock Agent with Claude 3.5 Sonnet to create the Team Agent. I utilized the agent action to give a provision for the LLM to fetch the data from the database. It is linked with a lambda function to fetch the appropriate data form the database and send it back to model.

Basically, I built a RAG system with the help of Bedrock Agent. I didn't train a model but rather decided to stick with prompt engineering and function calling support of the LLMs.

Team Agent

All team related tasks are carried out by Team Agent.

This has two actions configured in it - get_players and display_team.

The get_players is used to fetch the players ranked by their rating based on the given parameters. It has the parameters condition, limit, and order. The condition is a SQL query WHERE condition. The limit is the number of records to take. The order is the ORDER BY part of SQL query.

When a user asks a question like built me a team with all pro players. The agent knows that pro players belong to vct-international league. It does 4 function call for each each role in vct-international league. The function returns the top ten player with highest rating in the given role and given league. So now it has 40 players with 10 each for the role. Now the agent will make a decision based on the data. I was impressed by the results when I got a responses like this,

I've composed a team that focuses on inclusivity while maintaining competitive strength. Here's the team structure and the advantages of this inclusive team:

1. Zachary "zekken" Patrone (Duelist, NA) - A young talent from North America, bringing dynamic gameplay.
2. Enes "RieNs" Ecirli (Controller, EMEA) - Representing the EMEA region, adding strategic depth to the team.
3. Kim "Karon" Won-tae (Sentinel, KR) - Bringing Korean tactical expertise to secure sites.
4. Ričardas "Boo" Lukaševičius (Initiator, EMEA) - Part of a sibling duo, adding unique chemistry to the team.
5. Dominykas "MiniBoo" Lukaševičius (Flex, EMEA) - Boo's brother, providing versatility and familial synergy.

The user can ask for an explanation or further refine the team in the conversation. The next step is to display the obtained text response and the player list to the user. To display the player list the agent calls the display_team. Here instead of linking it with a lambda function I configured it to return control to my system.

It has a parameter players which is an array of player details like id, region etc. Based on that data I display the player list in UI.

Player Agent

All player related tasks are carried out by Player Agent.

The actions available are get_players_performance, search_player and get_players_performance_by_map.

The get_players_performance returns the performance of the given players. It has parameters playerIds and days. The playerIds is an array of player ids for which the performance data should be fetched. The days is the number of days from today the performance of players to be fetched.

The search_player is used to search for a player and get the player id. It uses a combination of vector search + full text search to find the relevant player.

The get_players_performance_by_map is used to get the performance details of players grouped by map they played in. It has parameters playerIds and days. The playerIds is an array of player ids for which the performance data should be fetched. The days is the number of days from today the performance of players to be fetched.

The Player Agent will handle queries like how did aspas perform in last 4 months or how good is riens in abyss.

Web App

The chatbot is a web app built with Next.js and hosted in Vercel. I tried hosting it in AWS Amplify but unable to do so due to permission issue in accessing bedrock.

Challenges we ran into

The major challenge was the quota issue in AWS. I had to repeatedly create the agents in different regions due the quota suddenly dropping to 1 request per minute in the current region. The other issue was understanding the data itself. Being a large file and not well documented schema, it took a while for me understand the data and write the extraction script.

Accomplishments that we're proud of

Though it's still it needs some improvements, I am happy at the rating system I built. I initially built the system to rank players just based on number of kills and k/d ratio. But as I went into the rabbit hole I came to know about the intricacies of the ranking system and how much important is given to it. So, I explored more on that and came up with the algo.

What's next for Valorant Bot

Obviously to build the full multi agent system with all the agents. For long conversations we might hit a token limit. The memory feature in Bedrock Agent will help a lot for that, but its not yet available for Claude 3.5 Sonnet model so I was not able to use it. Will explore more on that as well.

Note: Due to the LLM cost involved with the app I am not publicly sharing the url of the app.

Built With

Share this project:

Updates