The above image shows my first generation attempt. Here I displayed cubes on the nodes for viability. Basically what I did was given a start point, size, and distance between nodes create nodes in all directions based on that distance until we've reached the size. The next step from here was creating the connections.
The way I created connections this week was to check each possible adjacent position and check if there could be a valid connection. This method works but after doing some testing I think it would be good next week to try to connect to all other nodes rather then just the adjacent ones. In order to determine if a connection was valid I did a ray-cast from node to node to make sure there wasn't any collisions in between the two nodes. This still wasn't enough to assume all nodes were valid.
You might be wondering at this point how it would be possible to do all of these calculations during the game. Well you can't; it took up-to 30 minutes to generate some of these graphs. Fortunately after the graph is generated I can just pause the game and save the graph as a prefab. This way we can generate the graph for each level before hand and not have to worry about any creation time processing.
Now that I had my node graph created it was time to write the AI to follow it. I added path following to my AI control and created a wonder AI. The wonder AI just choose a random node and pathed to it. At first this caused lag issues on pathing but I optimized the path finding function a bit and limited the path length because there was no need to wonder to a specific point 100 nodes away. This fixed all of the lag issues. The AI still was running into everything and dying constantly because it did not do anything to avoid the trails or smaller obstacles.
So then as intended I knew I had to create some avoidance AI. I created rays in-front, above, to the left, and right of the player to check where obstacles were. In the event that an obstacle was in-front of me I checked for an open direction. I then avoided in that open direction. Once the opposite of the direction I avoided in was open I went back to what ever I was doing before. After a lot of tweaking of numbers and playing around with I got something I was happy with, for a start.
Finally I played around with actually being able to get the flag. The way this worked was I would path find to the flag until I was within a certain distance. Once I was within this distance I would just go strait for the flag. Once I got the flag I would just wonder. This worked well enough for getting the flag once but the AI was not able to pickup the flag again because his trail was in the same spot that he was aiming for making it impossible to avoid. This is something to workout in the future but overall I was happy with this weeks progress.