Ouchface
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom General > No auto-aim after a distance. Why?
Pages (2): [1] 2 »  
Author
All times are GMT. The time now is 00:53. Post New Thread    Post A Reply
Optimus
Junior Member


Posts: 237
Registered: 02-05


I am curious about this known fact. Say you play Doom with keyboard only and no up-down look. There is auto-aim where an imp might be in a much higher or lower height than you but while you shoot straight the bullets go up or down directly to the target if it is on the line of your shooting. That's a known fact. It's also known that in far away distances this doesn't work and while a far away cacodemon for example that flies above is on your line, your bullets or rockets or whatever hit the wall below. Today, with a testing map in doombuilder I realized that the auto-aim stops working from 1024 units of distance or more.

My first question is why? Why did the designers of doom choose to disable auto-aim after such distance? Was there a technical or gameplay reason? There are maps where an annoying monster is harming me with serious firepower from a long distance and a bit above or below but I can't harm it if it's not at the same height except if I was playing with mouselook. I don't see a reason why it shouldn't be allowed in any distance. Or was there a technical reason for this?

My second question is: Any doom port with options to fix/allow this? Is it possible with a dehacked patch or do I have to change the source code?

p.s. I am curious now if this rule applies to the monsters too. Might test it with another map. Probably not though. I remember those huge areas where I can't shoot the friggin monsters unless I find a height, but they can shoot or throw fireballs from any height directly at you.

Old Post 10-23-11 20:54 #
Optimus is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
yellowmadness54
Senior Member


Posts: 1232
Registered: 03-10


To make it harder, and more realistic.

Like in modern day games, you can aim at an enemy, shoot him, but the bullet won't reach him. Thats pretty much what doom is doing.

Old Post 10-23-11 21:14 #
yellowmadness54 is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
PRIMEVAL
Senior Member


Posts: 1945
Registered: 03-09


I think hitscan monsters are affected by distance, but the distance is much greater than the player's. I could be wrong though, but I swear I've seen it happen.

__________________
Facebook | Twitter | Music on Facebook | Youtube | SoundCloud | ReverbNation

Old Post 10-23-11 21:18 #
PRIMEVAL is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Maes
I like big butts!


Posts: 12264
Registered: 07-06



Optimus said:
There is auto-aim where an imp might be in a much higher or lower height than you but while you shoot straight the bullets go up or down directly to the target if it is on the line of your shooting. That's a known fact.


Not exactly. Your aim is clipped against the maximum view angles, so if you can't see something, you also can't shoot it.

This limitation affects all hitscan attacks (including those of monsters), through calls to P_AimLineAttack which does the aforementioned check. The limitation also applies to the player's melee and missile attacks. Ports with freelook or extended view windows also modify the allowed shooting angles to allow "aiming" when you are not looking straight ahead.

All other monsters (using melee or missile) DON'T have this limitation, and in fact their attack functions DON'T call P_AimLineAttack at all. They know exactly where to aim (to the player or their targets) and they are not subject to the same "if I can't see you I can't hit you" thing. Call it a case of The Computer Is a Cheating Bastard ;-)

You can only override this behavior in ports that allow you to disable/modify autoaim from within the engine. With DEHACKED alone, you can't change those behaviors for the player. Other than the aforementioned, there's also a distance check which however is more subtle to follow, and seems to only have an indirect effect (it's only used in slope calculations).

There doesn't seem to be a hard and fast rule such as "beyond this distance, autoaim doesn't work", but there's the potential for numeric overflows and accuracy errors which would screw up calculations over long distances, and send shots too high/too low without you noticing.

Last edited by Maes on 10-23-11 at 22:05

Old Post 10-23-11 21:57 #
Maes is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Graf Zahl
Why don't I have a custom title by now?!


Posts: 7698
Registered: 01-03



yellowmadness54 said:
To make it harder, and more realistic.



It has nothing to do with realism. It's just a means to avoid calculation overflows. Doom's code for tracing a hitscan could run into problems if the distance was harder.

And like in any commercial production environment it was decided not to improve the code but to tweak it with the least amount of work to make it robust enough for release.

Old Post 10-23-11 22:16 #
Graf Zahl is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
yellowmadness54
Senior Member


Posts: 1232
Registered: 03-10



Graf Zahl said:



It has nothing to do with realism. It's just a means to avoid calculation overflows. Doom's code for tracing a hitscan could run into problems if the distance was harder.

And like in any commercial production environment it was decided not to improve the code but to tweak it with the least amount of work to make it robust enough for release.



I really didn't mean realistic, this was one of those things that were hard to word out.

Of course, you have more credibility than I would in this case, as I just thought it to be like "Oh hay, if that guy is over there, he should be out of doomguy's line of fire" sort of thing.

Old Post 10-23-11 22:23 #
yellowmadness54 is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Mattassacre
Newbie


Posts: 8
Registered: 10-11


never really noticed to be honest. :/

Old Post 10-23-11 22:32 #
Mattassacre is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
killer2
Member


Posts: 649
Registered: 02-10


This is pretty much the leading reason why I play OGL. Even in software you have limitations,as you can't look totally up or down. Needless to say, I hate those limitations.

Old Post 10-24-11 08:03 #
killer2 is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Super Jamie
Forum Staple


Posts: 2722
Registered: 03-08


It's for game balance. So you can't snipe from halfway across the planet.

Old Post 10-24-11 11:04 #
Super Jamie is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Gez
Why don't I have a custom title by now?!


Posts: 10998
Registered: 07-07


I doubt it's for game balance given that none of the IWAD maps really feature a situation where it'd be really relevant.


Plus the game balance in Doom was pretty much a lucky accident rather than a careful formula elaborated after the designers wrote a master thesis on the theoretical aspects of game balance.

Old Post 10-24-11 11:21 #
Gez is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Optimus
Junior Member


Posts: 237
Registered: 02-05


Thanks for the explanations. I just compiled chocolate doom to check this one.

Also, I made some test map with chaingunners in a higher ledge and a long room. It seems that their aiming ability stops after 2048 units, double the players ability. Another difference is that their bullet puffs seem to stop after 2048. There was a line over 2048 where they were shooting but no bullet puffs behind me yet bullet puffs in left right walls inside the allowed distance and not on the same height as me, so no auto aim for them. As I moved inside the area they hit me and bullet poofs where on my height in nearby walls. The only difference with the player, players bullet poofs will hit an obstacle from any distance, just will not auto-aim anymore.

It could make sense performance wise, having 100 chain gunners shoot many bullets at the same time and for each shot calculating intersections with possible many numbers of sectors through the big area would be a problem, but not for a single fire shot from a player. I also changed #define MISSILERANGE (32*64*FRACUNIT) to 2*32*64 and they could shoot me now. But it doesn't seem to affect my auto-aim, so I guess the next step is to play with the P_AimLineAttack function.

Old Post 10-24-11 11:46 #
Optimus is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Maes
I like big butts!


Posts: 12264
Registered: 07-06



Optimus said:
It could make sense performance wise, having 100 chain gunners shoot many bullets at the same time and for each shot calculating intersections with possible many numbers of sectors through the big area would be a problem, but not for a single fire shot from a player.


That's the point: the game tries to make an honest guess about where the player is probably aiming (a kind of What You Get Is Almost What You Mean), that's why all those relatively expensive checks are necessary only for the player, unless of course you forego autoaim almost completely and go for full manual control.

In addition to the slope limitations, the game also allows for some horizontal leniency as well: if firing straight ahead doesn't work, it also tries to aim at an angle of +/- 1<<26 BAM units with respect to the player's direction (quite coarse, about +/- 5.625 degrees), so each attack results in actually 3 checks along 3 slightly different paths.

Monsters don't need all those checks because they already know the exact x,y,z coordinates of their target and they are not limited by sloped (so they can even launch attacks that hit the floor they are standing on), even though they may miss it or choose not to attack for other reasons related to the bullet spread/blockmap/distance code.

Last edited by Maes on 10-24-11 at 12:07

Old Post 10-24-11 11:58 #
Maes is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
RjY
anARCHy


Posts: 943
Registered: 05-02



Maes said:
There doesn't seem to be a hard and fast rule such as "beyond this distance, autoaim doesn't work"
I believe there is: see P_BulletSlope and P_SpawnPlayerMissile, both of which call P_AimLineAttack with a maximum range of 16*64*FRACUNIT (1024 map units, as Optimus observed in his initial post)

Old Post 10-24-11 20:21 #
RjY is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Maes
I like big butts!


Posts: 12264
Registered: 07-06



RjY said:
I believe there is: see P_BulletSlope and P_SpawnPlayerMissile, both of which call P_AimLineAttack with a maximum range of 16*64*FRACUNIT (1024 map units, as Optimus observed in his initial post)


Dammit, you're right ><

Still...it only applies to bullet-using hitscanners and the player, who however has an additional limitation: the autoaim distance of 1024 units is half that of the MISSILERANGE constant (2048 map units), so attacks won't be aimed reliably for their full range. Even the name of the constant is deceiving, as it doesn't really apply to missile attacks at all, but only to the maximum range of hitscan attacks (autoaim range would be MISSILERANGE/2).

All other monsters (except the archvile) have no limits for their aiming (and there's no technical reason for limiting it, either: they don't need to transverse anything. Hell, they don't even need to see Doomguy or do some fancy inter-monster communication stuff to find him. Compare All seeing AI.

It would be interesting to see what would happen if hitscan monsters had an unlimited range attack, despite their gross aiming inaccuracy: people complaining about "cheap hitscanners" in maps would suffer a fatal stroke, and it would be like walking on a permanent damaging floor ;-)

Last edited by Maes on 10-24-11 at 21:19

Old Post 10-24-11 20:57 #
Maes is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
DuckReconMajor
Forum Legend


Posts: 4223
Registered: 01-09


Ugh, I hate this limitation. It bothers me when I can't shoot faraway monsters, yet they can happily lob their mess at me.

Graf Zahl said:
It's just a means to avoid calculation overflows.
like cancellation error?

Old Post 10-26-11 03:22 #
DuckReconMajor is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
magicsofa
Senior Member


Posts: 1385
Registered: 04-03



Optimus said:
The only difference with the player, players bullet poofs will hit an obstacle from any distance, just will not auto-aim anymore.


Did you mis-type this...I thought the players bullets do not travel past a certain distance. I specifically remember not being able to hit anything super far away (regardless of autoaim) although monsters could shoot me

Old Post 10-26-11 05:33 #
magicsofa is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Gez
Why don't I have a custom title by now?!


Posts: 10998
Registered: 07-07


Hitscans are limited to 2048 map units. Player and monster hitscans will go no further than that. Projectiles are unlimited, but monsters will normally not try to aim at targets beyond that range.

ZDoom increases the player hitscan distance to 8192 map units; though monsters are still limited to 2048.

Old Post 10-26-11 07:30 #
Gez is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Optimus
Junior Member


Posts: 237
Registered: 02-05



Gez said:
Hitscans are limited to 2048 map units. Player and monster hitscans will go no further than that. Projectiles are unlimited, but monsters will normally not try to aim at targets beyond that range.

ZDoom increases the player hitscan distance to 8192 map units; though monsters are still limited to 2048.



I see. I was mistaken because I tried the last one in Zdoom. Well, I first tried in chocolate doom and because the resolution was low I thought I just couldn't see the puffs. Nice to know now.

Old Post 10-26-11 09:39 #
Optimus is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Vermil
Senior Member


Posts: 1668
Registered: 03-04



Gez said:
ZDoom increases the player hitscan distance to 8192 map units; though monsters are still limited to 2048.


This seems like a 'half change'. Why didn't ZDoom either stay faithful in this area (change neither) or go all the way (change both)?

Yes, I am aware that a Chaingunner snipping you from 8192 map unit's could be annoying.

Old Post 10-26-11 10:06 #
Vermil is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Gez
Why don't I have a custom title by now?!


Posts: 10998
Registered: 07-07


Simply put, increased resolution means that you can see a monster from further away, and then it feels like a bug if you can't hit it with your chaingun. (Especially since you can have features like scopes that zoom the view.)

If a monster that is 3000 map units away fails to hit you, it doesn't feel like a bug: it seems natural that at this distance, with spread, you'd be luckier than if it was 300 map units away. Also you may not even notice you're being fired upon at all.

In fact, there are maps where it may affect the gameplay if hitscan monsters had an increased range.


It's a half change in the same way that jumping and crouching are half changes. The player can do that if so he choses. The monsters, however, still behave like they always did. They don't fire with a 8000 units range, they don't crouch, they don't jump.

But hey, monsters are still more likely to hit you anyway in ZDoom than in vanilla.

Old Post 10-26-11 11:06 #
Gez is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Maes
I like big butts!


Posts: 12264
Registered: 07-06



Gez said:
Hitscans are limited to 2048 map units. Player and monster hitscans will go no further than that. Projectiles are unlimited, but monsters will normally not try to aim at targets beyond that range


Projectile monsters have absolutely no distance or slope limit when targeting: they know their position, the target's position and they simply do the math. They have no option to abort an attack due to range, and the MISSILERANGE constant is not even used for missile attacks at all.

Old Post 10-26-11 12:57 #
Maes is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Creaphis
I will deliberately take a contrary position just for the sake of writing incredibly long arguments


Posts: 4177
Registered: 10-05


Yet, there's a point past which monsters won't fire missiles at the player. Keep studying the code until you find the reason why.

Old Post 10-26-11 15:07 #
Creaphis is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Maes
I like big butts!


Posts: 12264
Registered: 07-06



Creaphis said:
Yet, there's a point past which monsters won't fire missiles at the player. Keep studying the code until you find the reason why.


There's a half-reason, but it's way more complex than simply checking against a maximum range. Before you read any of the following, I challenge you NOT to take my word for it and study the code yourself, to see if we come to the same conclusions.

First of all, there's nothing causing most monsters to abort an attack if a target is already set AND they have already entered their firing state. They won't "yield" nor "chicken out" of it if e.g. their target gets out of range. Exceptions explained below.

The sequence is more or less: monsters execute A_Chase, they look for targets, and if they have one they run P_CheckMissileRange(). The player is a bit special in that he must be "detected" through the LOS functions, which may fail for other reasons which have more to do with a map's geometry or reject/bsp issues, rather than range. OK, in THAT ONE P_CheckMissileRange() function there are some range checks done but they are far from straightforward, and far from the only ones:


  • The only monsters which have some FIXED range limit that will prevent them from starting a ranged attack AT ALL are Archviles (at a ranges > 14*64 map units), and Revenants (won't use missile if closer than 196 map units, but there's an exception: read on).
  • If a monster is actually ATTACKED by its target, it will fire back no matter the distance. THIS TRUMPS ALL FOLLOWING CHECKS, and in theory it trumps even the archvile attack, at least within P_CheckMissileRange()
  • For all other monsters, the distance in map units is progressively divided by 2 after each check. After it's reduced to at most 200 or to 160 map units for cyberdemons, a call to P_Random() (!) is made, and if the result is smaller than the remaining dist value, then the attack is cancelled. That's right, PURE FUCKING LUCK.
  • Apart from the above mentioned cases, there are no further range limiting checks that may cancel an attack.


The corollary of the above? Barring some very special cases like Archviles, Revenants or immediate retaliation, the main limiting factor on STARTING ranged attacks is pure luck: ranged attacks have at most a 200/256 or 160/256 chance for cyberdemons of not being started at all.

WARNING: GORIER DETAILS FOLLOW

code:
if (P_Random() < dist) return false;


Of course, the larger the initial distance, the higher the chance that an attack will be aborted, which is however capped at 200/256 and 160/256 (about 75% and 60% accordingly). With sufficiently small distances, ranged attacks are never aborted, but even with the highest possible, the chance of starting them is always non-zero.

Assuming an Imp vs a Player:


  • P_CheckMissileRange() computes an initial value of dist which gets shifted >> 16 (from 16.16 fixed_t to 16-bit signed short).
  • dist doesn't get halved in any of the following checks.
  • Dist is capped at 200 map units.
  • P_Random() is called. If its value is <dist, the attack is aborted.


In the case of revenants, cyberdemons, spider masterminds and lost souls, dist gets halved. This effectively DOUBLES the chances of starting an attack.

So no matter the range, any monster has at most a 200/256 chance of aborting a very long range attack (assuming it can SEE the player when it attempts to do so).

So range does indeed make attacks increasingly rarer, but never with a zero chance. In order to do that you would need a value of dist >255 which would give a 256/256 cancellation chance, but would normally be impossible to achieve unless the distance calculations in P_ApproxDistance can cause some sort of overflow that would get past the capping. Setting it artificially to 256 makes indeed all monsters non-firing at ANY range, unless provoked (and then, they only fire once per provokation). Setting dist to 0 or negative removes all restraints on monsters, and they fire much more frequently.

AFTER an attack has been initiated, it might fail for other reasons (e.g. hitscan attacks actually ARE limited a-posteriori, archviles will abort if they lose LOS with their target), but the a priori causes are much more complex and unpredictable than people think, and luck/target behavior has far more influence than range.

Last edited by Maes on 10-26-11 at 17:05

Old Post 10-26-11 16:46 #
Maes is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
The Green Herring
Community Chest 4 Leader


Posts: 1245
Registered: 05-07


In case anyone wants to see the auto-aim limitation in action, there is at least one level, Cathedral of Doom B1.0, where 100% Kills is impossible without freelook because some unreachable monsters are placed too far away for auto-aim to work. A few imps to the north of the start of the level stand in alcoves at a great height and at a long distance behind a fence — far enough that without freelook, all you will ever hit is the wall beneath them. Try it and see.

Old Post 10-26-11 21:47 #
The Green Herring is online now Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Maes
I like big butts!


Posts: 12264
Registered: 07-06



The Green Herring said:
An example of a map where autoaim doesn't work.


Well yeah. That one and maybe 10000 others with monsters on too far and high a ledge/too deep a pit.

Old Post 10-26-11 23:34 #
Maes is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
killer2
Member


Posts: 649
Registered: 02-10



The Green Herring said:
A few imps to the north of the start of the level stand in alcoves at a great height and at a long distance behind a fence — far enough that without freelook, all you will ever hit is the wall beneath them. Try it and see.

Well if the map has a rocket launcher, hitting the wall beneath is all you actually need, as actors can be set to infinitely tall.

Old Post 10-27-11 09:37 #
killer2 is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Graf Zahl
Why don't I have a custom title by now?!


Posts: 7698
Registered: 01-03



The Green Herring said:
In case anyone wants to see the auto-aim limitation in action, there is at least one level, Cathedral of Doom B1.0, where 100% Kills is impossible without freelook because some unreachable monsters are placed too far away for auto-aim to work. A few imps to the north of the start of the level stand in alcoves at a great height and at a long distance behind a fence — far enough that without freelook, all you will ever hit is the wall beneath them. Try it and see.



Even Plutonia abused it to such a degree that I got annoyed by it.

Old Post 10-27-11 11:01 #
Graf Zahl is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Face23785
Member


Posts: 259
Registered: 04-11


I always wondered WHY this was too. Cool info. Good thread.

Old Post 10-28-11 23:34 #
Face23785 is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
printz
CRAZY DUMB ZEALOT


Posts: 8780
Registered: 06-06



Gez said in "wads that irritate you" thread:
If other ports have features allowing to create maps with huge outdoor areas where you fight with scoped rifles and railguns, I'd expect them to increase the player range as well.
Yes, but the chaingun is not exactly a sniper rifle, even if it's accurate. I don't need it to be upgraded like that by the engine. I'm perfectly OK with its limited range. If the mod used new hitscan weapons meant for long distances, then yes, the range upgrade would have been welcome. But otherwise, what it does is modify game behavior without user's input.

Old Post 11-06-11 00:08 #
printz is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Gez
Why don't I have a custom title by now?!


Posts: 10998
Registered: 07-07


I really can't believe people are seriously whining about that. As if it is an important part of Doom's gameplay to fire shots at very distant monsters and happily notice that the bullets, indeed, do very well vanish entirely as is good and proper.

I mean, most Doom maps don't feature areas large enough for it to be noticed at all. With the advent of limit-removing ports, however, such maps started to appear. One day, someone noticed that the bullets didn't connect on some map and thought it was a bug, the range was increased as a result. Ten years later, people are considering it a bug that the bullets do not vanish.

Well, if a longer range does detract from your enjoyment of the game, it's a good thing there are other ports that didn't change this value. You can try using them.

Old Post 11-06-11 00:31 #
Gez is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 00:53. Post New Thread    Post A Reply
Pages (2): [1] 2 »  
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom General > No auto-aim after a distance. Why?

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.