2D 3rd Person Shooter AI
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
How does a 2D 3D first person shooter game look like?!?
-----------------SloGameDev.net | My homepageQ:What does a derived class in C# tell to it's parent?A:All your base are belong to us!
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
Quote:
Original post by BosskIn Soviet Russia, you STFU WITH THOSE LAME JOKES!
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
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
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
-----------Autumn Fog - A 2D Action Wargame
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement