How to Make an Amazing Video Game Bot Easily
ฝัง
- เผยแพร่เมื่อ 5 ส.ค. 2024
- In this video, we first go over the history of video game AI, then I introduce OpenAI's Universe, which lets you build a bot that can play thousands of different video games. It has environments for all sorts of games, from Space Invaders, to Grand Theft Auto, to Protein folding simulations.
CODING CHALLENGE DUE DATE: Thursday, December 15th.
(which is 2 weeks, not 1 week from now like usual)
The coding challenge for this video is to make a bot that's better than this video's demo code. Post your Github link in the comments! For your README, just include a 1-3 sentence description of your strategy and instructions on how to run the code.The demo code can be found in the README of the Universe repo. :
github.com/openai/universe
And a Tensorflow based starter bot can be found here:
github.com/openai/universe-st...
Some great learning resources:
www.nervanasys.com/openai/
karpathy.github.io/2016/05/31/rl/
kvfrans.com/simple-algoritms-f...
kofzor.github.io/Reinforcemen...
Join other Wizards on our Slack channel:
wizards.herokuapp.com/
OpenAI asked me to make this video and I gladly said yes. They are awesome!!
Please subscribe! And like and comment. That's what keeps me going.
And please support me on Patreon:
www.patreon.com/user?u=3191693
Follow me:
Twitter: / sirajraval
Facebook: / sirajology Instagram: / sirajraval Instagram: / sirajraval
Signup for my newsletter for exciting updates in the field of AI:
goo.gl/FZzJ5w
Hit the Join button above to sign up to become a member of my channel for access to exclusive content! Join my AI community: chatgptschool.io/ Sign up for my AI Sports betting Bot, WagerGPT! (500 spots available):
www.wagergpt.co
"Alexa, solve poverty."
_Nuclear launch detected_
Slight chance of mushroom clouds...
69 likes
@@capnam_12 NO
"Wanna piece of me boy!?"
This is the best I know create a bot to play fortnite
"... only 10 lines of code. Start by importing thousands of lines of code already written but you did all the important work, trust me."
Right? I train my models using machine code.
Were you able to comment this on all his videos so everyone knows what a complete and utter fraud he is?
These new progamers are all so lazy... I program using only pencil and paper!
@@enzoqueijao *I* only code with punch cards
True, but hey isn't that the case with every application when we import hundreds of libraries....
Definitely one of your best videos to date, nicely done Siraj.
thanks Harrison!
Django on sentdex and Machine Learning there ahahah
Howdy !?,
This is Botino, a youtube bot.
This message is meant to test TH-cam software, to test the functionality of it.
As you can see this message is working perfect.
sentdex is this what inspired your super awesome python plays GTAV tutorial?
sentdex yesterday I was watching your balance pole video and today I saw your comment up here... life is such a circle !! xD
That hair futuristic af
thanks Jordan. it's open source too
I have a pull request for you. It involves a basketball number
@@SirajRaval hi... i have download a source file from github, but i was not able to compile ... i need some guidence ...the source file is for subway surfer AI..please help me how i can use that source file
Hi Sirajology. If you discover errors in your speach, and want to record single words, and input them into your timeline, like "a list", or "intelligence", a tip to make it work, is to 1) record at exactly the same spot in the studio, and 2) listen to a recording of your voice in the same sentence *just* before you make your corrections, that makes it easier to pronounce and put pressure on words in exactly the same way, making it virtually impossible to hear you have corrected yourself. And 3) if you are a perfectionist, record whole sentences rather than single words, making it easier to choose where to do cut. Thanks for amazing videos. Best regards Søren
I guess option 1) is not available
this is great advice, thanks Soren. I was working on this all weekend with the team lots of updates were made really fast. this is the one thing i am unhappy about from this video and i'll definitely improve next time :)
Egor Zvorykin Well if he remembers the spot he was in (the room / studio), then echoes will be the same, therefore much more likely to be unoticeable.
newgame what if he don't have access to the studio (eg. long ride)
... Yes - you are right. :-)
can we make bots that create bots that make better bots to create even better bots???
Not yet, soon we will. Singularity here we come.
I think we wont even notice the moment we reach singularity; we will end up way beyond it in a fraction of a second. Biological intelligence will be rendered obsolete. Interesting times ahead.
yes
inception shit !
we're trying, but as of now, we currently can't.
Please continue this with a series!! Would love to learn how to use Universe properly.
bump
i will propose this to OpenAI soon
Siraj, what do you think would be better to classify a group of sensors captured each second? I.e., their values and the latest 10 groups (seconds) might interfere the interpretation.
I want to use this for games like Skyrim and the link you listed has this "This repository has been deprecated in favor of the Retro". I'm not looking for Retro games though atm, is Universe still a good option?
I am new to coding and dont have much idea of how to do this. What platform do you use to write that code? and what do I need to do to import all that info?
Wait up, I have a few questions. What if the game requires other key input, like apart from up in this case?
Edit: Also, how do you select other games? Like do I have to build my own system to play GTA for example or is there a way for the AI to support the game directly?
This video is approved by Elon Musk. Well done!
thanks so much! Musk is awesome
@@SirajRaval He doesn't only care for himself, unlike most wealthy and succesful people. AND he is smart.
@@u6uggg6hguiuggy who else does Musk care for?
Elon Musk sent me here!
Nikhil Menda me too
hell yea, greatest tweet ever
Ur videos are great by the way.
Siraj Raval when I run the code I get
Trace back (most recent call last):
File “C:\users\gamer\appdata\local\programs\python\python3.6\coast.py”, line 1 In
Import gym
Module not found error: no module named gym
Can you help
I'm a little confused as to how to run the code. I tried running it in PyCharm and got,
*'Error while fetching server API version: {0}'.format(e)*
*docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))*
I'm new to Python where do I write the code like you do? and how do I get files like gym etc.
Hey I just found your TH-cam channel and I just wanted to say that I really enjoyed this video and found it very informative, keep up the great work ;)
thanks so much Fryd!
Do you have links to bots that could play more complexe game, like skyrim for example?
another great video siraj, your speed and tempo are perfect now
Best video layout/format I've seen so far! 👍👍
thanks Oliver!!
"and other environment" how do we use it on a specific game ?
Excellent stuff as usual Siraj! Keep it up! :D
thanks so much!
How do i feed the data into a neural network? Do i just slap the code for the network on the end of the bot code and tell it that the input is the bot output?
It doesn't seem to run for me. I'm on Windows and I am fairly certain that I have all of the prerequisites installed. Whenever I run the python code, it just closes the terminal immediately. Any troubleshooters out there?
I had looked at openai when it first blew on to the scene, but with the universe update, i might have to dig in again. Also, great job at bringing fun onto ml education
thanks Abdul
could this work in any programming area? Or only the one you use
Do you have a source for your historical explanation?
How can you make in a pc game witch is like a flash game? Since you just showed how to do it in the environments
hey siraj i can't install the package of universe in pycharm i don't it shows error
Your speed is getting better and better! Awesome video too!
thanks Sebastian!
I made the code in sublime text 3 but I can't run it using Python. Am I supposed to run it with python? If i am how and if i'm not what do I use?
How do I use the Tensorflow starter bot? Are the instructions already in the description?
What if I wanted to make an AI for an emulated game, say Pokemon FireRed emulated on any emulator say VBA? How should I go about it? Any ideas?
For anyone who knows: how much changes if you want to make bots that are basically resource farms? In my case it is one of those "attack other players- kingdoms for resources" games. Making a fleet of bots that farm resources and keeps no army, and just moves around the map being basically free resources sounds pretty interesting, would that significantly change anything?
COOL!!! I subscribed today and i've learnt a whole lot
You are awesome ... funny and informative at the same time
Your humour is awesome!
how do you install gym and how do you have it imported with no errors?
Came across Universe on another forum and my first thought (well actually my second!; first was to seek out more discussion at HN) was to see if Siraj had anything up re: Universe. Went to HN and you were the first comment. Winning!
woot, thanks Gabe. #feelthelearn
If i understand we can only choose on this list of game. right?
I keep getting the same error when I run my code saying yaml.dump is not found, can you help me?
is it possible to use that AI to farm in mmo games or in competitive games like dota?
Well I was searching how to make an AI for my game. Is there a way to have the bot as part of the game the users can play against?
You are great youtuber! Unique way to make video and very good!
Question: does this code also work for custom made games in unity engie?
What does line 8 do? Actually, how it does what its doing? I am a beginner and cant figure it out. Can you please elaborate?
im not sure if you will see this but i got this situation.
there is a game on roblox, i want to farm the same level over and over again with a bot but im unsure how do i make it click stuff like choosing the correct level and moving from point A to point B
Can anyone help me with universe. I try install with pip install universe and i get install error. I looked up and it have bad support windows 10? Do i have install other packages first or what would i do?
Man you is doing great stuff .
Does this support any type of game not just the given examples shown?
Siraj, you just read my mind,
back then I often watch com vs com in fighting games, yeah I know it is weird watching computer playing, but I enjoy watching how AI react to each other, because I set it at the highest difficulty and the fastest AI movement, and the result is fantastic, they perform beyond human level reaction capability, and if both character power gap is close, it is like watching anime fighting scenes for 15 minutes or longer in insanely intense high speed fight
thank you for this video
Oswald that's pretty cool i don't think that's weird. game bots are so fascinating to watch
Can we use the same concept to build a recommendatiom system.?
hey siraj. i'm a pretty amateur programmer and I don't quite understand ALL of the concepts employed in the video and the code. what should I do in terms of messing with the code to better understand what everything really does?
read 'learn python the hard way', watch all my videos and download and run the code locally. you'll get really good really fast
isn't that book strictly Python 2?
Siraj i love your energy!!! keep it up
I am a bit confused... how do you run the script?
can we use it with an android game running inside an emulator on windows?
How could you release the video the same time as they release the code.
"OpenAI asked me to make this video and I gladly said yes. They are awesome!!" He says it on the description.
Monte Thakkar I didn't see the description. This makes sense to me now.
it says "OpenAI asked me to make this video and I gladly said yes. They are awesome!!" in the description, so he must have had early access to the code
yup had early access, this was so dope worked on this all weekend and got to work with some heroes (Ilya Sutskever and Andrej Karpathy)
i can use other languages for this right??? like java or javascript? im most comfortable with java.
Could you use this to make a TAS?
Technically it's not a 10 line code since all the functionality of your bot is implemented by an external library, what you made is the interface that connects the game to the actual "bot".
I get an error that says gym isn’t a module.
amazing video overview! i have a question tho, the processing is still done on your pc or do they have a server taking care of that? and does it use GPU or CPU?
on my PC. uses CPU, you can set it to GPU as well.
thanks man
Nice video! Cool libraries, never heard of them.
thanks Tristan
Great explanation of universe. Subbed.
thanks Ernest!
@Siraj Raval
I know diddley-squat about computer programming (other than how to use a hammer to program a laptop to become a perfect paperweight). How hard would it be for someone like me to work with OpenAI?
@Samurai Jack Okay. I think I'd like to try this.
Now, how hard would it be to teach an AI to play Skyrim?
Can this be applied in RPG games like call of duty,pubg or freefire?
when i try to install universe it says
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_mememachine/go-vncdriver
Storing debug log for failure in /home/mememachine/.pip/pip.log
They have some instructions here
github.com/openai/universe
@@danieldossantos5868 those instructions dont deal with this issue. Im having the same issue. Im using PyCharm. I've tried to change my version to 2.7 or 3.5, like they say on the github, but even after I've done that, when I type 'python --version', it says im using 3.7.4...
What OS is Siraj running? Universe doesn't seem to be working for me on windows.
***** Does universe use a gpu? How effective would a vm on Windows work?
Just live Boot Linux
Mac OS X.
What about the bots in fighting games like Mortal Kombat...do those use the same if/then logic?
Helllo, I am super late, but theres this io game i want to make a deep learning bot to do, diep.io, in which you shoot your tank and shapes, other tanks, etc and try to score. Does the same thing happen here?
does universe work with windows?
Thanks for the episode
awesome ... happy Google recommend you based on my viewing habits. lol. still trying to solve my video problem but learned more in 2 days than past 5 months thanks!
woot, thanks Randy!
I can not import gym and universe... Can someone help me?
How can I get this bot to play a game that I have downloaded?
File "demo.py", line 8
action_n [[('KeyEvent', 'ArrowUp', True)] for ob in observation_n]
^
SyntaxError: invalid syntax
help i dont know how to fix this
you had me on hello ! love your channel
woot thanks
can i do it with notepad or sublime text 3
This is going to sound weird but I'm interested in making an AI for Roblox, for tycoon maps is this possible? If so how?
Mr Siraj where or what do you use to keep up with all the happenings in the ai community do you just follow reddit? I wanna be cool like you
twitter & machine learning subreddit
SIRAJ, 'dat content 'doe! All ways with that fresh code
ayyyy lmao thx
Sirajology keep it up :)
Can I use it in online games like paper.io?
any follow up on openai coming up at all in 2018 siraj?
why does it say the method is not iterable
i dont get it, so where do i start?
How hard would it be to make the "reward" just to have different pixels on the screen (ie see something different)??
Ryan that's possible, the whole image recognition system for retrieving the reward is open source, you'd just modify it.
I get that I could do the image recognition, but how do I make a particular frame, or frames, the "reward"? My only thought is to give certain images, like the 'game over' screen a weighted value under/over other non-game over screens. And if that is the case then it seems like there would be two learning machines....one to classify what is on the screen, then another to use those classifications to play the game.
Hell,Siraj!How Can i make a bot like this for a tetris game that i made in Java?
Is open ai a Coding language. what coding language are we using??? are we using Open AI or the standard Visual Studio that everyone uses....
hi there Siraj, really nice video. what advice would you give me if I wanna learn Machine Learning given that I am a complete newbie? and thanks again for the great video.
I'm getting "ModuleNotFoundError: No module named 'gym'". What am I doing wrong?
7mario6 $pip install gym
what electric said
loving the revolution 9 part in the beginning!
haha thanks!
The only question that i have is does that bot work on warthunder?
this is fantastic,
woot thanks!
I wrote the code exactly as you demonstrated:
import gym
import universe
env = gym.make('flashgames.CoastalRacer-v0')
observation_n = env.reset()
while.True:
action_n, [[('KeyEvent', 'ArrowUp',True)] for ob in observation_n]
observation_n,rewrd_n, done_n, info = env.step(action_n)
env.render()
I then ran in in my terminal, and nothing happened! What did I do wrong?
can someone provide a link to his code editor
What sublime extensions do you use?
I really liked this article and emulated it realpython.com/blog/python/setting-up-sublime-text-3-for-full-stack-python-development/
Oh man, i was hoping you could apply this to applications on your pc too (not just flash games)
i need one bot for one game, is it easy to do?
What is he coding this in, like what program, what is the download link, sorry I'm new to this stuff
sublime text
Hey Siraj,
When do you intend the deadline for this challenge to be? (Please say Thur 15, 23:59 (GMT -8))
Thursday the 15th at noon PST
Great, thanks!
Anybody know how you do it for multiple keys? He didn’t explain that