Game Development Community

Anyone suggest a basic AI tute?

by Tony Oakden · in Torque Game Engine · 01/12/2005 (5:51 pm) · 11 replies

I thought I understood the exisiting AI which ships in the torque demo but I now suspect there is a bit more to it than I first thought. What I need is a simple tute with plenty of example code showing how to set up new AI behaviours and how to trigger new animations and actions. Help on how to integrate new behaviours into the exisiting scripting structure would be great. I'm pretty good at finding my way around other peoples code as long there is some explanation as to what it is doing.

I have gone through the exisiting stuff in player.cc, AIplayer.cc and the assosiated .cs files and I'm thought I understood it but as I said in another post I can't get my new animations to trigger reliably :(

I'm comfortable working in native or script.

Any help on this would be much appreciated

#2
01/16/2005 (3:29 pm)
Thanks Eric,

These tutorials are great but don't actually tell me anything about getting animations to play. Do you know if anyone has done any work on this?
#3
01/16/2005 (7:39 pm)
This stuff is not specific to aiplayers. It also applies to players, weapons, shapes in general. Everything gets animated in the same way. I'm not really familiar with this stuff, but here's something to get you started. Look at the spot where I found this in crossbow.cs because there's some good examples there of how to use the animation system.

I pulled this from server/scripts/crossbow.cs:

Images have a state system which controls how the animations are run, which sounds are played, script callbacks, etc. This state system is downloaded to the client so that clients can predict state changes and animate accordingly. The following system supports basic ready->fire->reload transitions as well as a no-ammo->dryfire idle state.
#4
01/17/2005 (7:54 am)
I see a lot of these questions when I search through the forums, and to tell you the truth, artificial intelligence is a complicated beast, especially in computer games, where it's imperative that your bots evaluate real-time decisions, and that they exhibit a natural feel to their actions.

My first advice to anyone who hasn't already done it - get a proper education. Take computer science classes, learn object oriented design and development. Tutorials on the web won't get you far towards understanding the technology (and this, really, is key), unless you already have experience or insight. College professors will (though your milage may vary).

My second advice is to go for the published works over internet tutorials. I've fund most web-tutorials to be too narrow and only teaches you how to implement a certain kind of AI in a game, not how to understand it.
I recommend Russell and Norvig's ''Artificial Intelligence, A Modern Approach'' for your basic text-book needs.

Don't get me wrong, there are good tutorials - like this research paper, and interactive java applets. They're great for showing you how combining simple, base behaviors, yields complex AI.
#5
01/17/2005 (9:25 am)
@Hans: Even though I would agree that getting a degree is a good idea (and I would never tell anyone not to) I must say that it isn't a requisite when it comes to programming. Many game developers are self-taught. They have a passion for the more analytical side of things, but they pursue the knowledge out of their own drive rather than the drive of a teacher. You can get most of the same knowledge from reading books about the subjects and implementing the methods contained within. I, myself, and mostly self-taught... I went to school to get a degree and ended up getting a lot of headaches trying to understand all the theory. I may not be a mathematical guy, but with patience and self-teaching I am completely familiar with OOP designs and methodologies.

- Brett
#6
01/17/2005 (11:46 am)
Excellent link though. That site covers a lot of ground. I wonder if OpenSteer (mentioned on this site) could be integrated with Torque. The biggest issue, I think, is the MIT license. I think it is basically saying that anyone who has access to source code which includes "substancial" pieces of OpenSteer has the right to publish that source. So if I were to show my source (which included OpenSteer) to another SDK owner then they would have the right to publish that code (a clear violation of Torque EULA). On the other hand, it sounds like I could add OpenSteer to my own project so long as I distribute only binary versions to other people. Sounds like the makings of a patch resource.

Licenses tend to confuse me though, even short ones like this. Anyone have an alternative interpretation? The nicest interpretation is that you have to clip that license agreement to your source with some indication that it only applies to certain portions of the source that came from OpenSteer, but I think that is unlikely.
#7
01/17/2005 (1:43 pm)
Thanks guys. Look I'm not expecting someone to tell me in a few emails how to write a complete AI system :) I agree it is an extremely compex field. However I'm quite confident that I can create the level of AI I need for my game using a simple state machine and some basic path finding. The problem that has stalled me for several weeks is that the animations I am calling don't play. I'm pretty sure now that I know why this is though. It is becuase of the way I am calling them: They are not getting triggered on the client, hence they don't play at all. So my problem is not really with the AI more that I didn't understand the client/server architecture which the torque engine uses.

In my defence this code is very dense, difficult to understand and not very well commented in the code base. I have a 2.1 degree in computer science and 18 years experience programming and project managment in the games industry and I still find it prety difficult to find my way around the the native code.

Anyway I think I may be close to cracking my problem and be able to move onto getting the actual game to work.
#8
01/18/2005 (12:19 am)
What's a 2.1 degree?
#9
01/18/2005 (12:22 am)
Its the latest greatest version of the computer sciece degree. Now with pixel shader support
#10
01/18/2005 (2:53 pm)
It's how we rate degrees in the UK. First class honours is the worst degree you can get then a 2.1 then a 2.2 then a third then a pass and finally the highest acollade - a fail. You have to work really hard to get a fail and invest very heavily in alchohol and virtually buy shares in the student union.
#11
01/18/2005 (10:45 pm)
Ah, interesting. Congratulations on your 2.1, then! :)