Projectile Autoaim Question

Discuss all aspects of editing for ZDoom.
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Projectile Autoaim Question

Postby Xaser » Sat Jun 30, 2012 6:17 pm

Hey all,

Another Hacx-y question of sorts. I've just realized that the use of autoaim profoundly affects the accuracy of one of the improved weapons:
Image

On the right is a "normal" projectile spread (bit hard to notice because of the trails, but it's the smaller, brighter white dots) while the left is what you get when you fire at an enemy from the same distance with autoaim turned on, which sorta cheeses the weapon quite a bit. :/

I've tried playing around with the A_FireCustomMissile "aim" flag, but it doesn't alleviate the problem entirely because although it prevents stray projectiles from being subject to autoaim if they're way off-target, any projectile that gets caught in the autoaim "field" will zero in directly on the target, ignoring pitch entirely.

Thus, the question: Is there a way to get A_FireCustomMissile to set the pitch trajectory after performing autoaim? Or is this a feature suggestion waiting to happen? I don't want to disable autoaim altogether, but rather keep its original functionality (allowing for automatic vertical aim in case freelook isn't used) in tact. If I could get each projectile to pick a target, aim straight at it, and then do a slight pitch adjustment, it'd make autoaim correctly emulate the behavior of manually vert-aiming at an enemy without actually messing with the weapon's accuracy.
User avatar
Xaser
secretly a supercomputer being a government
 
Joined: 20 Jul 2003
Location: .plɹoʍɹǝʌǝu.

Re: Projectile Autoaim Question

Postby NeuralStunner » Sat Jun 30, 2012 7:33 pm

Indeed, this would be a very handy feature. (Same for hitscan attacks, really.)
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: Projectile Autoaim Question

Postby Phobus » Sun Jul 01, 2012 3:26 am

Surely the SSG already proves you can do that for hitscans already?
User avatar
Phobus
 
Joined: 05 May 2005
Location: Histon, Cambridge

Re: Projectile Autoaim Question

Postby NeuralStunner » Sun Jul 01, 2012 4:45 am

SSG's hitscans are all in a single attack function. If you're "Stacking" attacks across multiple frames (necessary for multi-projectile weapons), it fails.

Personally I don't like autoaim, but if there's a way to make it not dumbtarded for those who prefer it, t'would be nice to have that option.
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: Projectile Autoaim Question

Postby Ed the Bat » Sun Jul 01, 2012 12:28 pm

I wonder if it would be feasible to create a function for firing swarms/clusters of projectiles, somewhat akin to how A_FireBullets allows for defining the number of pellets. Something like, I dunno...
Code: Select allExpand view
A_FireCustomMissileSwarm(str type,int numberofshots, [other parameters])

This way, a single action function would be doing what so far has required a stack of individual calls to A_FireCustomMissile, and autoaim would be applied just once to the whole group.

Does this seem like the right idea?
User avatar
Ed the Bat
 
Joined: 03 May 2012
Location: Maryland, US

Re: Projectile Autoaim Question

Postby NeuralStunner » Sun Jul 01, 2012 1:48 pm

I don't think that's a good solution. However a flag for applying angle/pitch adjust post-autoaim would solve all concerns.
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: Projectile Autoaim Question

Postby Gez » Sun Jul 01, 2012 4:17 pm

A possible approach: fire a single, autoaimed projectile.

Make it break into subprojectiles instantly, using A_SpawnItemEx with the transferpointers flag. Give tiny frandom changes to their spawning velocities, so as to create spread.

This will have the drawback of having the projectiles moving at slightly different speed, since they will all move at the same speed in the direction of the target, but with added random speed in diverging directions. But well, you can consider that straferunning for projectiles.
Gez
 
Joined: 06 Jul 2007

Re: Projectile Autoaim Question

Postby Xaser » Mon Jul 02, 2012 12:37 am

Hmm, that's a nice idea in theory, but it doesn't work in practice because the first projectile doesn't inherit pitch when the player fires it. That basically means you're never able to vertically aim at all. :(

I don't guess this is doable without adding a feature in, either way.
User avatar
Xaser
secretly a supercomputer being a government
 
Joined: 20 Jul 2003
Location: .plɹoʍɹǝʌǝu.

Re: Projectile Autoaim Question

Postby Gez » Mon Jul 02, 2012 1:07 am

You don't have pitch, but you do have vertical velocity.
Gez
 
Joined: 06 Jul 2007

Re: Projectile Autoaim Question

Postby Xaser » Mon Jul 02, 2012 3:06 am

If I give it a velocity, the projectile moves before I get the chance to use A_SpawnItemEx, even at zero tics. The result is that the projectiles spawn hella far from the player, which is bad.
User avatar
Xaser
secretly a supercomputer being a government
 
Joined: 20 Jul 2003
Location: .plɹoʍɹǝʌǝu.

Re: Projectile Autoaim Question

Postby Phobus » Mon Jul 02, 2012 5:10 am

Have the initial projectile be invisible, only last long enough to scatter it's load around and have a very low initial velocity (just enough to gauge direction from). That'll avoid the spawning distance problem.
User avatar
Phobus
 
Joined: 05 May 2005
Location: Histon, Cambridge

Re: Projectile Autoaim Question

Postby NeuralStunner » Mon Jul 02, 2012 1:36 pm

As someone who's tried this stuff before (multiple times) I can say these workarounds aren't really that... workable. :?
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies


Return to Editing

Who is online

Users browsing this forum: Yandex [Bot] and 1 guest