Malurek Posted May 2, 2021 I'm playing Brutal Doom version bd21RC8.pk3 in GZDOOM 4-2-4, and I have noticed something about the chaingunners and hit scanners in general. Every once in a while when facing a chaingunners eye to eye, they have a slight pause. Is this the AI registering the player, and then running code to shoot? And other times they fire immediately the second they see a miniscule pixel. I like to sometimes dual them like the old west. Fastest on the draw lol. Other enemy types like basic soldiers are obviously a little slower, but even they can laser point immediately. Shotgunners, and SMG soldiers seem to fire immediately no matter what. So my question is this: is this code for the chaingunners to act that way, or is it just the AI registering the player in line of sight? 0 Quote Share this post Link to post
out_of_service Posted May 2, 2021 (edited) They’re bewildered that you’re right up in their face you cheeky bugger. Edited May 2, 2021 by PSXDoomer 2 Quote Share this post Link to post
Gez Posted May 2, 2021 7 minutes ago, Malurek said: Is this the AI registering the player, and then running code to shoot? And other times they fire immediately the second they see a miniscule pixel. No. Monsters in Doom are state machines. Each frame of animation corresponds to a state. Each state has a duration and, optionally, an action. This action, when present, is run immediately upon entering the state, then the state waits for its whole duration and changes to the next. Some actions can cause an immediate state change, too. Also a monster's state can be changed in reaction to external acts, e.g. going into the pain state when hurt, or death state when killed. Anyways. The action for "look if there's a player in sight" is one that's quite expensive, computationally. Any line-of-sight check is expensive because the engine has to check for the presence of obstacles between the two actors. So it's not done constantly. For a vanilla chaingunner, it happens only once every ten tics (so 3.5 times per second). Again, as I explained, when an action is ran, it's ran at the state's first tic and then not anymore. So you have 1 tic where the heavy weapon dude looks out, followed by nine tics of not looking out. Depending on which tic you get in the chaingunner's line of sight compared to the chaingunner's internal clock, you may be noticed immediately, or after a fraction of a second. 3 Quote Share this post Link to post
Malurek Posted May 2, 2021 3 minutes ago, Gez said: No. Monsters in Doom are state machines. Each frame of animation corresponds to a state. Each state has a duration and, optionally, an action. This action, when present, is run immediately upon entering the state, then the state waits for its whole duration and changes to the next. Some actions can cause an immediate state change, too. Also a monster's state can be changed in reaction to external acts, e.g. going into the pain state when hurt, or death state when killed. Anyways. The action for "look if there's a player in sight" is one that's quite expensive, computationally. Any line-of-sight check is expensive because the engine has to check for the presence of obstacles between the two actors. So it's not done constantly. For a vanilla chaingunner, it happens only once every ten tics (so 3.5 times per second). Again, as I explained, when an action is ran, it's ran at the state's first tic and then not anymore. So you have 1 tic where the heavy weapon dude looks out, followed by nine tics of not looking out. Depending on which tic you get in the chaingunner's line of sight compared to the chaingunner's internal clock, you may be noticed immediately, or after a fraction of a second. How can you figure out which state an enemy is in when fighting them? Say for example I want to make a no death run as far as I can go. What's the best way to figure out what tic they're on? 0 Quote Share this post Link to post
Gez Posted May 2, 2021 It's basically not humanly possible. You can tell (roughly) what state they're in by which frame of animation they're in. (Though there are caveats because the same frame can be used by several different states...) But you can't tell for how many tics they've been in that state before you saw them... 3 Quote Share this post Link to post
Malurek Posted May 2, 2021 7 hours ago, Gez said: It's basically not humanly possible. You can tell (roughly) what state they're in by which frame of animation they're in. (Though there are caveats because the same frame can be used by several different states...) But you can't tell for how many tics they've been in that state before you saw them... I see. So in other words, shoot first and keep it moving lol 1 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.