Skip to content

Some work on the missile projectile#8717

Merged
obrakmann merged 4 commits intoOpenRA:bleedfrom
matija-hustic:missile
Oct 13, 2015
Merged

Some work on the missile projectile#8717
obrakmann merged 4 commits intoOpenRA:bleedfrom
matija-hustic:missile

Conversation

@matija-hustic
Copy link
Copy Markdown
Contributor

An attempt at tackling #7509.

Introduces:

  • vertical rate of turn
  • customizable vertical launch angle
  • delayed activation of the homing mechanism / propulsion
  • freefall while propulsion deactivated
  • customizable explosion altitude (for airburst)
  • customizable cruise altitude (when target out of range)
  • height checks for terrain impact and shadow rendering
  • acceleration (instead of constant speed from launch to impact)

Not sure about what was meant in #7509 by

  • proper 3D math

Still missing and out of scope of this PR (at least currently)

  • support for voxel artwork

@matija-hustic matija-hustic changed the title Missile effect Some work on the missile effect Jul 15, 2015
@matija-hustic matija-hustic changed the title Some work on the missile effect Some work on the missile projectile Jul 15, 2015
@reaperrr
Copy link
Copy Markdown
Contributor

acceleration (instead of constant speed from launch to impact)

Starting with low speed and gradually become faster, rather than flying at constant speed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good opportunity to unhardcode this. Something like "JammedDiversionBounds" (used for both horizontal and vertical, but there might be a better name for that) with Desc "Defines range of facings by which jammed missiles can stray from current path.".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's jamming the current path instead of the original path. This gives a compounding jamming effect on the path of the missile.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fixed.

@matija-hustic
Copy link
Copy Markdown
Contributor Author

I'll play around with the acceleration next. I guess that that would mean

  • an additional upper speed limit will be needed
  • too high speeds might adversely affect accuracy
  • testing how it'd work with the freefall mode

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think Trail and related should be renamed. The tag was named as such in TS/RA2 and theirmods tend to use fire/toxic weapons with them too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. It's also used for the RA flamethrowers, so it should stay Trail, in my opinion.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So remove the comment?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current code have them mixed - new tags and the code use Smoke* already with only the old tags aren't renamed - this should be reverted back entirely to use Trail*.

@GraionDilach
Copy link
Copy Markdown
Contributor

Sorry, I took only a quick glampse so far.

What is freefall mode you refer to? Does that apply to missiles which already passed their RangeLimit but has ExplodeWhenEmpty=false and refers that they fall to the ground without doing(?) damage?

Does ActivationDelay means RA2 CourseLockDuration - missile is forced into the initial facing for x frames and only then starts to guide itself to target?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested this yet, true, but unless I overlooked something/didn't grasped the concept, you completely disable acceleration when the firer directly fires upside.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to rewrite this using integer math. Floating point math can be non-deterministic, and causes hard-to-reproduce desyncs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition might change, but @GraionDilach, right now it works well with any firing angle.

@matija-hustic
Copy link
Copy Markdown
Contributor Author

@GraionDilach, you have understood the RangeLimit and ExplodeWhenEmpty == false correctly. But the missile explodes when it touches ground ultimately.

The ActivationDelay also uses freefall (not constant velocity) before the guiding starts. This means that the missile does not just travel in a given direction, but that it follows a ballistic trajectory. You would want to use the LaunchAngle and InitialSpeed here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Add a 'TODO:' before Rename, easier to keep track of these if you have a buzzword to search for.

@matija-hustic
Copy link
Copy Markdown
Contributor Author

OK, updated. The TODO comments will be taken care of when the YAML upgrade rule is in place.

@abcdefg30
Copy link
Copy Markdown
Member

OpenRA.Mods.Common/Effects/Missile.cs(382,36): error CS0103: The name "shadowPos" does not exist in the current context

@matija-hustic
Copy link
Copy Markdown
Contributor Author

I've removed the missile shadow part cause it's done in #8923

@matija-hustic matija-hustic force-pushed the missile branch 3 times, most recently from 753b0e8 to b10031a Compare October 11, 2015 20:13
Added downward lookahead capability.
@matija-hustic
Copy link
Copy Markdown
Contributor Author

Making this thing know how to avoid obstacles is proving to be a handful. As it turns out, the previous version of the lookahead didn't handle firing downhill properly...
Now it should finally handle both uphill and downhill firing with some intelligence. But I'll need some more time for testing and going through the code.

@obrakmann, the bike and stealth tank should now be able to fire normally. The previous bug was a consequence of incorrectly choosing negative launch angles.

@reaperrr
Copy link
Copy Markdown
Contributor

Retested since there have been a few updates since I last looked at this.

The look-ahead works fine now, the vertical angle is factored into the sprite facing and the rest still works. So I'm renewing my 👍

@obrakmann
Copy link
Copy Markdown
Contributor

Yes, works fine now, 👍

obrakmann added a commit that referenced this pull request Oct 13, 2015
Some work on the missile projectile
@obrakmann obrakmann merged commit 410f121 into OpenRA:bleed Oct 13, 2015
@matija-hustic
Copy link
Copy Markdown
Contributor Author

I wanted to clean up the code some more. And make sure no other problems appear... Are you sure you want to merge it in the state it is in?

Can I file a followup PR then? In particular I'm afraid that some of my calls to ISqrt might pass a negative number. And the launch angle & speed selection could be better for downhill firing...

@obrakmann
Copy link
Copy Markdown
Contributor

Changelog

@obrakmann
Copy link
Copy Markdown
Contributor

@matija-hustic: oh sorry, I wasn't aware of that. But sure, file a follow-up. It all seemed to work nicely for me, though.

@matija-hustic
Copy link
Copy Markdown
Contributor Author

OK, I'll do that asap. And next time I'll ask for a "Has dependencies" label. I just hope the ISqrt calls don't cause problems.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do a followup pr, could you please put in some more readable names? We have plenty of spare vowels available for use in variables ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure :) I would have already left the vowels before were I not afraid of the names being excessively long and ugly. E.g. predAttHght to predictedAttainedHeight basically doubles the length

@GraionDilach
Copy link
Copy Markdown
Contributor

I'm just here to state that @matija-hustic is a hero:tm:, no more, no less.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do unhardcode this in a follow-up (I like the idea), personally I'd suggest leaving the minus here and only unhardcode the number, I think that would be more intuitive for modders (higher value = stronger gravity).

@hypercube33
Copy link
Copy Markdown
Contributor

This seriously junked up the SAM sites for NOD / CnC Gold FYI. The SAMs now shoot missles into the ground short of their targets.

@matija-hustic matija-hustic deleted the missile branch October 21, 2015 00:43
matija-hustic added a commit to matija-hustic/OpenRA that referenced this pull request Oct 29, 2015
Followup to OpenRA#8717

* Gravity unharcoded
* Variable names more readable
* More smaller functions instead of few big ones
* Crash check reverted to strictly negative heights
* Retested SAMs, submarines, adv. guard towers

I'm happier with how the code looks right now. Feels cleaner to me at
least.

As far as I've seen, current functionality is OK. It remains to see if the
new features will cooperate once they're used in YAMLs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.