3:16am - I've been really sick for about a week, and I'm still not feeling great, but I was energetic enough to get myself out of bed under the premise of coming out and doing work.
I had specifically planned to do some AI research, and the first thing I did, before I even started writing this, was watch the newest Game Makers Toolkit ep about Good AI in Games. After that I planned to read some of the articles by Richard Evans and Emily Short (or vice versa) about their developments in AI. But, I kind of balked at the idea when I actually went to their website, so that'll have to wait for another time.
I suppose that means I should work on my little AI project of my own now, my game of tag. Things kind of blew up when I realized how complicated my options are for sight cones in Unity. The simple option would be to use a cone shaped meshcollider to first determine if any targets are in the sight cone, then use a raycast to determine if there aren't any obstacles in the way, since the cone would overlap obstacles without detecting them.
The second way is similar but a little more complicated in code, and probably quicker to process. I'd use a cube shaped trigger instead of a cone, and then use a perspective matrix along with a raycast to determine if the ray is within the sight cone before testing for obstacles.
I'm honestly not sure which of these would be more efficient, computationally. I'm wary of using meshcolliders and I'm wary of using raycasts, they're both supposed to be expensive, but I've got no yardstick to compare them. I'd have to do a lot of math or do both and measure them against eachother to find out which was better. I'm not really willing to do either of those right now.
I think I'm going to try the second option. The Cube and Frustum option. It's less of a cone and more of a pyramid but that's what the player sees too, isn't it? Anyways I'm not sure how to actually do it, so I have to figure that out first.
3:49am - @.@;; Well that was a lot of complex math. It's been too long since I've worked with this sort of thing, I don't remember how matricies work. ^.^;;
Let me try to simplify it for myself here.
What I have is a ray, and what I want is to determine if that ray is within the perspective of the character. The ray goes from the character to another character that is penetrating the cube. How do I use a perspective projection matrix to determine if a ray is within or outside the frustum? When this was suggested to me I nodded my head like I understood and I thought I understood but now it doesn't make any sense to me. A perspective projection matrix is used in 3D engines.
Hmm... The more I think about it, the more I think I should try the other option with the vision cones. It'll give a 'rounder' shape and I won't have to deal with this stuff. I feel bad though, like I'm missing something important. :/
4:34am - Well I've got my cone shaped meshcollider now. I've jammed the cone into my mobile's head and made it huge. Now I just need to test it to see if it works. That'll take some coding. Unfortunately my tank is running dry after all this, so I'll have to put this down for now and do something else. I'm still sick after all.
I had specifically planned to do some AI research, and the first thing I did, before I even started writing this, was watch the newest Game Makers Toolkit ep about Good AI in Games. After that I planned to read some of the articles by Richard Evans and Emily Short (or vice versa) about their developments in AI. But, I kind of balked at the idea when I actually went to their website, so that'll have to wait for another time.
I suppose that means I should work on my little AI project of my own now, my game of tag. Things kind of blew up when I realized how complicated my options are for sight cones in Unity. The simple option would be to use a cone shaped meshcollider to first determine if any targets are in the sight cone, then use a raycast to determine if there aren't any obstacles in the way, since the cone would overlap obstacles without detecting them.
The second way is similar but a little more complicated in code, and probably quicker to process. I'd use a cube shaped trigger instead of a cone, and then use a perspective matrix along with a raycast to determine if the ray is within the sight cone before testing for obstacles.
I'm honestly not sure which of these would be more efficient, computationally. I'm wary of using meshcolliders and I'm wary of using raycasts, they're both supposed to be expensive, but I've got no yardstick to compare them. I'd have to do a lot of math or do both and measure them against eachother to find out which was better. I'm not really willing to do either of those right now.
I think I'm going to try the second option. The Cube and Frustum option. It's less of a cone and more of a pyramid but that's what the player sees too, isn't it? Anyways I'm not sure how to actually do it, so I have to figure that out first.
3:49am - @.@;; Well that was a lot of complex math. It's been too long since I've worked with this sort of thing, I don't remember how matricies work. ^.^;;
Let me try to simplify it for myself here.
What I have is a ray, and what I want is to determine if that ray is within the perspective of the character. The ray goes from the character to another character that is penetrating the cube. How do I use a perspective projection matrix to determine if a ray is within or outside the frustum? When this was suggested to me I nodded my head like I understood and I thought I understood but now it doesn't make any sense to me. A perspective projection matrix is used in 3D engines.
Hmm... The more I think about it, the more I think I should try the other option with the vision cones. It'll give a 'rounder' shape and I won't have to deal with this stuff. I feel bad though, like I'm missing something important. :/
4:34am - Well I've got my cone shaped meshcollider now. I've jammed the cone into my mobile's head and made it huge. Now I just need to test it to see if it works. That'll take some coding. Unfortunately my tank is running dry after all this, so I'll have to put this down for now and do something else. I'm still sick after all.