Scet Posted March 3, 2007 OK this should be my last question for a while. Basically I'm onto the AI component of my game. I was thinking of using the A* algorithm with either sub-sectors or the blockmap, but after looking at Dooms code this seems to be too much. So I'm wondering if anyone can explain how A_Chase and P_DoNewChaseDir work? I already know about tolerance and not targetting itself/other monsters like it. I just need to know how monsters walk toward the player and somehow manage to avoid obstacles. Is it just kind of a guess? Like if the player is east, head east? If the monster hits a wall, find a new direction? If the player is visible just face them? I don't see anything really complex in these functions, yet I can't believe it would be that easy. If anyone could explain how these functions work it would be appreciated. 0 Share this post Link to post
EarthQuake Posted March 3, 2007 Although I don't know much at the code level, as a player I can tell you that the Doom AI is pretty simple and straightforward. Monsters wake up and generally head for the players direction, but if there are obstacles or walls in the way, they will generally make a left or right turn. Sometimes, especially apparent with Demons, they will hit a wall and go the opposite direction of the player until they hit a wall. I'm not sure why they do this, but it can sometimes be useful if a monster needs to go all the way around a level structure to actually get to the player. A good way to observe monster movement behavior is to make a sort of maze-like map with monsters (I tested with demons and archviles) and put it on Nightmare with iddt x2 and just sit back and watch the automap. Sometimes it's amazing how well the monsters can navigate around the level without any complex AI scripting or anything... 0 Share this post Link to post
andrewj Posted March 3, 2007 Scet said:Like if the player is east, head east? If the monster hits a wall, find a new direction? If the player is visible just face them? I don't see anything really complex in these functions, yet I can't believe it would be that easy. It really is that simple. P_Move() tries to directly move the monster in the current direction, and fails if it can't move (monster hit something), in which case a new direction is set. A new direction is also set when the 'threshold' timer counts down. 0 Share this post Link to post
Scet Posted March 3, 2007 Ajapted said:It really is that simple. Well that sure makes my job easier. Thanks guys, I'll give the maze map a try too. 0 Share this post Link to post