Thursday, April 15, 2010

I want to learn how to code AI, whare do I start?

Well, I would like to know how to make videos games. And I would like to code AI. Now heres the thing, I know nothing about it. Im willing to spend alot of time learning how to do it. I have a C++ book that im reading. but I was wonderingif theres a book that teatches you how to code AI in video games. And if it also came with a program for you to test your AI code and well, see if it wroks. Sorry of this is the wrong forum, but I have no idea what to get.I want to learn how to code AI, whare do I start?
going to school is the best option. Without that degree no one will take you seriously.I want to learn how to code AI, whare do I start?
[QUOTE=''Deihmos''] going to school is the best option. Without that degree no one will take you seriously.[/QUOTE] yes I know that, but I would like to know the basics first.
[This message was deleted at the request of the original poster]
AI is relatively advanced. If you are starting to learn programming and you have a beginners C++ book, you'll probably have to read that book entirely before you can start tackling AI.Im not aware of any books that teach both AI and programming from the ground up as you go. Most AI books i've seen have no code and are mostly just concepts that the programmer implements - but that requires a decent amount of programming knowledge since you need to convert concepts into code since the code isnt given to you.I would recommend a book like this: Beginning C++ Game Programming. I havent read it (since i dont use C++), but it seems like a game programming book for an absolute beginner. It seems the farthest you get will just be text-based games, but it should give you enough knowledge to spend time on creating your own custom AI for it.
I've got a couple of computer ''geek'' friends that started getting heavy into programming and all that fun stuff needed for writing code for games...let me tell you something (this isn't meant to discourage you, just from my own personal views/opinion)I tried watching these two guys work on a final for one of their courses; and the final was to write an AI program. The object was that you worked in a 5 x 5 grid: At one end of the grid was a cat and at the other end of the grid was a mouse - their job was to write an AI program that would allow the mouse to out-smart the cat and arrive safely at the oposite end of the grid.I've never seen these two guys struggle so hard before over this one project (and these were brainy guys, doing all the calc and trig classes and being able to blow through C and C++). So, learning to do AI is no simple task.Be prepared to become frustrated and greatly annoyed at times....and if you can stick through all of that, then maybe you'll have what it takes to knock out some good AI programs eventually.
[QUOTE=''Deihmos'']going to school is the best option. Without that degree no one will take you seriously.[/QUOTE]That's not exactly true. Of course that's the safest option of getting into the industry, but there's also the realm of modding. designers and leaders of top mods for certain games(i.e. HL2, UT2004 etc.) are quite often in demand by the videogame industry.
[QUOTE=''neatfeatguy'']I've got a couple of computer ''geek'' friends that started getting heavy into programming and all that fun stuff needed for writing code for games...let me tell you something (this isn't meant to discourage you, just from my own personal views/opinion)I tried watching these two guys work on a final for one of their courses; and the final was to write an AI program. The object was that you worked in a 5 x 5 grid: At one end of the grid was a cat and at the other end of the grid was a mouse - their job was to write an AI program that would allow the mouse to out-smart the cat and arrive safely at the oposite end of the grid.I've never seen these two guys struggle so hard before over this one project (and these were brainy guys, doing all the calc and trig classes and being able to blow through C and C++). So, learning to do AI is no simple task.Be prepared to become frustrated and greatly annoyed at times....and if you can stick through all of that, then maybe you'll have what it takes to knock out some good AI programs eventually.[/QUOTE]Ya i would agree with you. I'm a developer and i can program some games in C++ but AI is very tough when you get into it. You'll want a university software engineering degree most likely if you really want to get into it. The main reason being the math involved is quite complex. Basic AI is quite easy but anything where it actually has a brain is where it gets tough.You don't need to use C++ when you're getting into AI but it is a good starting point because a large portion of books you'll find at book stores involve c++. If you want some solid books look for ones written by Andrew Lamothe. They're very well done. I own several of his and i find them easy to pick follow and cover the foundation well.But before you do AI you will need to at least have a starting point in gaming. Even if this is something really basic and then from there build your AI on top of that. Also if you don't want to get into developing games from the ground up i would suggest looking at how to build on top of the unreal engines, hl2 and such. They're easy to quickly setup games and the code is easy to follow.
In the games industry, your portfolio/experience means more than a degree, although a degree will deifnatly help (although they will hire you anyways if you show you can create some amazing AI in games, or code your own game, and show that you can work hard).
I would guess there are some prety good books on AI on amazon, you should check it out. I personnaly am a programming n00b and Im studying Java to make games (Java has lots of potential, easy networking aswell). But to me, AI is a very far flung concept. And I think its definetily one of the last things you will learn to do in programming.
Oh yeah, and also a degree can help, but it really depends on how good you are at programming (Or art depending on your job). Just because you have a degree in computer science and finished top of your class, you might not have the skills required to make a game.
AI is one of the hardest parts of programming because there are millions (depending on program) IF and THEN statements that need to be coded. After each step, another set of IF and THEN's opens up, so by the end u have a looooooong list of all possible actions and corrent responces that the system must produce. And coding it is tedious.
Well...I will let you in on a little secret: game AI isn't really all that advanced in the general case. With most of of your CPU time being taken up by rendering calls, occlusion/frustrum culling, collision detection, and physics...there's not a whole lot of room left for AI. Most games get by with rather simplistic routines.

Of course, you could always strive to be a trailblazer and try to come up with some pretty advanced yet computationally cheap algorithms. :D

If you want the very basics, find an open engine editor that allows you to edit AI scripts and start with figuring that out. I used to do some mapping and editing on the old Dark Engine for the Thief series, and most AI there is a series of scripts that come down to essentially 'do this unless this this or this happens, and if this happens, do this, etc.' Not especially hard once you've got the games particular coding lingo down, but it still tends to become a bit tedious when you've got to consider so many elements which the player can do. I imagine with newer engines the process is much, much more complex. Still, it's a start. You wont be coding entierly new AI anytime soon, but if you can figure out the general idea it's a start. Source engine maybe? UT engine? There are piles of mods for those two, so I imagine there must be some basic AI tweaking open to you in the editors. Give it a look!
You need some sort of formal education. Im not saying to enroll yourself in MIT or anything like that, but maybe take a night class or something at a junior college or a trade school, if they allow that sort of thing.The reason I say this is because my roommate is a computer science major. He has worked part-time coding programs for the past two years. He is an extremely bright guy, and not only academically but creatively as he writies his own music and plays in a couple bands.This last quarter, however, he took a design class where the quarter-long project was to design a game from the ground up. All the modeling and stuff like that took them about two weeks, but the AI took them the whole quarter and when the project was due they still werent finished (fortunately he cut out the unfinished part and got a good grade).My point is that while you can further yourself by being self-taught and by reading books, you are definately gonna need training and education. If it took my roommate multiple quarters of classes and two years of job experience to become proficient with programming (and a whole 10-week quarter to know AI programming), its gonna take more than a C++ for Dummies book to train you.
Programming is definitely tough, most books that teach it don't even make sense for beginners. But as always once you understand it more, Practice, Practice, Practice. Don't get discouraged because you get stuck or pissed at it. Just don't give up and before you know it you will be making complicated programs.Like many have said(if your old enough and have time) take some courses on it. Although I recommend that you find someone super smart in programming and have them teach you. Thats what I did and I learned faster than the school I was at. =]-Good Luck to ya
there is a lot of truth in what everyone has said so fari myseld am doing a double in computer science and science, and AI programming isn't offered until our 3rd year, simply for the fact that they pound us with the truth that all programming is algorithms. Someone before mentioned playing around with scripts, yes that can help a bit of understanding, unfortunately that's far from programming an AI from scratch?you'll realise the true difficulty in it by trying, simply put, you're a beginner? well, start with simply programming first, for example, set yourself smaller projects which test your algorithmic thinking (because all programming is simply maths (being logic) in code) and make a game such as bejeweled, where you're doing a lot of if this than this kind of stuffremember AI isn't restricted to a certain programming language, just depends on how it's utilized, and generally it can be translated. So play around a little and see what you like (i have to be proficient with Java for example :P) don't feel discouraged, but AI is well out of your reach at a beginner level, even i and some friends who are about 10 times ahead of me, are yet to even think about AI and we're already about to start 3rd year at uni. Remember, it depends on the complexity of your AI, scripturing isn't 'true' AI... ... you'll undersand eventuallywhat do you other guys think? or have i blown it out of the water? :(Lari
head over to www.gamedev.net and post in the appropriate forum
I would say that attempting AI programming while learning basic programming is a little bit on the impossiable side. I finished my masters of computer science degree with a focus on AI and I can tell you that AI is tough if you want it to be effective. AI programming is not IF and THEN statements, most of the AI programming that I did used very few of those but rather a method to do almost perfect decisions in as little a time as possiable using a few decision parameters. A degree in programming would be a good place to... start, then you will need to work on game programming and after that you may be able to start going into game AI programming. As far as I know C++ or any of the other common languages are used for the programming of game AI but rather a more decision based language that uses rule and such, LISP or something I can't remember.It is good that you are interested but it is good to be realistic and see that to achive your goal you have a looooooonnnnggggg road ahead of you!!!!
I'm not so sure AI necessarily has to be so complex and difficult to learn. If you want to write general AI then you need to get into research, because despite developments in Intelligent Agents and autonomous systems (like the NASA Mars rovers and whatnot) not very much has happened since the speculations about ''humanlike AI soon'' some 20+ years ago. A few examples of modern advances include areas like Evolutionary Computing and Genetic Programming, which show promise for specific domains in automation and ''cognitive theories'' (like Global Workspace Theory) that shows promise for human interaction (mimicking human ''attention'' to a task). I wouldn't worry so much about a degree unless you want to get into research.For the specific problem of AI in games there are a number of subjects you can get into that don't require advanced knowledge in semantics and computational theory:Constraint Programming, Planning, Learning Decision Systems (boosted decision-tree stumps are great for many dynamic scripts)but most of all Game Design! A well designed interface and dynamic animations can give a very convincing illusion of intelligence where the behaviour of agents in the game are actually quite simple, even random. Remember that in modern games it's more a matter of pervasiveness and plausibility -- something like the ''fourth wall'' of a stage. Even a very capable AI in a poor presentation will make the player disappointed (feeling that the computer is ''cheating'' or ''auto-killing''). A good introductionary text at undergraduate level is AIMA (AI: A Modern Approach) often referred to as ''Russel and Norvig'' after the authors; aima.cs.berkeley.edu. That text doesn't deal with computer games explicitly but the appications are easy to imagine. The real key to understanding AI in computer games, IMO, is to really understand the importance of data -- it's easy to apply existing techniques to a game but that technique will be rather useless if you haven't chosen good information to extract from your game-environment. Thus, the modelling your game uses (e.g Gameplay Programming) is essential for succesfull application. IMO of course, you can probably find ppl who disagree with that and claim that a good AI should be able to perform well with the same set of data that a human would use (ie proponents of so-called strong AI). Speaking of modelling, someone above mentioned mods - modifications to existing games. This is a great way to see how others have done and sometimes existing games clearly illustrate the shortcomings of many games' data models. Plus it's a great way to really get into programming and content creation without the often insurmountable hurdle of getting a game engine up and running to start testing your AI. To summarize:Learn Game %26 Art Design. Understanding convincing presentation is very important - how does the game seem intelligent?Learn and think carefully about information and questions like ''what do I need to know to decide X'' or perhaps more importantly ''how can I pretend that I know X'' Learn and apply existing techniques without regard to their original applicationsMod!// raphaelamateur researcher; complex adaptive systems

No comments:

Post a Comment