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
anarchivist
 
 
 
Joined: 20 Jul 2003

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
Worldcrafter
 
 
 
Joined: 21 Jul 2009
Location: A Dynamic Link Library
Discord: NeuralStunner#1293

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
Registered Occasional Lurker
 
Joined: 05 May 2005
Location: London

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
Worldcrafter
 
 
 
Joined: 21 Jul 2009
Location: A Dynamic Link Library
Discord: NeuralStunner#1293

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
I'm tired. I want to go home.
 
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
Worldcrafter
 
 
 
Joined: 21 Jul 2009
Location: A Dynamic Link Library
Discord: NeuralStunner#1293

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
anarchivist
 
 
 
Joined: 20 Jul 2003

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
anarchivist
 
 
 
Joined: 20 Jul 2003

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
Registered Occasional Lurker
 
Joined: 05 May 2005
Location: London

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
Worldcrafter
 
 
 
Joined: 21 Jul 2009
Location: A Dynamic Link Library
Discord: NeuralStunner#1293

Re: Projectile Autoaim Question

Postby Matt » Thu Jan 08, 2015 9:19 pm

2-and-a-half-year necrobump!
Xaser wrote: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.
Start at speed 1, then use A_ScaleVelocity or spawn the subprojectiles using [your actual speed]*velx+frandom(whatever), etc.?

If the parent projectile's radius is smaller than the player's by more than one DU I don't think you should run into problems with it immediately smacking a wall.

The other (untested, off top of head, can't look up exact formulas) option I can see is:

1. Set the initial projectile speed to 1.
2. Use trigonometry in the first tic to set the pitch based on xyz velocity.
3. Randomize the angle and pitch as required.
4. Use A_ChangeVelocity to push the projectile forward in its new direction.

No subprojectile needed at all. I don't know the formula for 2, but I assume it would just be the reverse of 4, and examples of 4 should be readily available enough these days.


And obviously both solutions require features that weren't around at the time of the thread...
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Projectile Autoaim Question

Postby Xaser » Fri Jan 09, 2015 10:24 am

At this point I feel like the best solution lies in Feature Suggestion land. Dunno why I never opened a thread for such in the first place. :P
User avatar
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

Re: Projectile Autoaim Question

Postby Ed the Bat » Fri Jan 09, 2015 2:36 pm

Maybe because that place is apparently a graveyard when it comes to anything related to autoaim. :|
User avatar
Ed the Bat
I'm tired. I want to go home.
 
Joined: 03 May 2012
Location: Maryland, US

Next

Return to Editing (Archive)

Who is online

Users browsing this forum: No registered users and 4 guests