Discussion Non-homing but unit targeting projectiles

Furby

Current occupation: News poster
Reaction score
144
I was always wondering how Blizzard made wc3 missiles, I just mean those non-homing ones. They are really not homing to target, but they hit it even if it's moving. How's that possible?

Missiles guesses the position of target. This is what I lack in projectile systems. I recently downloaded and implemented Kenny's projectile system to my map, applied to units and then when I tested map, everything worked just perfectly except the arrow from archers looked really unrealistic, homing arrow.. that is unnatural.

So, I decided to make some formula to calculate the position of target when attacking it with ranged unit with non-homing missiles.

Here's some more exaplanation:

25s22bo.png


First is normal non-homing missile, as you can see if the target is moving the missile will miss the target.

Second is with base formula to calculate target's position after time in which the missile will travel to the point.
This way is little inaccurate, because the missile needs more time to get to target or less depends which angle is the target faced, in the example the missile would hit the dark-blue point position, but target would be already in teal point position.

Here's fix for this, we use the previous calculation to get the exact position.

Problem is that attacker will always miss the target when unit is turning around, I'm looking for the most efficient fix for this.

Any help, comments, constructive criticism or ideas appreciated. :thup:

Check out the demo map.
 

Attachments

  • projectieTest.w3x
    86.5 KB · Views: 218

Weep

Godspeed to the sound of the pounding
Reaction score
400
In first-person shooters, this is known as leading one's shots. ;)

Problem is that attacker will always miss the target when unit is turning around, I'm looking for the most efficient fix for this.
Units may not be moving in the direction they are facing (eg. take a Lich and rapidly order it to move in a circle.) In fact, the mysterious "Propulsion Window Angle" unit data field controls how far away from straight forward a unit may move.

A unit may also not be moving at its movement speed due to sliding triggers (and detecting whether it is moving at all is another problem - it may have null orderstring yet be moving to intercept a nearby enemy.)

Most efficient solution? Look for an is-unit-moving system, if one exists - otherwise, you'd need to write one, periodically checking each unit's position and comparing it to the position from the previous check. You could even save two or more previous positions so you can calculate acceleration, in an attempt to account for a unit that's moving on a curved path...
 

Furby

Current occupation: News poster
Reaction score
144
I already have this IsUnitMoving system, that is implemented and it works good. Problem is that when unit goes in one direction and suddenly it turns around 180° and goes back.. and when a missile is launched just when it's turning around.. then the missile will be shot far in front of unit.. totally missing the target..
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Calculate the angle from missle to target before calling SetUnitX/Y.
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
where is this IsUnitMoving system? i was looking for a similar thing (not for projectiles though)
 

cleeezzz

The Undead Ranger.
Reaction score
268
then again, what if they use Hold position after you fire your arrow? then it will look wrong. unless you check the units movement using the periodic user event on Projectile, and adjust your projectile accordingly.. but then again, wouldn't that look like homing? :D
 

Viikuna

No Marlo no game.
Reaction score
265
Wait, you want somekind of targetting AI?

Some system which can guess where unit might move and shoot projectile there?
 

13lade619

is now a game developer :)
Reaction score
399
yeah.. some movement prediction i think.

but the first one is good enough for most of us.
just shoot and aim at where the target currently is.
the targets run because they dont want to get hit..., making movement prediction seems to break the 'non-homing'..
 

Viikuna

No Marlo no game.
Reaction score
265
It should be a little random, so you cant predict it.

Humans can try to guess where target is gonna move, because they can take in account all the other stuff happening in the area, but in this case, you just can make your sytem to use all the needed data, so it should just randomly pick one of the possible spots that unit might move to.

If you dont want homing, this is really the best you can do.
 

Furby

Current occupation: News poster
Reaction score
144
then again, what if they use Hold position after you fire your arrow? then it will look wrong. unless you check the units movement using the periodic user event on Projectile, and adjust your projectile accordingly.. but then again, wouldn't that look like homing? :D

That's dodge. That's how you would dodge in real life. This is what I want to achieve. Because with homing missiles every damn arrow will always hit ya.

Here's demo map I made.

Dryad uses normal wc3 missiles, archer uses triggered ones.

Calculate the angle from missle to target before calling SetUnitX/Y.

Eh.. wtf? I ain't setting any X and Y.. this is about guessing target's position after time.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
I already have this IsUnitMoving system, that is implemented and it works good. Problem is that when unit goes in one direction and suddenly it turns around 180° and goes back.. and when a missile is launched just when it's turning around.. then the missile will be shot far in front of unit.. totally missing the target..
So if I took you right, you basicly just need a system which can detect a unit's movement vector without just getting GetUnitFacing()? I think that would be almost impossible, as you can never know the real unit's move speed (I think GetUnitMoveSpeed only returns the object data constant and doesn't take slow effects into account) nor the movement direction.

The only thing you can do is a short duration timer that is saving the old position of a unit, compares it to the actual one and thus calculates the movement vector. It would still be just an approximation, but it comes the closest to what you are trying to achieve.

However, this would take a very small delay in the calculation, so you might add a small firing delay to you missile. (I think 0.05 seconds would be enough to get a good approximation on the movement vector)
 

Furby

Current occupation: News poster
Reaction score
144
Well, this doesn't have to be that exact.. you just imagine you on place of that archer, how you'd shoot.

Though, I'm still wondering how Blizzard their missiles. :rolleyes:

Is there a possible way to find it somewhere, though I doubt it's that easy to find something like that in a game.
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
you could periodically check the displacement of all units (or maybe only units which have been attacked recently?) and approximate their average velocity from that
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
you could periodically check the displacement of all units (or maybe only units which have been attacked recently?) and approximate their average velocity from that
There no need to do it periodically. It's enough to do it once per missile firing. You do not need to know the correct movement vector at once (as the initial tick only spawns the missile). It's perfectly fine if you got it on the second tick - and this is possible with just comparing the displacement between the initial and the second tick.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top