AI

Hey I’m currently in the process of making a first person shooter game. If anyone could point me toward some good tutorials, or even give me some techniques, it would be much appreciated.
Thank you in advance!

Hiya, welcome to blenderartists! :slight_smile:

You’ve chosen a biggie as your first question here. Some things about AI that I have found useful follow in no particular order, and the list is by no means complete…

BGE now has in-built pathfinding through Recast and Detour which can go a long way to making your bots move about. I’ve not played with it much yet (it’s very new), but there are some tutorials about if you search for “blender recast detour”.

Stanford is a week into a free “Introduction to AI” online course that runs until the end of december if you’re into some serious learning. It’s a general university-level AI introduction and not just specifically for games, but promises to provide a decent background in the material and I’ve enrolled for the full course. I think enrollment is over now, but they say the teaching videos are available to all so you can still learn yourself. You might need to be patient with that link since there are over 160,000 people subscribed from over 190 countries and the servers are a bit stressed so connection is a bit patchy right now (it’s a beta for a planned paid course).

AI Game Dev has some interesting articles and interviews, but the free content is a bit limited.

Amit’s Game Programming Information is a really good read with a lot of useful information. Most of this is redundant since pathfinding is now implemented in bge, but it’s always good to know what goes on “behind the scenes”.

Other than that, I guess you’ll just have to trawl the net for inspiration. AI is one of those areas of gaming that hasn’t been generalised like rendering and physics so you’re probably gonna have to come up with some kind of homebrew solution. There is a lot of good stuff out there, but you can also get some good ideas from playing games. Look for glitches, think “how did they do that?” and just generally pick up hints from wherever you can.

You might want to experiment with how actions (animations) play in bge before getting too deep into your game AI since the AI will probably also be controlling bot actions and this could be hard to retro-fit to a complex system. Perhaps get basic chase/flee working on simple objects with Recast and Detour and then move on to characters that run/walk at the same time following the paths. Later you can add shooting/hiding/squad tactics if your head hasn’t already popped. :wink:

Python is going to be essential if you don’t know it already. There is a whole sub-forum of blenderartists devoted to scripting and many threads on the subject in this sub-forum. I’ll not go into Python any more except to say that forum members are quite helpful and there are a great many code examples on blenderartists and whole tutorial video series devoted to scripting in blender.

I’m gonna stop now since this is getting to be quite a wall of text…

Good luck. I know I’m gonna need it when I start implementing my AI. :smiley:

Use agoose raycast detour scripts.Put agoose raycast detour scripts in the seach.

Finite State Machines are a common and fairly straightforward way of creating AI.

When setting up an FSM you have states, transitions, and actions. Actions define what an AI agent does. A transition is made up of a triggering condition and a state to transition to if the triggering condition is met. A state is made up of actions and transitions. While in a state an agent performs the actions of that state until one of that state’s transitions is triggered. At this point the agent transitions to that new state and begins performing that state’s actions.

It helps to have some kind of manager managing the FSMs of your agents. This manager will iterate through each agent and call a run method on their current state. In this method the states triggers are tested and any actions related to the state are performed.

If you want some help with this kind of stuff, I lurk in the #gameblender channel on the freenode IRC server. I haven’t had much of a chance to play with the new recast and detour additions yet, so I wont be of much help there.

Good luck.

Thanks for all of the help anyone. This is really going to make a difference in my game. :wink:

Thanks for all of the help anyone. This is really going to make a difference in my game. :stuck_out_tongue: