Sign in to follow this  
Darobat

2D 3rd Person Shooter AI

Recommended Posts

Darobat    100
Greetings I have a 2D, 3rd Person Shooter (kinda), and I'm wondering how I should implement AI for it. I have barely any AI experiece so excues my n00bness. Thanks. I don't want the AI to be so incredible, perfect aim, always dodge, etc. Thats the part i need help with; making it imperfect. Thanks

Share this post


Link to post
Share on other sites
grekster    640
Quote:
Original post by CWIZO
How does a 2D 3D first person shooter game look like?!?


says 2D 3rd person for me, maybe theres something wrong with my monitor though:P

Share this post


Link to post
Share on other sites
Darobat    100
ok that was incredibly strange wording. Its basicly a side-scroller in 1 room. its 2D. You control a guy looking him sideways, so 3rd person, and you shoot, so a shooter. A 2D 3rd person shooter. Anyway, its like a side-scroller in 1 room. Lots of levels(platforms)and stuff where you can kill from

Share this post


Link to post
Share on other sites
jack_1313    536
Is the game world viewed from side-on (eg Soldat) or top-down (eg Asteroids)? Either way I can give you some basic guidelines:

Pathfinding and obstacle avoidance: Your AI agents will need to know how to move around the level logically without running into things. There are several ways to do pathfinding – I’ll briefly describe two:
1. Agents follow a set of waypoints that have been deployed by the map designer in a linear fashion. Occasionally the waypoint path splits, and the agent chooses which way to proceed by applying some formula or random number etc.
2. Agents use a pathfinding algorithm such as A* to navigate a web of interlinked nodes deployed by the map designer. In order to do this the agent needs to know where he wants to go.

In combat situations you may have your agent break from the pathfinding routine and start moving in random directions / seek cover while aiming and shooting at the target. The target can be chosen by looping through all nearby enemies and asking:

How far is the enemy?
How easily can I align my weapon in its direction?
Is the enemy attacking me?

and choosing the most appropriate. Alternatively, if the player is the only target in your game, the agents need not concern themselves with this.

That is about all I can say without knowing a lot more about your game. You’ll be using a ‘finite-state-machine’ (very simple concept) in your core AI code – Google it if you do not already know what this is.

Hope this helps,
Jackson Allan

Share this post


Link to post
Share on other sites
Darobat    100
Because this is a computer controled character, should I subclass it so that i have

class CEntity;
class CComputer : public CEntity;

Then in Computer i would maybe have a class called CAIScript where it would do executing of the AI? I've never done AI so I'm kinda unsure of how to implement it.

Share this post


Link to post
Share on other sites
Kylotan    10013
Whether you subclass it, use a contained AI object, or a pointer to one which can be NULL for player entities, is an artifact of your implementation language and is pretty irrelevant really in AI terms. Do whatever is quickest or easiest for you. The important thing is how and when it's going to make decisions and how they will be executed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this