Missile weapons and unerring accuracy. - Page 2

Missile weapons and unerring accuracy.

Requests for features in the spring code.

Moderator: Moderators

User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

Most likely. Spring doesn't have an abstract weapon class. So several cases are made where by it determines behavoir.

The problem comes in with the:

Trajectoryheight=1;

Making the weapon a missile.

This is the only way to get arced fire outside of high trajectory. The funny thing is acurracy offsets the target location a little behind the actuall target. However, the other weapons get a nice sorta random spread.

I am not really sure what to say because I didn't look at the code back when I was looking at writing a few patches.
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

I've only used that trajectoryheight for guided weapons. I was under the impression a 1 value was perpindicularly straight up and not necessary aimed at the target. If you use an unguided rocket does that make it shoot straight up?

Can't test until this weekend. My windows pc is waiting parts and this linux machien has only 800mb left on the hard drive. Don't want to get greedy and screw up the only working machine I got to install it on.

edit - I bet the trajectoryheight patch was written with missiles in mind and that is where its broken. It probably supercedes the code for computing trajectory. The author probably didn't put in code for alternatives to missiles when using the tag. By default it probably assumes the guidance tag is on when computing trajectory and that is why it has perfect aim linearly speaking.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

on a non guided weapon it arcs a shot. it was meant for balistics.
Image

I think there was another tag for vertical launch(I do not use it so I cannot remember it :P)
changelog wrote:Added missile tdf tag trajectoryHeight, this sets in how high an arc the missile will move toward the target,0 = straight, 1=45 degree above, can be anything>=0, default 0
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

Actually, from the description it sounds like TrajectoryHeight is the tangent of the firing angle. So TrajectoryHeight=1 equals a 45 degrees angle, and 90 deg. angle would require TrajectoryHeight=infinity. Values less then 1.0 should give angles lower than 45 degrees (TrajectoryHeight=0.5 should give approx. 27 degrees).
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

correct.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I've copied the two lines that handle inaccuracy in the EmgWeapon.cpp to the MissileLauncher.cpp, I think it should work but I can't get Spring to compile anymore (unrelated error, missing a .h for the sound system).
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

Any luck on the recompile tonight, KDR_11k?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Noone told me what I should do about that header file. It seems to be part of DirectX but the DX SDK is only for VC++.
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

Don't give up! :)
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

if you send me the patch / post it on smoths forums i'll compile it
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Code: Select all

Index: MissileLauncher.cpp
===================================================================
--- MissileLauncher.cpp	(revision 3404)
+++ MissileLauncher.cpp	(working copy)
@@ -52,6 +52,11 @@
 			dir.Normalize();
 		}
 	}
+
+	dir+=(gs->randVector()*sprayangle+salvoError)*(1-owner->limExperience*0.5f); //Applies the weapon's
+		//inaccuracy to the projectile
+	dir.Normalize();
+
 	float3 startSpeed=dir*weaponDef->startvelocity;
 	if(onlyForward && dynamic_cast<CAirMoveType*>(owner->moveType))
 		startSpeed+=owner->speed;
As I said, just a simple copy and paste from another file.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Flozi made a test build, I haven't tested it that thoroughly but it appears to work, missiles now spread like other weapons.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

WOOT
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Great, between that and Wobble I can do some very funky stuff ;)
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

Technically on a guided missile it should only initially aim away from the target, right?

I would think it would apply regardless if guided or unguided at launch, but still guide the same way to the target post-launch.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

You mean you couldn't already?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I haven't tried what happens with guided missiles but I'd expect them to just turn towards their target after launch.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

That would be cool
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

MACROSS MISSILES!!!!!

THRUST VECTORING!!

WEE..

all good stuff..
User avatar
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

Post by Noruas »

Now all we need is lasers that wobble as well as the image itself, then itd look sick.
Post Reply

Return to “Feature Requests”