I went down a rabbit-hole of trying to make a Python program that can play Valorant using computer vision and some radio shenanigans.
More details, errata, etc.: www.riveducha.com/valorant-ai...
Radio dongle: CrazyRadio PA amzn.to/3GDzEhb
This video intentionally doesn't go into too much technical detail - not sure if that's something people want or not. I tried to present enough so that you can at understand what this bot can and can't do, and also understand some of the problems it's having. And if you don't play Valorant, hopefully the premise is understandable - shoot the bad guys.
If you're worried about this being a hack, you can rest easy. It's not like a wall hack where it looks at Valorant's process memory to get information that's supposed to be secret. The bot's not at the level of advanced Valorant strategy right now, but I have lots of ideas for future development.
Software used include:
* labelImg - used for labeling the data set
* PyTorch - similar to TensorFlow
* NumPy - amazing library for working with matrices
* OpenCV - great library for doing some image processing (in conjunction with NumPy)
* Google Colab and Jupyter Lab - great for exploratory programming, especially when working with images
* PySide2 - y u conflict with torchvision dependencies??
Some people doubted that the OpenAI shell video I made was real despite the mediocre results shown, so I hope that by showing even worse results in this video more people will believe it's real.
Also, follow me on Twitter: @riveducha - / riveducha
Images:
Human Brain clip art: CC-BY 4.0 SykesOffice commons.wikimedia.org/wiki/Fi...
Music:
Corbyn Kites - Shadowing
"Inspired" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0 License
creativecommons.org/licenses/b...
NoMBe - Take Me Down to the Fashion Show
Kwon - Pluckandplay
...but why? Why do any of this?
cuz it's interesting AF
you're more than a year late to ask that homie
@@jazzWF Its a question unbound by time
Cause computer vision is awesome!
Because he can.
It's amazing how you can easily replicate my teammates in comp
lmaoo absolute gold comment. This should get pinned HAHAHA
Yes
He should make a neon bot that sprints into the enemy's spawn with spike lmao
@@zem0ku605 what rank are u?
1to1 replica
This video made me understand why my friends call me a bot.
105 likes No comment.After 1 year let's fix it.
Lol
@@reportagebykonstantinos8030 agree
4 comments
LMAO
Calling Valorant a csgo gamemode is the funniest and most fitting description of the game I've ever heard
the AI is like a noob and a pro fighting over the controls. you're getting close.
Just got this recommended. Really good work! I am impressed by the performance you can achieve with transfer learning on your "small" annotated Valorant dataset. You still remember how high the performance for different objects was on your test set (accuracy or MAP if you have computed that)? It also really hurt me not seeing your model TURN upon hearing someone behind :D Would really love to see you including audio next, and then seeing some nice 180 flicks in version 2.0.
reocmmended
Anyone else just get recommended this video 1 year later? Great video btw
Yes
When i was doing my project with computer vision, I gained almost x10 performance increase just by downscaling input image by some ratio. Of course, it lowers the accuracy of results, but, sometimes full resolution is MUCH bigger than enough and downscaling isn't going to affect the results at all. So, by downscaling input images you can boost performance for free by finding the optimal level of downscaling.
One thing I thought you could do is make it so a label has to show up for 150ms (roughly a standard pro reaction time) - that way it doesn't shoot at every 1 frame ghost it thinks it sees, but only at persistent threats - and also it makes it seem more realistic and human-like by having somewhat realistic reaction times. You could also have it move the aim slowly over time in trial movements until it's over the top of the marked target and only shoot once it lines up, which would not only improve reliability of the aim but make it seem even more human-like and I just realised this video was from may 2021 and you're likely not even working on this any more oh well
nice
Desinc on a 1 year old vid
@@eHeSTaFIXtatiCkANKpiQU I know, I wanted to write it anyway so I did
@@eHeSTaFIXtatiCkANKpiQU dawg
So, I know this video is kind of old, but I just discovered your channel and I'm watching all your videos 😅. I'm a PhD in machine learning, and I saw on the quick code that appears on the video that you are using large images. I don't think that this is necessary. You could downscale the images, use on your model, and recalculate afterwards where the BB is on the real feed. A second thing I would suggest os already use a pretrained huggingface object detection model just to see if it detects the caracteres as a person and use simple code to see the color of the border. This solution should help with the low data amount. You could even create data this way :) I don't have a solution for the spikes and mollies tough. Either way awesome video!
Pretty interesting video, ans it's really well made as well. And it has subtitles! Thanks!
I’m happy that somebody likes the subtitles!
@@riveducha hello friend, my name is Luigi, would you please help me?
@@luigiesposito2481 help you in what?
This takes "My teammate is a bot" to a whole new level
hi mom
hey mom
Why do I honestly think this bot could at least get bronze... Iron is a weird place
Not me getting false banned for "3rd party program" then this guys making an ai for valorant 💀💀
This is a prime example of a KZheadr who needs a shit ton more attention. Well done!
This project really is incredible - the way the video was captured, the way inputs were sent to the game, the problem solving of getting a used dongle when the exploit was patched, all of it was wild!
Bro said he didnt share the code but somehow I see this in all of my ranked games
I said it before and I'll say it again. These are the *best* videos on KZhead right now. You sir are on the fast track to 2mio subs if you keep up this frequency and quality. Good luck and well done 👍
Appreciate the support!
6:04 not going to lie that far friendly on the left, i thought that was sova until you pointed it out.. i guess im just an engineered AI
This is gold. Things I think you can do (although it's been a year so who knows what happened) is obviously have it be aware to object presence, as you have said in the video, but also respond to sounds, voice commands (via wheel ore voice chat), awareness to economy, and most importantly, have it teabag other players.
The only flaw I see is that it doesn't know to trash talk
This video is a year old and now is being recommended to everyone
whoa, I didn't know pytorch was so hard to download year ago. Now everyone can download it
why just after 1 year? youtube hello?
Id love to see a series on this as you keep trying to improve it, it was so much fun to watch
Just got recommended your video today randomly and loved it. I thought you were a much bigger channel, you definitely deserve more views!
It's funny, I wrote computer vision bots for both PUBG and BDO using very similar tech. I followed nearly the same thought paths as you, used the same strategies / tech, and hit the same roadblocks. The part about being unable to load cudart had me dying, I know that pain. People would ask me why I bothered and I had no answer other than it was fun, so yeah I totally get this video and am glad to see someone else understands how satisfying making something like this can be, even though there is no real advantage to be gained.
This is why you never take down videos. They could pop off years after uploading
You need to reduce the size of the images the neural net is provided with. Go black and white and scale down the images, this will let it perform so much faster
But also reduce the resolution.
But also reduce the resolution.
This is extremely cool, and I’m super impressed! You’ve given me the motivation to get started on a few personal projects I’ve been considering. I love stuff like this, combining hardware hacking and multiple devices and data streams - managing complexity like that and coming up with solutions for problems in that space is so much fun.
THIS IS SOO GOOD. As a person just starting off with OpenCV and AI and stuff and an interest in Valorant, this is godly. I do want to see your code just to see how you used all the AI libraries and stuff purely from an academic standpoint but it makes sense why you would not want to.
I wanna see the code as well lol ive made a kinda poop bot for CSGO but it was cool please make a github with the code maybe or something
Honestly, I have watched this video about 4 times in the last month; because of how good it is, unfortunately there are not many good videos explaining how to train a custom data set, but your sources in the video's description helped me alot thank you for sharing this information.
As someone getting a PhD in Machine Learning, you're doing the work of someone getting a PhD in Machine Learning.
I’m actually a CS student that is like kinda losing passion. I love playing game and all but after going through 3 years of pain automata theory and algorithm which burnt my brain with a little twist of discrete math. I don’t really see how all these things can help me in any practical way as web development job and other common field actually dont really need much theory So kinda lost. Be like why am i here… why am i suffering for no apparent reason 💀 I recently got into like data science and getting deeper with developing machine learning model. Find it quite interesting since it’s actually highly practical (we need to train data anyways so it cant be non practical) other than machine learning math course. Buttt My uni didn’t offer much unit for this field so pretty blur on what I can do other than training facial recognition models…and it kinda gets boring along the way. In the mean time, i grind much Valorant to get through uni stress THEN KZhead RECOMMENDED THIS. Just wanna thank you alot as final sem student here and sincerely lost on what the hell i should do for my future. This project is definitely awesome and fun. It’s an inspiration to me for real. I really wanna grind more ml knowledge to be able to make project like this ahahhahaa Would love to see more owo ❤️
I am actually planning on developing a thesis with Machine Learning and AI, and your video just shows up on my feed. Incredible, you just gives me an idea! Thank you so much for that, really appreciate it. Looking back at the older games like Counter Strike 1.6 that has bots, we are totally hoping this game also have like that bot you have made. Actually it's easier to create it on the system itself, not based on Computer Vision, but anyway... this project is smaller than large companies made for robots and self-driving cars like Tesla. Don't compare yours to them, this one-man project really amazes and inspires us on the community.
now get 8 more people and make a custom lobby so the bot can learn from actual gameplay experiences.
The lore of Terminator 7
@@andraskmeczo575shit actually happened in rocket league 😂
More videos like that with deeeeep technical explanations, i understand in this video so much things that i been searching about and didn't understand
Amazing work. My daughters told me about this and I was impressed so had to check this out. Well done!!
There is probably a way to randomly generate training data. The games assets are probably available, so rendering pngs of just character models (with alpha 0 background) at different distances and angles, placing them randomly into background shots of the game and automatically generating the outlining box where the png got placed (that you till now had to manually draw) could give you lot's of training data very quickly wich should improve the results of your AI model by a lot. Just an idea
I worked with cv2 already but this is next level, my dude. I love this video so much and computer vision is extremely interesting. I actually consider focusing on computer vision in my future career. Anyways, thx for this awesome video and great inspiration. U are an beast
yo this is actually a really cool video and experiment. thanks for sharing your findings!
It is so painfull to see ai struggling, knowing he is just not good enought and there is nothing it can do until some human makes a better version of itself.
No what's more painful is knowing there are actual human being that plays like this, viewangle desync (aiming at the ground), doesn't use audio etc etc
Eh, if you use one of those learning bots it can. Also I don’t know much about this stuff so lmk if what I’m assaying is incorrect
an improvement method for your labelling: you can add the ability to analyze moving images (for paint-splatters) by introducing a LSTM or similar. this will also remove the false labelling of beams or shells as enemies or spikes because the data in the short-term memory makes it impossible to mistake a bullet-shell for a spike. and the data in the long-term memory might even know which friendly is holding the spike.
awesome work here man ! Would definitely love to see a part 2 some day
My dream is literally being able to do these things. I love the video, keep it up!
KZhead algorithm as unusual as always, glad i found this gem of a channel
Very interesting video! By the way, the creator of YOLO had ceased his research to prevent the tech from being used for military applications. I hope it will not be misused.
That was a really good video explaining AI and ML. Great Job!
Bro just created an Iron 1 player. Also this bot oddly resembeled the teammates I get during my rank ups lmao.
Well you never really know since there are a lot of bots out there that can roughly simulate human actions
@@DreamingBlindly me when i lie
This is hard AF, I've tried computer vision before. This guy did a great job Well done
"grad student or other sweatshop labor" - lol.
You should meet TacticalPumpkin
You knew that what you made wasn't perfect, but the feel of making something on your own is awesome. great video!
Dude thanks for making this video. You have finally proved my point that this game has bots in ranked, started noticing it since I hit rad
plz keep training this AI to point it can play at at least Iron level) Waiting for part 2)
wait, u mean irons are better than this?
@@sakana6388 yeah, they are
Very interesting good job with that, for the FPS problem I recommend you try to scale down the image resolution to 608x608 (must be multiples of 32) and remove the last YOLO head from the model (responsible for long range detections and is also the most expensive in terms of computations), this will lead to less accuracy over long range targets, but will have a much better chance with close range encounters. Also if you would like, I could help you increase the detection accuracy quite more as well as some performance improvements, I am interested in this.
when Riot don't make bots in custom so you do it yourself
Just go into a comp game
@@qaugithaduck5771 but then I'll be the bot
Play unrated pleaseeee. I need to hear how the ai will react to verbal abuse
the lack of object permanence is pretty realistic for pugs honestly.
this is still really impressive! well done!!
So this is what my braindead ranked teammates were using
I think it would be really cool to have it read chat commands from teammates stuff like"!go A" "!Defend Spike" "!defuse spike"
It's things like this that make me wish I had the patients to learn coding and neural networks, I'd have so much fun just experimenting and pushing the boundaries of what I could create
Incredibly knowledgeable and we'll-spoken teacher. Nice tutorials comfortableness with the subject makes starting soft real exciting!!
Awesome Video. Changing the border color for enemys to a bright Pink or so could probably help with lots of false Enemys. The second one is a bit more tricky you are right. But I believe this could be since the AI get trickked in a way of an illusion like the Necker cube. Since you allways start the round facing correct you'd could use that data to make a null-point and just add the inputs and afterwards delete them again to allways have the correct view. Anyway thanks for the video I look forward for more.
This takes "It dosen't use headphones!!!" to a new level
here’s an idea, you should 3d render all characters, unplanted spike, planted spike, and all maps, then name those objects and what they are to the ai (a player or spike. you could work on all the gadgets and whatnot later for now keep it simple to build a base) give that information to the ai and run it through set scenarios just to see how it can identify objects using the 3d model for reference to the 2d image it sees. model the characters with two parts, head and body so it can try and for headshots. another thing you should teach the ai is physics and principles in valorant; ex: a player cannot be outside the map so shooting at an object that isn’t in these parameters cannot be deemed an enemy or whatever else can’t be outside the map. also teach the ai all the information about the guns, how fast they shoot, how precise they are, their damage, the difference shooting from un crouched, crouched, slow walking, walking, slow walking crouched, every possibility. once you do that start marking the most effective guns at what range so the bot can see when an enemy is further away or closer using its knowledge of the map and characters it has on hand. run the bot through set scenarios like go forward until you see this corner then make a left. from there have different (but keep it simple) objects be on this route to see how the ai will react. once the ai can start to understand the game you can start teaching it other things, like mollies, sage wall, slow orb, Phoenix’s ult, and other small things. from there you can use the ai’s math and predictive properties to make it predict where players will go, move, plant, etc. this is a huge project and you’ll need a more powerful computer.before you say it’s cheating let me explain how it isn’t. 1. the ai knows everything a human could know the ai isn’t going into the game files and seeing where people are, it’s not using the in game knowledge of hitboxes it’s using its own. 2. you also might be saying the ai having a 3d model of all players characters and map might be unfair however humans have the same thing, we learned the map and it’s 3d properties with the characters too, now you also might be thinking “humans had to learn the map they couldn’t download it” and you would be right however there is a work around to this, if you make the ai go through all the maps, and circle all the characters from far and close you might be able to replicate the same 3d downloaded learning from experience however the ai would need to be doing this for quite sometime. it would just depend on what you constitute as crossing the line between an ai and cheating. thank you for your time if you read this
It's amazing how many people in the comments fundamentally misunderstand the viability of this project. There are so many holes and workarounds in play that fundamentally handicap the prospect of making this an actual bot, and getting through them would require insane amounts of both processor time and man-hours. This is _not_ EZ Valorant cheats; it's three brain cells fighting over who gets to control the legs.
What an amazing project, these types of projects are what we engineers think of doing and give up saying it's way too much work 😂. Anyway great work and good content.
Getting the resolution down 2 to 3 times would massively benefit fps and save some computing power
It would be super fun to have like a league where it’s only AI you make yourself. 5v5 AI tourneys
Those kind of tournaments exist in Cs : each team has code from a specific dude who programed all the moves of the bots of his team. Very funny to watch
I'm glad this vid got recommended to me. For enemy detection, you could probably use the fact that the game outlines all enemies in the same bright red color to make the job easier on yolov5.
dude this video is awesome! AI technology is amazing. Hope you continue to improve this type of stuff!
bro literally made my ranked teammates
Wow youtube algorithm took its time
SAME
This is actually really cool, i recently did a project using opencv and yolov5, and i was wondering if i could make a valorant bot like you did. i am absolutely blown by this
I've been looking everywhere for someone who Is trying to accomplish the same task . Subbed !
You should set 2 of these up and have them 1v1 eachother
"this looks fun, but i might get banned if i test it in a multiplayer lobby" "ever heard of tf2?"
Hey love the content, speaking as a overglorified trolley collector studying computer science and biomechatronics, ive only ever really worked with prerecorded material for AI, so forgive me if this cant be applied. I thought could be interesting using interpolation to track specific markers between set intervals/frames to track the future, pass and present frames for charactor motion and to predict where to aim and shoot with the low frame rate. For the navigation aspect, my big dumb idea for that is using planar homography, taking in the height of the player model and angle to visually map and record coordinates around the map and develop a nav mesh which the ai could then use to get around corners
It's so much easier with valorant than with cs because of the player highlight and no friendly fire. In cs the players blend into the environment and the training is much more complicated.
Hi! This is so awesome! Im a data scientist and I had some thoughts! There is a lot that could be done to improve the actual CV model, but I want to focus on some other stuff first: For the latency in the detection, afaik a common solution is using something like a Hungarian algorithm to match detects across frames. After you have matched your detects you can use them with a filter like a Kalman filter to model and smooth the trajectory, since you know your latency and velocity, heading etc you can push your reported position into the future as an easy way to get the bot to 'lead' the shots and compensate for detection latency. This is really convenient also, since you can remove unmatched detections, and solve issues with short term (like single frame) false positives. Also, if you lose a detection for a few frames the kalman filter will predict the expected locations based on the object kinematics which may help as well For navigation, things are a lot harder. Navigating strait from pixels is obviously really tough. I think the standard approach would be to use something like ORB SLAM to actually do the localization. If you want to get fancy, you can combine orb slam, mini map and also your key input into an extended kalman filter or something similar There are probably also hackier approaches to navigation using heuristics or dynamic window approach which might be worth looking at!
Agree with all of your suggestions! And thanks for suggesting some good ideas other than "lol python slow" :)
@Ocean Blues I think you have the right idea. One improvement could be to leave some buffer room around walls which would reduce getting stuck on walls and corners.
@@riveducha I hope you turned off mouse acceleration. I don't remember if you mentioned it in the video. But I guess mouse acceleration would be something that would cause the bot to overshoot and oscilate around the target.
1. Use yolo detections for better accuracy. I use yolov4 tiny on darknet, i got 120fps on my 1060 2. Use interception driver, it allows you to do the same but without buying a dongle)
Great video, here are some tips from someone who studies ai. I'd love to see an improved version. A neural network framework like Pytorch can help you a lot. You could train another model that takes the past few frames after yolo v5 drew bounding boxes into them and predict where the bounding boxes of enemies will move in the future frames. This infomation can be used to aim where the enemy is going to stand when the control input is being executed. Building a cv-network in a framework is not that hard either but it might result in noticably worse performance (due to python being python). I believe too that you have too little training data. Doing a bit of data augmentation (slightly tilt, recolor, sharpen, compress or reshape images and add them to the data alongside the original ones) on the data you have might help you get better results. Another tip is building a clear pipeline in which the data is being handled. Typically for robotics is something like: Sensor Input > Perception > Planning/Controlling > Execution. It is also not uncommon to create a map with the perception data. A map can help with strategic decisions.
And after that, sell it
I Hope to see more of this!
No way... this guy finally found a way to have fun in Valorant
have a 5v5 with copies of this bot
Great video! Love the approaches you took :)
KZhead just recommended me this today and turned out it's a pretty good video
One thing you could do is connect a wireless audio adapter into the game PC and have it transmit to the Bot PC. Then you could use an audio library to monitor the left and right audio channels for things like footsteps, gun shots, volume, etc. Then compare those findings to the mini map to see if those sounds are coming from a teammate or enemy. If it couldn't be coming from a friendly, have the AI turn in the direction of the sound. That'd be a way to at least get some basic sound integration done.
- Because of the external tools to get the video and control of keyborad/mouse, this sort of cheat method is undetectable! - This sort of cheat method is undetectable because of it's very bad perfs! :D Interresting fact : the bad perf is this AI-Gamer is because of the bad perfs of understanding the environment (the map, the target, the waypoints...). NPC AI is good in games because of the method of acquisition of the environment informations (they have virtual waypoints on the ground, unseen by players). I understood it by making paths for bots on "Unreal Tournament" maps several years ago.
for aimbot its excellent!! Automatic headshots for 0.1 seconds, why not? calibrating the mouse so that it can be pointed exactly where it is needed is not a problem.
genuinely impressed by this, im looking forward to more improvements
Congrats, such a nice work! I don't know if you knew that during Dota international 2019 they used bots (OG vs. OpenAI Five), it was crazy, they were able to deny creeps, kill creeps, evoid attacks... they were preparing for months and the AI beat the best IT players...
if only you could train it using a REPLAY SYSTEM
You should try a lower resolution, 720p should be enough for the AI but contains about 45% the pixels of 1080p. So expect quite a boost in reaction/processing time. Maybe there's other things you can do like preprocess the image to reduce the color pallette, maybe less data will make it more accurate and less confused.
Damn bro top tier content, I'm sure you had to visit multiple countries to produce a masterpiece like this
Wow this is a great idea and I will try to replicate your work on my stream using reinforcement learning. Great work by the way 👏
As a tournament organiser, having an odd number of team was bad, that why I would have want to let people creating bot participate (Not cheat, just bot, that use info that only an human can have, as you exactly did.) but, well, I doubted this exist, and your video kinda proved it T.T
cant believe you picked brim instead of kayo during testing
As a deep learning student, this is so amazing. I think one of the best decisions you made was making it so that the computer has the same info as a human. Well done! You earned a sub!