I've been thinking on how to tackle the AI implementation to the maze game and there are 3 specific cases I need to deal with.
1) When player uses his compass ability, the AI is notified of his position and we can use an A* search algorithm to get a path to the player.
2) If the player is within the AI's line of sight, it will chase after it. We can probably perform a ray cast collision test. The ray will originate from the Ai's position and the direction will be the AI model's forward. If the ray collides with the player within a certain line of sight value, then we can set it to target the player.
3) Lastly, when the AI has no idea where the player is, we need an AI algorithm which can smartly explore the maze. Currently, the AI only knows of its previous position and randomly pick a path that is not the previous position (unless it's a dead end of course). After reading through some pages about how robot solves mazes, I found an interesting implementation where all the grids cells in a maze would contain a value telling the robot the number of times it has visited that particular cell. It would then look for the lowest number and go there.
To make a more believable AI, I think I can take the above concept andincorporate it with a exploration value such that the AI will recursively find possible paths with lengths up to this exploration constant. It would then look for the path that contains the lowest visited grid and go there. If there is nothing smaller than the value of the grid we're on? We can ask the AI to just randomly pick a position. I am also thinking about extending the previously visited position so that the AI remembers the previous x number of positions. That way, if the AI has to randomly pick a path, it will continue to move towards the unknown so to speak. By doing this, the AI can smartly explore places but doesn't turn into a know-it-all.
Once I actually start implementing this, I will post some source code here
Saturday, January 21, 2012
Wednesday, January 11, 2012
Hello and welcome!
Hello everyone!
This is a blog for any self projects and interesting tid bits I have encountered. I work with various languages such as c++, c#, objective c as well as several different engines and libraries such as directX, XNA, Unity3D, cocos2d. I may also include information about the unreal engine and unreal script if the thesis project ends up being developed with the unreal engine.
I have a blog for all my current school projects HERE. If you have seen my previous blog, you'll know that I've talked about a maze game I had to make for one of my school projects. Currently, the game is a mouse and cat chasing game where you are trying to escape from Santa's workshop and leave the north pole by locating Santa's sleigh! If you get caught by Santa, then you lose the game. The game uses a randomly generated maze which I will talk in a later post. Because of the time limit, there were some features I was not able to implement. Specifically, I would like to work on improving the Santa AI and implement an A* algorithm and other parameters such as line of sight. I will try to accomplish these goals during my free time and will update my blog about implementations and results.
This is a blog for any self projects and interesting tid bits I have encountered. I work with various languages such as c++, c#, objective c as well as several different engines and libraries such as directX, XNA, Unity3D, cocos2d. I may also include information about the unreal engine and unreal script if the thesis project ends up being developed with the unreal engine.
I have a blog for all my current school projects HERE. If you have seen my previous blog, you'll know that I've talked about a maze game I had to make for one of my school projects. Currently, the game is a mouse and cat chasing game where you are trying to escape from Santa's workshop and leave the north pole by locating Santa's sleigh! If you get caught by Santa, then you lose the game. The game uses a randomly generated maze which I will talk in a later post. Because of the time limit, there were some features I was not able to implement. Specifically, I would like to work on improving the Santa AI and implement an A* algorithm and other parameters such as line of sight. I will try to accomplish these goals during my free time and will update my blog about implementations and results.
Subscribe to:
Comments (Atom)