Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Practical FPS AI

This topic is 5176 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone I'm making a kind of noddy first person shooter. I've done BSP tree, visibility culling, lighting, models, and collision detection, and now I'm on to the AI! So how shall I do the AI? I've got one basic monster so far, which I've named the 'Gimp' after the imps in Doom. Here's a screenshot: I don't want to do anything too clever or complicated, but I want it to be expandable. I'm thinking along the lines of the Half-Life AI, which works using 'schedules'. i.e. the schedule for "Attack Enemy" would go: 1. Face Enemy, 2. Shoot. The schedules are stored as static arrays, and there's a big procedure called GetSchedule which picks one of them. Each schedule also has condition flags which determine if it should break out of the schedule before it has finished, i.e. the aforementioned "Attack Enemy" schedule would break out early if the bits_COND_NO_AMMO_LOADED bit is set, or something along those lines. The monster then has variables for: - Current Schedule Index - Position in current schedule - Condition flags I was wondering if I could do something more scalable than this. For example, what if I want to have a schedule within a schedule? Or if I wanted specialise a certain schedule for a particular type of monster? (in Half-Life you would have to just create a whole new array for this, I was thinking some kind of object-oriented hierarchy would be nice). I'm experimenting with something where each type of schedule is a class and the monster can run the schedule by instantiating the class, i.e... m_pCurrentSchedule = new CSchedAttackEnemy(); The schedule can then contain a pointer to a subschedule if it wants. I'm not sure I like this though, for one thing I'm not comfortable with all the dynamic allocation of memory during the game - could this slow it down a bit? Does anyone have any ideas about how to do the data structures for AIs like this? How does it work in other games? I only have knowledge of the Half-Life code. Also there's a question of how to do the pathfinding around the levels. In Half-Life, level designers place nodes around their levels, the game builds a node graph between them all when the level loads, and the monsters find their way around it using A* (I think). But I have a feeling other games don't require their level designers to do that - I'm pretty sure that's not how the multiplayer bots work. Anyone have any knowledge about this? [edited by - foolish_mortal on May 17, 2004 6:16:05 PM] [edited by - foolish_mortal on May 17, 2004 6:18:37 PM]

Share this post

Link to post
Share on other sites
If you have access to a copy of AI Wisdom 2, they have an interesting article about tasks. Basically, the idea is that tasks can be individual or composite, with each potentially taking multiple actions to perform.

This is a fairly lightweight alternative to a planner, which may be more than you need. It is more focused on composition than problem solving.

Don''t be too worried about allocations unless you have some constraits you haven''t mentioned. There are plenty of ways to optimize allocations (such as banking, free lists, etc). Just work on getting it working in a way that makes sense and works well, then worry about the performance/allocations.

As for pathing, a few companies do auto-generation, though most still use some kind of manually placed representation (including for multiplayer). There are a lot of different techniques, including waypoints, axis aligned boxes, nav meshes, etc.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!