Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(weapon): new "untouchable" tag that keeps projectiles alive after they collided with a ship and more #9079

Closed
wants to merge 8 commits into from

Conversation

RisingLeaf
Copy link
Member

@RisingLeaf RisingLeaf commented Jul 26, 2023

Important, this is not a replacement for #6276 as this does not allow for setting a maximum amount of hits, this is more thought for "field" like weapons that only interact with ships but are not something physical themself.

Feature Details

Adds a new tag, "untouchable" which prevents the projectile from disappearing when it hits a ship.
This can be used for deploy able, field like weapons as an example, as you don't want them to disappear once a ship enters that field. Other use cases would maybe be weapons that shoot dark matter, which only has gravitational impact on the world but pass through ships (I am not saying that's how dark matter really works, just giving an example).
This is just to give some examples, I could probably name some more if you need them.

Damage will be dealt per frame, which can result in very high damage numbers, content creators should keep that in mind.

Adds another tag "multi hit" that makes weapons able to hit multiple ships at the same time, useful for beam weapons. Only works in combination with "untouchable" as a projectile will die after the first hit otherwise.

UI Screenshots

2023-07-26.16-20-22.mp4
2023-07-27.14-46-49.mp4

Usage Examples

outfit "moving field"
    [...]
    weapon
        [...]
        "untouchable"
        "multi hit"

Testing Done

See the recording

Performance Impact

N/A

@solardawning
Copy link
Contributor

Pretty neat! This feels like something that, applied with an appropriate adjustment to the raw damage number, might be utilized on the Emerald Sword's spinal weapon; in concept it's a "pierce everything fusion pumped laser" (and visually does pierce everything), but was implemented with available technical limitations at the time to only deal damage in an AoE on the first thing the beam appears to hit.

This tag could be used to fix it in order to match the current visuals of the weapon in game; so that it would function as it looks as a piercing beam attack in a line.

@Azure3141
Copy link
Contributor

How does this work with beam weapons, both in terms of visuals and the way damage is calculated? Does it do more damage to ships if more of the beam slices through them, or is it always constant since beams are a single projectile?

@RisingLeaf
Copy link
Member Author

How does this work with beam weapons, both in terms of visuals and the way damage is calculated? Does it do more damage to ships if more of the beam slices through them, or is it always constant since beams are a single projectile?

My guess is that it would hit only once but I will try

@RisingLeaf
Copy link
Member Author

After a test quick test, it does hit only one ship

@RisingLeaf
Copy link
Member Author

I think I will add another tag "multi hit" to this PR as it kinda belongs to it

@RisingLeaf
Copy link
Member Author

added new "multi hit" tag, will update description

@EjoThims
Copy link
Member

Oh, this will make some of the things I was hoping to do roundabout through emitters much simpler :D

How does this handle AoE? Every hit sets it off?

source/CollisionSet.cpp Outdated Show resolved Hide resolved
source/CollisionSet.cpp Outdated Show resolved Hide resolved
@RisingLeaf
Copy link
Member Author

Oh, this will make some of the things I was hoping to do roundabout through emitters much simpler :D

How does this handle AoE? Every hit sets it off?

yes

@RisingLeaf RisingLeaf changed the title Feat(weapon): new "untouchable" tag that keeps projectiles alive after they collided with a ship Feat(weapon): new "untouchable" tag that keeps projectiles alive after they collided with a ship and more Jul 27, 2023
@Pshy0
Copy link
Contributor

Pshy0 commented Jul 27, 2023

Damage will be dealt per frame, which can result in very high damage numbers, content creators should keep that in mind.

This could make it hard to balance weapons, as they would deal incredible damage to largest ships (because they hit them multiple times) while doing tiny damage to the smallest ships (because they hit them only once).

This feels like something that, applied with an appropriate adjustment to the raw damage number, might be utilized on the Emerald Sword's spinal weapon

That's an example of what I think this feature is not for. But also for the following reason:

this is more thought for "field" like weapons that only interact with ships but are not something physical themself

The shot from the Emerald Sword's spinal weapon IS physical and should be able to be blocked by strong enough shields and armor. But it certainly gives this weapon some style when it pierces through a ship's hull. I just think it's not fair for large ships facing it, maybe add an option so that the damages are only dealt once per ship per projectile?

@RisingLeaf
Copy link
Member Author

this is more thought for "field" like weapons that only interact with ships but are not something physical themself

The shot from the Emerald Sword's spinal weapon IS physical and should be able to be blocked by strong enough shields and armor. But it certainly gives this weapon some style when it pierces through a ship's hull. I just think it's not fair for large ships facing it, maybe add an option so that the damages are only dealt once per ship per projectile?

the damage is dealt once per frame per ship per projectile, the merald swords projectiles have a lifetime of 1 so it would deal the same damage to every ship

@solardawning
Copy link
Contributor

this is more thought for "field" like weapons that only interact with ships but are not something physical themself

The shot from the Emerald Sword's spinal weapon IS physical and should be able to be blocked by strong enough shields and armor. But it certainly gives this weapon some style when it pierces through a ship's hull. I just think it's not fair for large ships facing it, maybe add an option so that the damages are only dealt once per ship per projectile?

the damage is dealt once per frame per ship per projectile, the merald swords projectiles have a lifetime of 1 so it would deal the same damage to every ship

Yeah, it'd certainly match the in-game visuals then if it hit everything in a line and had the current AoE removed.
Right now it's essentially a bug- the projectile 'appears' to pierce, but the actual damage will be dealt in an invisible AoE at the first struck target. To see this, fire at an asteroid close in front of you; the 'laser' you see past that does nothing.

This new functionality can fix that.

@Hecter94 Hecter94 added the enhancement A suggestion for new content or functionality that requires code changes label Aug 2, 2023
@quyykk
Copy link
Member

quyykk commented Aug 13, 2023

I'm not seeing how this is different than #6276. If a projectile is still alive after hitting a ship, then it can hit another. I think it would be weird if this isn't the case (for weapons with just untouchable).

@EjoThims
Copy link
Member

#6276 is different in the ability to have an upper limit of pixels doing damage, at which point it stops continuing to penetrate.

Which would still be useful to also have.

@Amazinite
Copy link
Collaborator

Amazinite commented Aug 13, 2023

#6276 has a case where negative penetration values on a projectile result in that projectile having no hit limit. What's the distinction between that mechanic from my PR and the "untouchable" mechanic from this one? So "untouchable" just seems like a less customizable version of "penetration."

@RisingLeaf
Copy link
Member Author

#6276 has a case where negative penetration values on a projectile result in that projectile having no hit limit. What's the distinction between that mechanic from my PR and the "untouchable" mechanic from this one? So "untouchable" just seems like a less customizable version of "penetration."

I was not aware of that. In that case I would say this could serve as the basis for a more customisable version.

@Amazinite
Copy link
Collaborator

The reason that #6276 was closed is because Tehhowch asked for something that would be a performance improvement to penetrating projectiles that I didn't have the time to work on when the PR was active. Realistically though, his suggestion would only be a major performance improvement in the case where a single projectile hits multiple ships in the same frame. (And even then, I don't imagine we'll EVER have a case where a projectile hits so many ships in the same frame that the current method of #6276 would cause the game to slow down.) I imagine that penetrating projectiles will still mainly be hitting a single ship each frame. The main case where you'd see multiple ships hit in the same frame would be for laser projectiles, but at that point it's probably worth asking where in vanilla we'd even be using this, and the only case right now (at least for a laser weapon) would be the Dragonflame (and maybe the Ember Tear, but that's such a rare appearance that it's probably negligible), which has a very high reload time, meaning that having a single frame every 3 seconds that could potentially be more performant probably isn't worth holding back the mechanic of penetration for.

Point being, I think we should probably just reopen #6276, make any slight changes that are needed, merge it, and leave any potential minor performance improvement for the future so that we can at least make use of the penetration mechanic now.

@RisingLeaf
Copy link
Member Author

As long as the mechanic gets in I am fine with it, I just opened this so it gets in sooner.
If reopening #6276 is the preferred way then I wont argue about that.

If you don't have the time to reopen it rn, I offer that I take over the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A suggestion for new content or functionality that requires code changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants