Game Development Blog 4
|
This was our second week after Alpha in our game development course, for this week I continued on the AI that I started last week. More specifically I continue with Pathfinding algorithm A* (pronounced A-star) and the waypoints system that is associated with it. Since last week I have managed to implement the A* pathfinding, but I am still working on the Waypoints so that the enemy can patrol around the level, only by giving it a command to move to a certain waypoint. So the way that A* works is that is calculates the fastest route from the start to finish and gets a path to go there. This as it turns out is a very intensive task for our program, and in the polish weeks I will probably have to spend some time trying to optimize the algorithm so that it doesn’t drop frames when searching for a path. But A* on its own is little good, as it need waypoints to go between, but in comparison to regular waypoints pathfinding, I don’t need to go through waypoints to reach my goal, I can just set my goal and the algorithm will take care of the rest. I have some problems with the algorithm though, as it is right now, it will cut corners due to it now realizing that it can’t move diagonally there as it does otherwise, but that is the only major issue that I have detected with the A* algorithm itself. I can take a predetermined start and finish and make the AI move between those points, but right now I am working on repurposing this so that I can make a “patrolling” pattern for our AI, basically that it goes to a waypoint, and then chooses a new one to go to after, either dependent on where the player is right now, or just a random one if the player is not making any noise. I had problems with remaking the code so that the old path is removed, and a new one could be created, but I think that it will be solved before the end of the week, after that is a layer of “intelligence” that needs to decide when to chase, when to do targeted searches and when to simply roam around the rooms. This will probably be my weekend work as I next week will have to get busy creating the UI for the game. |