MissileLauncher and Accuracy/Sprayangle

MissileLauncher and Accuracy/Sprayangle

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

MissileLauncher and Accuracy/Sprayangle

Post by SpikedHelmet »

I have noticed very strange behaviour with Missile Launchers and the Accuracy/Sprayangle tags. Basically they don't work right.

I am trying to create a swarm missile launcher type weapon that launches a burst of small missiles at things, and impacts targets like a "shotgun" with missiles spread out, some hitting, some peppering and raining down around it.

But this isn't very well supported currently because the Accuracy/Sprayangle tags don't do much, or do things in wierd ways.

Case in point my 20-burst missile launcher when set with very high Accuracy will start launching clusters of missiles across the map randomly. All missiles will hit the same point, but that point will often radically determine itself. However, even with accuracy >16000, about 3/4 of the bursts of missiles launched will travel directly to the intended target -- only ~1/4 miss wildly.

Experimenting, I decided to try to set each weapon to launch only once, with a short reloadtime. This time, every missile that was fired would arrange itself in a very obvious "V" shape from the actual target location (with the target location itself at the bottom of the "V" where the two lines meet).

Furthermore, this problem seemed to exacerbate itself at short range. The missile has a set max range of 2400. When firing at about 1/2 this distance this random V-shape pattern will be very obvious, but at closer to its max range its far less apparent and the missiles will seemingly "correct" this inaccuracy and hit the target point perfectly almost every time despite high accuracy/sprayangle settings.

This is a bummer because I would really like a swarm missile launch that sprays targets with burst missiles, but it seems I am stuck with either super-accurate swarms where every missile hits, or semi-super-accurate swarms where 3/4 of every missile hits and the other 1/4 go completely apeshit at shorter ranges but fly perfectly at long ranges.

Anyone know any fixes or workarounds for this?

EDIT: I'd like to find a solution without wobble and dance. To get the "spread on target" effect I want would require jacking these values up to a point that detrimentally affects the visual quality of the missiles themselves. Basically it looks like a crazy Lovecraftian quantum spider web of looming damnation.
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: MissileLauncher and Accuracy/Sprayangle

Post by Silentwings »

You could have a look at how the Catapult (armraven) is set up in BA; I think you could find alot of what you need. Mercury/Screamer might be useful too.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: MissileLauncher and Accuracy/Sprayangle

Post by Google_Frog »

Many games use the strange wobbling missiles as features. Whatever happens we need a way to retain the current behaviour because for many it is intentional.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: MissileLauncher and Accuracy/Sprayangle

Post by Anarchid »

Anyone know any fixes or workarounds for this?
Lua it.

Since 93.0, there exists a set of nice lua callouts, like GetProjectileTarget and SetProjectileTarget.

You can use those to tell your missiles to aim at whatever points you like, if those missiles are guided.

So not only you can make random swarm rain effect, but you can also make it impact in precise geometric pattern, making your Macross Missile Massacre look like a real work of art! bonus points for pentagrams and such... or spiderwebs, yeah.

If you want unguided missiles instead, just use any other weapon type, just make it look like a missile by adding a trail and projectile model.

If you want your (guided) missiles to spread before launch, you can use fixedlauncher i think and use 20 empty pieces as origins, each in its own direction.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: MissileLauncher and Accuracy/Sprayangle

Post by Pressure Line »

the 'dance' tag should work
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: MissileLauncher and Accuracy/Sprayangle

Post by FLOZi »

OP was unclear about what he's actually trying to do. Only accuracy and sprayAngle of a weapon can be changed on-the-fly, so wobble and dance don't help much.

Coding the behaviour entirely in lua is not something I particularly want to do, either.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: MissileLauncher and Accuracy/Sprayangle

Post by Anarchid »

Coding the behaviour entirely in lua is not something I particularly want to do, either.
Not entirely. Just provide individual targets to the missiles, so they don't all attempt to land on one spot.

What OP seems to want to do is cause the missiles to land in a hail somewhere around the target, so setProjectileTarget sounds like a valid rescue ranger.

Well that, or missile-lookalike non-missile projectiles instead.
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Re: MissileLauncher and Accuracy/Sprayangle

Post by SpikedHelmet »

Silentwings wrote:You could have a look at how the Catapult (armraven) is set up in BA; I think you could find alot of what you need. Mercury/Screamer might be useful too.
This effect is VERY similar to what I want as the end-result, except for the fact that the missiles don't track at all. I want spread, but also the ability to spread around a moving target. My missiles have much greater range so it's important.
Anarchid wrote:
Anyone know any fixes or workarounds for this?
Lua it.

Since 93.0, there exists a set of nice lua callouts, like GetProjectileTarget and SetProjectileTarget.

You can use those to tell your missiles to aim at whatever points you like, if those missiles are guided.

So not only you can make random swarm rain effect, but you can also make it impact in precise geometric pattern, making your Macross Missile Massacre look like a real work of art! bonus points for pentagrams and such... or spiderwebs, yeah.

If you want unguided missiles instead, just use any other weapon type, just make it look like a missile by adding a trail and projectile model.

If you want your (guided) missiles to spread before launch, you can use fixedlauncher i think and use 20 empty pieces as origins, each in its own direction.
Coding every behaviour in LUA isn't optimal, I'd really just like these tags to have more consistent results :)
Google_Frog wrote:Many games use the strange wobbling missiles as features. Whatever happens we need a way to retain the current behaviour because for many it is intentional.
Agree, maybe "fix" the issue by having some sort of "GuidanceInaccuracy" tag that has missiles logically impact various random points, the distance from actual target determined by the value. ie GuidanceInaccuracy = 100 would have missile randomly hit anywhere within 100 units radius of actual target point.
Pressure Line wrote:the 'dance' tag should work
It isn't modifiable though as FloZi said, which is what I need -- a way to change the accuracy of a unit's weapon depending on external influences.
User avatar
NeonStorm
Posts: 173
Joined: 23 May 2012, 18:36

Re: MissileLauncher and Accuracy/Sprayangle

Post by NeonStorm »

You could make 1 leader-missile which is perfectly accurate
(invisible and no damage if you want)

Use GetProjectileTarget every frame, add a random x/z offset for each projectile and re-set their targets with SetProjectileTarget

That will give you a formation.

You only need to remember this random x/z for each missile and make sure that the missile = {id, leader, x, z} entry in your table get deleted when the projectile dies.

If leader-missile is dead (=impact on ground) just keep the last coordinates+offsets you've got from it.

(EDIT: Or make another missile the leader, but then you have to re-align the offsets of your other missiles)
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: MissileLauncher and Accuracy/Sprayangle

Post by KDR_11k »

Sounds like a bug to me. When I last dealt with these things (which admittedly was VERY long ago) missiles followed spray and acc the same way other weapons did: The projectiles spawned with a random error in their initial facing. Obviously a homing missile will seek to correct this error and thus a homing swarm would converge towards the target (depending on turnrate, spread and distance of course, they need a bit of distance to correct their flight path). Guidance also counteracts effects like wobble.
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: MissileLauncher and Accuracy/Sprayangle

Post by raaar »

Code: Select all

...
weapontype=MissileLauncher;
range=2400;
wobble=1000;
burst=20;
burstrate=0.1;
flighttime=10;
weaponvelocity=450;
startvelocity=300;
weaponacceleration=50;
trajectoryheight=0.6;
...
currently it seems sprayangle only applies variation horizontally, and (in)accuracy is calculated only once per burst (in case you try to set "accuracy" instead of "sprayangle"). Wobble seems to work, somewhat.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: MissileLauncher and Accuracy/Sprayangle

Post by KDR_11k »

raaar wrote:(in)accuracy is calculated only once per burst (in case you try to set "accuracy" instead of "sprayangle").
That's the reason why there are two different tags, sprayangle is within a burst while accuracy is only for the whole burst (basically spray is how inaccurate the weapon is and acc is how inaccurate the user's aim is).
User avatar
NeonStorm
Posts: 173
Joined: 23 May 2012, 18:36

Re: MissileLauncher and Accuracy/Sprayangle

Post by NeonStorm »

if you use a burst of >=2, does spray give you a centered median?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: MissileLauncher and Accuracy/Sprayangle

Post by KDR_11k »

It's random, there are no guarantees.
Post Reply

Return to “Game Development”