Thursday, March 25, 2010Game Demo AI Programming
The work on the goal driven behavior for my bots has been an undergoing work during a long time of the project, mostly when I was tired of debugging. Last week of the project have only been dedicated to the behavior thou and even thou a lot of them were written there were non of them that didn’t need some kind of rewriting. At the moment there are only three “main” goals: Attack enemy, Grab flag, Score flag. There is a lot of different sub-goals thou to make the character path find, run, attack and die. Implemented a special goal Think which is the goal that decides what my agents should do. Every “main” goal got it’s own desire calculator which uses things lake range, agent health and flag position to calculate a number between zero and one and then sets the highest goal as the agents current goal. Balancing the desires was very hard and does need a lot more testing and balancing to get the desired behavior from the agents.Game Demo AI Programming
Fallen behind on the blogging this last week so here comes a few things I have done.
Path smoothing so the characters won’t walk so strange. Red line is the original path found by my path finder. Blue line is my new smoothed path. Only had time to implement step one out of two so there is still room for improvements but the path is now acceptable at least.
The method I have implemented to smooth the path is called “rubber banding”. All my triangles is my nav-mesh is bound together with it’s adjacent triangles by three edges, one for each adjacent triangle. When finding my path I am using the mid-point of those edges as the points the character moves to. When “rubber banding” my path the idea is to move the walk-point on every edge to straighten out the path. Further explanation can be found in my HowTo.
Tuesday, March 09, 2010Game Demo AI Programming
Fixed my A* so it will now give me a short path. Seems to be some minor bugs in it, sometimes the path I get is kind of strange and not really the shortest but it will have to work for now.
Now I just need to smooth the path a little
Not really pleased with the way my A* is implemented right now but fixing that will have to wait. Next thing to do is to test the goals I have implemented so far and then implement a few more goals. If that doesn’t take to long I will come back to the A* and fix it.
The good news is that I solved the problem with finding the triangle I’m standing inside, the bad news is that my A* isn’t working.
Start is the circle to the left in the image and goal is the circle to the right. The lines in pink is the “shortest” path my A* found. It goes far of the screen and in to dungeons and over hills in to the lake for a bath and then some more wandering around the map.
Monday, March 08, 2010Game Demo AI Programming
Yay! I solved the problem with the Nav-mesh. The problem was when I calculated the midpoint of the sides of my triangles so it wasn’t a major problem but kind of hard to find. This is how it looks now:
After that was fixed I found another problem, this time it’s when I’m trying to find the triangle the character stands inside. Just like all my other problems it works some times an other times it doesn’t. I will have to fix this problem soon because I need it to work to test the rest of my program.
While ignoring that problem I have been working on the goal driven behavior for my agents. Agents should now be able to pick up the enemy flag and return it to their base to score as well as attack each other as soon as I fix the “find triangle problem”. At the moment I’m working on the priority system for the goals. So that the agents will appear “smart” and not just rush in to a group of five enemies.
The agents is also sending messages to each other to make the rest of the team more aware of the game situation. A few of the messages that can be sent if when the flag is taken and returned. Also got a few messages being sent between two fighting agents so they now when the opponent dodges of preforms an attack.
Working with Mathias to solve some problems with the mesh I’m using for the Nav-mesh but I think we got them all solved. The problem was when he made the mesh in parts, my Nav-mesh creation system didn’t find the path from one part to another even thou the character should be able to walk there. Also had a problem where the character could walk through some walls and trees because I didn’t detect them.
Monday, February 22, 2010Game Demo AI Programming
Debug image of my Nav-mesh. All the triangles in different colors and all the connections between them in red. The triangles looks right but the connections between then is not even close to right, There is however some parts of the map that looks right as u can se in the top left corner of the image. Got a smaller mesh to debug on but all the connections on that map worked so I have to debug on the big map =(
Result of the smaller map (right result):
Worked the whole last week trying to solve this problem but without any luck. So right now I’m a few days behind on my schedule so I have decided to skip this part for a while and start working on the goal driven behavior for my agents and then come back and try to solve the Nav-mesh problem later.
Tuesday, February 09, 2010Game Demo AI Programming
Finished the Nav-mesh creation so now I should be able to create my Nav-mesh from the environment mesh. Tryed to use nebulas dynamic mesh class to draw all the triangles in my nav-mesh but can’t get it to render anythingso I don’t really know if it’s working. Decided to just hold my thumbs that it works and keep working so I implemented the A* algorithm so it should be able to find a path now. Haven’t done any testing of it so don’t really know if it’s working, yet again holding my thumbs that it works. Next step have to be testing of both the A* and the nav-mesh.
Saturday, January 30, 2010Game Demo AI Programming
Finally got my AI book: AI Game Programming Wisdom 4 by Rabin, Steve, so this week I spend a lot of time reading, got a lot of really good information about nav-meshes so I could finally start implementing it. Only had the time to create a few classes and plan what they are going to do but I think I got a plan for it now.
Nebula 2.5 hates me =( They have changet alot from nebula2 and that have created some problems that have slowed me down somebut I did some progress, changed the camera controls from maya style to “free flight” style which is what we plan to use in the final presentation. Did some more performance testing and the conclusion is that my gpu is really bad (getting a new one soon thou =D ). The plan now is to have about 200’000 triangles in the scene 100’000 on the environment and about 10’000 on the character, with two teams of five it sums up to 100´000 on the characters.
Worked yesterday on getting access to the triangles in the environment mesh but they have made some changes to that from nebula2 so it didn’t go as well as I had hoped, this is now top prio and I will try to get some work done over the weekend with this.
Tuesday, January 26, 2010Game Demo AI Programming
Did a timeplan a few days ago, today I realized I need to change it. Fortunately I had an empty week in the end of the project I can use now =)
Finished the project plan and I think I know most of the stuff I need to know to be able to complete the project.
Set up a project in nebula 2.5 and loaded a few objects to test the performance to avoid the massive fps problem we had in the Noah project. We need to do a little more testing but we are beginning to see where the limit is.