Sign in to follow this  
kvsingh

2D shooter AI project

Recommended Posts

Hey, I did an AI project this fall semester in which we made a 2d shooter game. The bot in the game was implemented using a finite state machine.

The map consists of the player, the bot, obstacles, health packs, ammo packs.

The bot has 2 high level states : Combat and Replenish. Within combat, the states are attack, hunt or flee, depending on the bot's health and ammo, as well as its position relative to the player (whether it can see the player or not). The bot has a field of view which is a square of finite size around it.


Link for the code : code

I am looking for comments/suggestions, as I want to extend this further.

I have the following ideas right now :

1. Introduce a "dodge" state. This is necessary because when the bot is in line of sight of player, it starts shooting the player without changing its own position at all. It stays still till the player dies, moves out of line of sight or the bot's own health/ammo become low.

2. Use a fuzzy state machine instead of an FSM, so that a certain level of uncertainity is introduced.



To run the game, go into the src folder and then :
python Main.py
(You will need pygame for this)

To play:
WSAD standard movement.
Move mouse to change aiming direction
Left mouse click to fire.

Share this post


Link to post
Share on other sites
Sign in to follow this