Ask HN: Where to start on creating AI for games?
32 comments
There's a few really good fun AI challenges that you can get stuck into - Even though they're ocmpetitions and over, you can still get the tools for them
http://www.marioai.org/
http://www.sscaitournament.com/index.php?action=tutorial
http://www.slideshare.net/coboslab/demolition-derby-2012-gec...
http://www.cloudball.se/
http://www.computerpokercompetition.org/
http://aichallenge.org/index.php
http://www.botprize.org/
http://aigamedev.com/open/coverage/ctf-report/
http://aibirds.org/
http://geneura.ugr.es/cig2012/competitions.html
Creating "AI/bots" for games comes in three parts/flavors/divisions:
First, and the most critical to most games, is basic behavioral AI. This includes things like pathfinding, locating targets, attacking, and otherwise making an entity in the game interact with the environment in the game.
Second, you've got the more abstract parts, the "high-level decisionmaking". This is the AI's strategies and tactics, such as communicating with other AI, coordinating with squad members to circle an enemy, deciding when to change weapons or throw a grenade or pull back to reload, etc. In most cases, developers put in many crude heuristics here either because they don't have time to think of anything better, or for performance reasons. This will look like "if known nearby enemies > 2 and ammo < 20%, find safe point to fall back, reload". The developer thought up this quick rule of thumb and told the AI to do this, without having to code the AI with the intelligence and information the developer used when making up this rule of thumb.
Third, bot creation (for the usual "hacker" version/meaning of the term, as in e.g. bots used by AFK players to farm) is significantly different than making an "official" AI as a developer or writing a replacement AI using available scripting in some games. For most games, bots will involve various hack techniques for retrieving information about the game world (occasionall literally involving visual pattern recognition, which is a whole other ball of yarn (and separate type of "AI") you don't want to mess with just yet). Bots will also usually involve indirect control of the game character by using some third-party program to "send" keys to the game using OS functionality. This is probably not what you're interested in, and you'd need to learn at least some basics of the first two to be able to achieve anything here.
One thing that was rather popular a while ago is to just dive into a game like Robocode[1] and work up your way until you can code one robot that will on its own beat various competition-grade robots without user input to adjust for the opponent's strategies.
[1]http://robocode.sourceforge.net/
First, and the most critical to most games, is basic behavioral AI. This includes things like pathfinding, locating targets, attacking, and otherwise making an entity in the game interact with the environment in the game.
Second, you've got the more abstract parts, the "high-level decisionmaking". This is the AI's strategies and tactics, such as communicating with other AI, coordinating with squad members to circle an enemy, deciding when to change weapons or throw a grenade or pull back to reload, etc. In most cases, developers put in many crude heuristics here either because they don't have time to think of anything better, or for performance reasons. This will look like "if known nearby enemies > 2 and ammo < 20%, find safe point to fall back, reload". The developer thought up this quick rule of thumb and told the AI to do this, without having to code the AI with the intelligence and information the developer used when making up this rule of thumb.
Third, bot creation (for the usual "hacker" version/meaning of the term, as in e.g. bots used by AFK players to farm) is significantly different than making an "official" AI as a developer or writing a replacement AI using available scripting in some games. For most games, bots will involve various hack techniques for retrieving information about the game world (occasionall literally involving visual pattern recognition, which is a whole other ball of yarn (and separate type of "AI") you don't want to mess with just yet). Bots will also usually involve indirect control of the game character by using some third-party program to "send" keys to the game using OS functionality. This is probably not what you're interested in, and you'd need to learn at least some basics of the first two to be able to achieve anything here.
One thing that was rather popular a while ago is to just dive into a game like Robocode[1] and work up your way until you can code one robot that will on its own beat various competition-grade robots without user input to adjust for the opponent's strategies.
[1]http://robocode.sourceforge.net/
Building off of your #3) An example for this would be the botting programs made for Runescape. Developers wrote an application that would sit on top of the game client and then use reflection in Java to see what's happening in the game: Various objects being created that are now on screen, the players direction, the map grid, etc.
The developers of this botting program would then expose their own API and scripting language that would allow other developers to interact with the game through their program. The could then write scripts such as: Go to this location via map coordinates, pick up some object, solve a puzzle, fight some boss, eat when below a certain health, etc.
Note: I used to run a VPS company that would specifically cater to those that were botting in Runescape; this allowed them to run their bots 24/7 without using their own hardware.
The developers of this botting program would then expose their own API and scripting language that would allow other developers to interact with the game through their program. The could then write scripts such as: Go to this location via map coordinates, pick up some object, solve a puzzle, fight some boss, eat when below a certain health, etc.
Note: I used to run a VPS company that would specifically cater to those that were botting in Runescape; this allowed them to run their bots 24/7 without using their own hardware.
Right. I wrote one of the earlier RuneScape 2 bots around 8 years ago (example script https://clbin.com/71NIX).
It's worth noting that these were very easy identifiable as bots by behavior. Making AI for a game (that actually seems human and is fun to interact with, past just target selection and pathfinding) is another (much more difficult) set of problems entirely.
It's worth noting that these were very easy identifiable as bots by behavior. Making AI for a game (that actually seems human and is fun to interact with, past just target selection and pathfinding) is another (much more difficult) set of problems entirely.
Holey shit it's Regex :). Old ARGA dev here :).
1. Grab Unreal Engine[1]. It's $20 per month, but you can cancel after the 1st month if you don't want to receive updates.
2. Download the Unreal Tournament project[2]
3. Examine the bot code and start tweaking
[1] https://www.unrealengine.com/
[2] http://www.unrealtournament.com/
Unreal is an industry-grade game engine that is also quite accessible. AI can be scripted in Blueprint (a visual dataflow scripting language) or C++.
Unreal Tournament 2014 is 100% crowdsourced. If you own the Unreal engine you can download, play it, modify it and - if your modifications are good enough - feed them back in to the game itself. The community is apparently very welcoming.
2. Download the Unreal Tournament project[2]
3. Examine the bot code and start tweaking
[1] https://www.unrealengine.com/
[2] http://www.unrealtournament.com/
Unreal is an industry-grade game engine that is also quite accessible. AI can be scripted in Blueprint (a visual dataflow scripting language) or C++.
Unreal Tournament 2014 is 100% crowdsourced. If you own the Unreal engine you can download, play it, modify it and - if your modifications are good enough - feed them back in to the game itself. The community is apparently very welcoming.
Well, I like the idea, but why do all their documentation pages link to a Github 404: https://github.com/EpicGames/UnrealTournament ?
Private repos. You need to link your GitHub account to your Unreal account. See here https://wiki.unrealengine.com/Getting_Started_With_Unreal_To...
I plan to start looking into the Unreal engine soon after I get experience with a more basic engine. Have you found a lot of the resources available are able to get you started well? Or is there a large learning curve? My main experience is in writing Rails apps, Ruby gems, a couple basic Android apps, and everything DevOps.
It's pretty smooth. Epic have really polished the UX to make such a complex piece of software understandable and soften the barrier to entry as much as possible. There are all sorts of tutorials.
I'd say it's easier to learn than Unity at this point, but harder than 2D engines like GameMaker. I think some basic experience making simple 2D games will help a lot before the transition to 3D.
If you're already familiar with Javascript and you want to start making games at a lower level you could try the PhaserJS framework.
I'd say it's easier to learn than Unity at this point, but harder than 2D engines like GameMaker. I think some basic experience making simple 2D games will help a lot before the transition to 3D.
If you're already familiar with Javascript and you want to start making games at a lower level you could try the PhaserJS framework.
AI programmer here...generally "bots" are just AI that is intended to take the place of a player (typically in a versus setting and not a co-op setting).
If anything bots are tougher to make then "normal" AI since their value is measured by their performance against humans. Also the less you cheat (perfect knowledge of the other players, perfect aim, etc) the better your bot. Having a non-cheating bot beat a human is a major achievement.
The bots for a strategy game like StarCraft is fundamentally different than the bot for an FPS. They use completely different techniques and it's much harder to cheat in strategy game (though ignoring the fog of war is the most egregious). Strategy game AI is more akin to chess AI - lots of search (minimax and stuff). It's a whole field onto itself and you can only learn by studying the AI for that type of particular game.
FPS bots (like counter strike) are much closer to traditional game AI (shooters and such). Books on "Game AI" are a good place to start. Basically the two major problems is where should I go (evaluating cover, analyzing line of sight, estimating where enemies are and trying to pick a good place to stand) and how to I get there (pathfinding and pathfollowing). What you do when you get there is generally pretty straightforward (shooting at the appropriate guy). If you have a cover system you need to be able to tell them how to use cover and this involves a lot of animation (syncing my animations and position up to the cover in the world). But in an FPS this is usually just a question of crouching or not.
The big difference for FPS bots (versus single player enemy AI) is that bots need to choose between conflicting goals (should I go get ammo, should I go get health, should I attack the enemy). If you have a strict hierarchy of behaviours your bots won't be competitive (enter fuzzy logic systems, utility theory and the like - normal behaviour trees won't cut it).
Have fun!
If anything bots are tougher to make then "normal" AI since their value is measured by their performance against humans. Also the less you cheat (perfect knowledge of the other players, perfect aim, etc) the better your bot. Having a non-cheating bot beat a human is a major achievement.
The bots for a strategy game like StarCraft is fundamentally different than the bot for an FPS. They use completely different techniques and it's much harder to cheat in strategy game (though ignoring the fog of war is the most egregious). Strategy game AI is more akin to chess AI - lots of search (minimax and stuff). It's a whole field onto itself and you can only learn by studying the AI for that type of particular game.
FPS bots (like counter strike) are much closer to traditional game AI (shooters and such). Books on "Game AI" are a good place to start. Basically the two major problems is where should I go (evaluating cover, analyzing line of sight, estimating where enemies are and trying to pick a good place to stand) and how to I get there (pathfinding and pathfollowing). What you do when you get there is generally pretty straightforward (shooting at the appropriate guy). If you have a cover system you need to be able to tell them how to use cover and this involves a lot of animation (syncing my animations and position up to the cover in the world). But in an FPS this is usually just a question of crouching or not.
The big difference for FPS bots (versus single player enemy AI) is that bots need to choose between conflicting goals (should I go get ammo, should I go get health, should I attack the enemy). If you have a strict hierarchy of behaviours your bots won't be competitive (enter fuzzy logic systems, utility theory and the like - normal behaviour trees won't cut it).
Have fun!
> Having a non-cheating bot beat a human is a major achievement.
(for some categories of games!)
I'm almost nitpicking here, but it's important to understand the distinction where when trying to build "human-like" AI that players feel are like the real thing, you also want to emulate human shortcomings. Sometimes it might not be cheating per the rules, but still be obviously outside the realm of current human capabilities.
e.g.: An AI opponent with perfect arithmetical abilities in a game like Scorched Earth: http://en.wikipedia.org/wiki/Scorched_Earth_(video_game)
(for some categories of games!)
I'm almost nitpicking here, but it's important to understand the distinction where when trying to build "human-like" AI that players feel are like the real thing, you also want to emulate human shortcomings. Sometimes it might not be cheating per the rules, but still be obviously outside the realm of current human capabilities.
e.g.: An AI opponent with perfect arithmetical abilities in a game like Scorched Earth: http://en.wikipedia.org/wiki/Scorched_Earth_(video_game)
The best start I ever had to Artificial Intelligence was via UC Berkeley's CS188 course[1]. This course takes you through the very foundations of AI, from search to planning to basic probability theory. It's been imitated at universities around the world with its open lectures, slides, homework assignments and project code.
The projects are the very best part of this course. You start with a blank slate PacMan agent trying to pick up dots to something able to track & dodge ghosts without even seeing them (!). It's what inspired me to continue AI research 7 years down the road!
[1]: http://inst.eecs.berkeley.edu/~cs188/fa11/lectures.html
The projects are the very best part of this course. You start with a blank slate PacMan agent trying to pick up dots to something able to track & dodge ghosts without even seeing them (!). It's what inspired me to continue AI research 7 years down the road!
[1]: http://inst.eecs.berkeley.edu/~cs188/fa11/lectures.html
Hey there, thanks for the great link!
As for AI (in general, not only for games) - AFAIK nowadays most serious work is done in non-symbolic, statistics/stochastic direction (including all the Big Data and ML stuff)... So what do you think about pure symbolic AI? Is there any research/advancements done in this part? I know I'm oversimplifying it, but I think you got the point... :)
As for AI (in general, not only for games) - AFAIK nowadays most serious work is done in non-symbolic, statistics/stochastic direction (including all the Big Data and ML stuff)... So what do you think about pure symbolic AI? Is there any research/advancements done in this part? I know I'm oversimplifying it, but I think you got the point... :)
This also appears to be available as an archived edx course: https://www.edx.org/course/artificial-intelligence-uc-berkel...
Google Ants[0] is an AI challenge that is over now, unfortunately, but you can still run through it.
"The AI Challenge is all about creating artificial intelligence, whether you are a beginning programmer or an expert. Using one of the easy-to-use starter kits, you will create a computer program (in any language) that controls a colony of ants which fight against other colonies for domination."
[0] http://ants.aichallenge.org/
"The AI Challenge is all about creating artificial intelligence, whether you are a beginning programmer or an expert. Using one of the easy-to-use starter kits, you will create a computer program (in any language) that controls a colony of ants which fight against other colonies for domination."
[0] http://ants.aichallenge.org/
Here are some resources on AI programming
http://gameai.com/
http://aigamedev.com/
http://www.gamedev.net/page/resources/_/technical/artificial...
I highly recommend this book
http://www.gameaipro.com/
http://gameai.com/
http://aigamedev.com/
http://www.gamedev.net/page/resources/_/technical/artificial...
I highly recommend this book
http://www.gameaipro.com/
You could start at the beginning. Some people are still unaware that the four ghosts from Pac-Man each have a different decision-making algorithm. The red ghost always targets the player. The pink ghost targets four spaces away from the player in the direction it faces. The cyan ghost uses a combination of player position, player facing, and the position of the red ghost to determine its target tile. The orange ghost targets the player when far away, and a home corner position when the player is close.
Those four strategies in combination, along with some global behaviors for pathfinding and behavior modes, are often enough to defeat an unaware player. (search: "Pac-Man dossier")
This introduces the concept of strategic archetypes. Human players have them, too. I, for instance, often favor stealthy sniper strategies. The various strategic archetypes often have a complex relationship web from who tends to defeat whom. The player that always tries to do an early rush to overwhelm slower opponents before they can mount a defense may be easily defeated by a trap-and-decoy opponent, whereas that player may lose to a gather-intel-then-send-ninjas player.
To create a competitive AI, first identify how humans play the game, identify the strategic archetypes, then model your bot to pursue archetypal goals. Then, most importantly, determine when to switch archetypes. An early rusher AI has no strategy for midgame or endgame, so perhaps that AI evolves into aggressive expansion, or an ambusher.
But also remember that the point of the game is for the humans to have fun. Avoid cheating, or overusing a game-breaking strategy. Your bot won't care if it loses, but a human may ragequit if he loses to a bot with a perceived unfair advantage.
Of course, there are some games with no human players. There's the "rock paper scissors programming competition" (rpscontest.com), where players submit algorithms, who then fight each other to the death for rank points. It is interesting to see new strategies rise and fall, including those who win by "cheating", such as by manipulating the match-generating program itself, setting the opponent's random seed, examining the opponent's heap or stack, or causing the opponent to be improperly disqualified for cheating.
Those four strategies in combination, along with some global behaviors for pathfinding and behavior modes, are often enough to defeat an unaware player. (search: "Pac-Man dossier")
This introduces the concept of strategic archetypes. Human players have them, too. I, for instance, often favor stealthy sniper strategies. The various strategic archetypes often have a complex relationship web from who tends to defeat whom. The player that always tries to do an early rush to overwhelm slower opponents before they can mount a defense may be easily defeated by a trap-and-decoy opponent, whereas that player may lose to a gather-intel-then-send-ninjas player.
To create a competitive AI, first identify how humans play the game, identify the strategic archetypes, then model your bot to pursue archetypal goals. Then, most importantly, determine when to switch archetypes. An early rusher AI has no strategy for midgame or endgame, so perhaps that AI evolves into aggressive expansion, or an ambusher.
But also remember that the point of the game is for the humans to have fun. Avoid cheating, or overusing a game-breaking strategy. Your bot won't care if it loses, but a human may ragequit if he loses to a bot with a perceived unfair advantage.
Of course, there are some games with no human players. There's the "rock paper scissors programming competition" (rpscontest.com), where players submit algorithms, who then fight each other to the death for rank points. It is interesting to see new strategies rise and fall, including those who win by "cheating", such as by manipulating the match-generating program itself, setting the opponent's random seed, examining the opponent's heap or stack, or causing the opponent to be improperly disqualified for cheating.
I used this book for a Game AI class and the examples were easy to consume with a good focus on using the methods in real games: http://www.amazon.com/Artificial-Intelligence-Games-Ian-Mill...
A little pricey, but my favorite intro book for this subject.
A little pricey, but my favorite intro book for this subject.
Seconded. Covers a lot of ground, lots of great examples, the code is language-agnostic (Python-ish). Hard to go wrong with this book on your shelf.
Funny (and probably a bit off topic) fact : if today I have a coding job it's because when World of Warcraft was all the rage, after a while I started "botting" then wanting to make my bots better I learned to code and a few months later I was enrolling in an IT school. The rest is history as they say.
If you want to interface with games, I would highly recommend looking at Innerspace (company was named Lavish something). My knowledge is from 10 years ago, it might be discontinued though (I'm not botting anymore).
edit : oh btw if someone at Blizzard read this, I would totally pay for 10 accounts on a botting friendly WOW server. I can always dream ;-)
edit 2 : yup they are still in business : http://www.lavishsoft.com/
If you want to interface with games, I would highly recommend looking at Innerspace (company was named Lavish something). My knowledge is from 10 years ago, it might be discontinued though (I'm not botting anymore).
edit : oh btw if someone at Blizzard read this, I would totally pay for 10 accounts on a botting friendly WOW server. I can always dream ;-)
edit 2 : yup they are still in business : http://www.lavishsoft.com/
There were recently posts about a new Javascript based MMO AI strategy game called Screeps [1]. They are on Indigogo [2] at the moment. Maybe this can be a nice learning challenge...
[1] http://www.screeps.com
[2] http://igg.me/at/screeps/x/9209812 (affiliate link, is that allowed? otherwise: https://www.indiegogo.com/projects/screeps).
[1] http://www.screeps.com
[2] http://igg.me/at/screeps/x/9209812 (affiliate link, is that allowed? otherwise: https://www.indiegogo.com/projects/screeps).
I took a course on AI at University. The course had a lot of projects around video games. I liked the book we used:
http://www.amazon.com/Programming-Example-Wordware-Developer...
Our final project was super cool. We got into groups. Then each group modified the AI of the soccer team in the book. Then we had a tournament to see who's team was the best. Winning the tournament was one of my prouder moments at school.
http://www.amazon.com/Programming-Example-Wordware-Developer...
Our final project was super cool. We got into groups. Then each group modified the AI of the soccer team in the book. Then we had a tournament to see who's team was the best. Winning the tournament was one of my prouder moments at school.
Battlecode (https://www.battlecode.org/) is a programming competition run by MIT every January for programming an AI to compete in a game (the exact nature of the game changes every year. It's vaguely Starcraft-like, except completely played by AIs)
It's open to non-MIT students, as well.
They also offer lectures in January which will be streamed on twich.tv - these may be of some interest to you, even if you decide not to compete.
It's open to non-MIT students, as well.
They also offer lectures in January which will be streamed on twich.tv - these may be of some interest to you, even if you decide not to compete.
Take a look at wildfiregames 0ad, if you like RTS. 0ad is an open source RTS, where its easy to write your own AI in JavaScript.
A much bigger challenge would be an AI that is able to walk an avatar in Secondlife. First perhaps easy walk on the roads in mainland, later walk on arbitrary land, and the real challenge is walk inside buildings. A cat bot that does not fall into the lake, might even be a good seller.
A much bigger challenge would be an AI that is able to walk an avatar in Secondlife. First perhaps easy walk on the roads in mainland, later walk on arbitrary land, and the real challenge is walk inside buildings. A cat bot that does not fall into the lake, might even be a good seller.
If i'd be on the same quest, i'd first read a lot of articles on gamesutra concerning AI. Here's a quick google search - http://goo.gl/aHZrXj
There are a lot of "handson" examples there from real existing games (with code) and interviews with game developers.
There are a lot of "handson" examples there from real existing games (with code) and interviews with game developers.
I really recommend this article on behaviour trees, it gave me a good intro on how to start with the basic structure of AI - obviam.net/index.php/game-ai-an-introduction-to-behavior-trees/
You should check out CodinGame. I go on there from time to time to mess around with the challenges where you program the AI to do the task presented. Might be a fun way to get in the AI mindset.
What I learned working for Brian Reynolds (Colonization, Civ2, Rise of Natopms. etc...)
Step 1: int result = rand(100); switch (result) { //... do something simple }
Step 2:
Watch the AI until something dumb happens, improve the logic.
Step 1: int result = rand(100); switch (result) { //... do something simple }
Step 2:
Watch the AI until something dumb happens, improve the logic.
Any resources for fighting game AI? (e.g. Mortal Kombat)
I would say that it's best to start with turn-based games, like Bridge or Chess or (shameless plug) Ambition (and if you take on Ambition, let me know how your AIs do). Some games, like Othello, aren't hard to beat. Or you could do one of the German board games if you want to take on a more heterogeneous environment than in, say, Checkers.
This will get you familiar with game AI as a topic. Then you want to take on RTS and FPS games, which are similar but have deadlines (frame rates) and more complexity in the environment. But it's important to get the basics down before taking on a complicated game.
This will get you familiar with game AI as a topic. Then you want to take on RTS and FPS games, which are similar but have deadlines (frame rates) and more complexity in the environment. But it's important to get the basics down before taking on a complicated game.
http://codecombat.com/ may be a good starting point for writing simple AI logic.
That does look like fun. There are many online programming contests that work similarly to that, and I would recommend starting with one of them.
I'd also add that while everyone suggesting AI resources is helpful, the best thing to do is just jump in and start coding. One of the problems with our formal education system is that it often ends up trying to present solutions to problems before the students actually understand the problems, resulting in students that learn fairly superficial understandings of the solution that the brain naturally ends up garbage-collecting. Just code things for a couple of weeks. You should notice you're sort of hitting a wall around that time. You should notice that you see behaviors in your opponents that you do not currently know how to implement. That is the time to start cracking into the AI texts and learning from those who preceded you, and everything will tend to make total sense why you'd want to do that, instead of being these abstract thoughts floating in space that tend to go in one ear and out the other.
(I am convinced, incidentally, that this is why people can so confidently proclaim the uselessness of a degree in computer science to programming; what is taught is incredibly useful, but trying to jam it in for four years before finally turning you out into the real world to actually encounter the problems you've supposedly been learning the solutions to is a terrible way to go about learning. Take advantage of the ease of just hiking out into the coding wilderness and encountering these problems yourself before trying to learn their solutions. It is something the other engineering disciplines would kill to be able to do!)
I'd also add that while everyone suggesting AI resources is helpful, the best thing to do is just jump in and start coding. One of the problems with our formal education system is that it often ends up trying to present solutions to problems before the students actually understand the problems, resulting in students that learn fairly superficial understandings of the solution that the brain naturally ends up garbage-collecting. Just code things for a couple of weeks. You should notice you're sort of hitting a wall around that time. You should notice that you see behaviors in your opponents that you do not currently know how to implement. That is the time to start cracking into the AI texts and learning from those who preceded you, and everything will tend to make total sense why you'd want to do that, instead of being these abstract thoughts floating in space that tend to go in one ear and out the other.
(I am convinced, incidentally, that this is why people can so confidently proclaim the uselessness of a degree in computer science to programming; what is taught is incredibly useful, but trying to jam it in for four years before finally turning you out into the real world to actually encounter the problems you've supposedly been learning the solutions to is a terrible way to go about learning. Take advantage of the ease of just hiking out into the coding wilderness and encountering these problems yourself before trying to learn their solutions. It is something the other engineering disciplines would kill to be able to do!)
"I'd also add that while everyone suggesting AI resources is helpful, the best thing to do is just jump in and start coding."
I'd modify that slightly: skim (an hour per chapter? something like that) one or more comprehensive books (for this subject, Russell and Norvig is good) enough to get some idea what is known, then jump in and hack seriously, then interrupt your hacking when appropriate by going back to study the particularly relevant stuff that you know is already known. Jumping in is good and important, but it tends to be a lot more efficient when you have some idea about the outlines of what has already been worked out for you.
The times I haven't been able to follow this advice --- notably not having physical access to university libraries when I was trying to write a C compiler for a Z-80 as a teen back in the 1980s, hence having no very practical way to learn about existing work on parsers and stuff --- have been better than nothing, interesting and educational but not as efficient as doing stuff when I had a lot of stuff to study as needed.
Incidentally, a similar strategy can be very helpful for formal study of nontrivial subjects, e.g. various college-level engineering courses. Skim the text, and maybe another text from the library too, and/or an online Wikipedia-level survey/tutorial/whatever before the course starts. Then you have a much better chance of seeing how things fit together and of finding ways to clarify things you're puzzled by.
I'd modify that slightly: skim (an hour per chapter? something like that) one or more comprehensive books (for this subject, Russell and Norvig is good) enough to get some idea what is known, then jump in and hack seriously, then interrupt your hacking when appropriate by going back to study the particularly relevant stuff that you know is already known. Jumping in is good and important, but it tends to be a lot more efficient when you have some idea about the outlines of what has already been worked out for you.
The times I haven't been able to follow this advice --- notably not having physical access to university libraries when I was trying to write a C compiler for a Z-80 as a teen back in the 1980s, hence having no very practical way to learn about existing work on parsers and stuff --- have been better than nothing, interesting and educational but not as efficient as doing stuff when I had a lot of stuff to study as needed.
Incidentally, a similar strategy can be very helpful for formal study of nontrivial subjects, e.g. various college-level engineering courses. Skim the text, and maybe another text from the library too, and/or an online Wikipedia-level survey/tutorial/whatever before the course starts. Then you have a much better chance of seeing how things fit together and of finding ways to clarify things you're puzzled by.
Maybe implement Minimax [1] in your favorite language and apply it to a simple game like tic-tac-toe.
[1]: http://en.wikipedia.org/wiki/Minimax
[1]: http://en.wikipedia.org/wiki/Minimax
Learning the A* pathfinding algorithm is a good starting point as this is common in simple tile games. These two links should get you started:
[1]: http://www.raywenderlich.com/4946/introduction-to-a-pathfind...
[2]: http://theory.stanford.edu/~amitp/GameProgramming/
[1]: http://www.raywenderlich.com/4946/introduction-to-a-pathfind...
[2]: http://theory.stanford.edu/~amitp/GameProgramming/
I'll second this. Also, for board games like chess or othello, you should take a look at the mini-max algorithm:
https://en.wikipedia.org/wiki/Minimax
https://en.wikipedia.org/wiki/Minimax
Caveat/warning: Oftentimes, learning how to translate your game data into an A* -traversable graph is harder than implementing the A* algorithm itself.
[deleted]
I'm currently working my way through this book Artificial Intelligence for Games [1] and am finding it very approachable for someone with no background in AI.
[1] http://www.amazon.com/Artificial-Intelligence-Games-Ian-Mill...
[1] http://www.amazon.com/Artificial-Intelligence-Games-Ian-Mill...
I've personally did a school project some years ago writing an AI for Transport Tycoon Deluxe, at the time it was a straightforward api; IDK about tthe current status. At the time though, I quite enjoyed it, also because of the subject matter. Linky: https://wiki.openttd.org/AI:Main_Page
To create a good (i.e. actually useful) bot you want to start by spending a lot of time in whatever game you're targeting.
Most bots, or trivial helpers like macros, are written by the players that have spent a lot of time in a game and identified the elements most worthy of automation. The player's lack of in-depth technical knowledge then leads to the mass of crappy bots out there.
If you're coming from the opposite side, i.e. you have technological knowledge but don't know where to start, all you're missing is domain knowledge of an individual game or genre to figure out what you actually want to build.
Edit: it's also worth noting that game AI and bots are pretty different problems.
Most bots, or trivial helpers like macros, are written by the players that have spent a lot of time in a game and identified the elements most worthy of automation. The player's lack of in-depth technical knowledge then leads to the mass of crappy bots out there.
If you're coming from the opposite side, i.e. you have technological knowledge but don't know where to start, all you're missing is domain knowledge of an individual game or genre to figure out what you actually want to build.
Edit: it's also worth noting that game AI and bots are pretty different problems.
Not exactly AI, but the Processing language has a 'flocking' tutorial: https://processing.org/examples/flocking.html. There's also a version in ProcessingJS: http://processingjs.org/learning/topic/flocking/
And, from HN a few days ago, Red Blog games has some awesome, in-depth explanations of game-related programming: http://www.redblobgames.com/pathfinding/tower-defense/
And, from HN a few days ago, Red Blog games has some awesome, in-depth explanations of game-related programming: http://www.redblobgames.com/pathfinding/tower-defense/
Back in the day I really enjoyed Matt Buckland's AI books.
I would suggest learning how to use Sekuli to automate games.
There's also some relevant material in this book, The Nature of Code: http://natureofcode.com/book/chapter-6-autonomous-agents/
There are plenty of books online. I would recommend creating your own project and finding something specifically you would want to do with that topic. For a class project my group and I did something simple, like a minesweeper bot. It also included a screen scrapper to scrap from windows and created our own minesweeper game including the AI part. It had about a 30% failure rate because it would get stuck on the 50-50 chances of it picking the wrong square. But that was a lot of fun. We did a bunch of statistics on it also.
This is a very broad topic because it can range from everything from 2D to 3D and different genre games.
I read and enjoyed this one. I would recommend it to start: http://www.amazon.com/Behavioral-Mathematics-Game-AI-Applied...
It covers basics like game theory and goes into some of the mathematics and some code examples.
Here are some good slides from Valve on how they did Left For Dead http://www.valvesoftware.com/publications/2009/ai_systems_of...
Good luck, have fun
This is a very broad topic because it can range from everything from 2D to 3D and different genre games.
I read and enjoyed this one. I would recommend it to start: http://www.amazon.com/Behavioral-Mathematics-Game-AI-Applied...
It covers basics like game theory and goes into some of the mathematics and some code examples.
Here are some good slides from Valve on how they did Left For Dead http://www.valvesoftware.com/publications/2009/ai_systems_of...
Good luck, have fun
I second the Behavioural Mathematics book. Really good introduction to AI and how to think about programming it.
I do have knowledge of programming but not really sure how to grasp the whole concept.
Interested in concepts of how AI works in games such as Starcraft (I suppose, Warcraft too), Hearthstone (and other card games), Counter-Strike work. While I guess the FPS AI (at least the official bots) are not as fair as it might see - they're probably rigged to fail at some point just like chess engines are when are presumably playing in lower ELO.
Are there any books, tutorials, challenges that would be a great starter for me?