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

[Mechanic] Weapon Warmups / Charge Times #9972

Open
Azure3141 opened this issue Apr 6, 2024 · 4 comments
Open

[Mechanic] Weapon Warmups / Charge Times #9972

Azure3141 opened this issue Apr 6, 2024 · 4 comments
Labels
enhancement A suggestion for new content or functionality that requires code changes

Comments

@Azure3141
Copy link
Contributor

Azure3141 commented Apr 6, 2024

Problem Description

Weapons that you can hold the fire key to charge up, then release to fire would be neat. Weapons that need to warm up or charge up before firing are classic in scifi, usually associated with powerful cannons or lasers and whatnot, but there isn't really a way to do them in Endless Sky in a way that 'feels' right. Burst fire can be used to approximate an intermittent firing weapon, but the sense of charging up a weapon with a lot of energy and then releasing it is lost.

With a handful of attributes, we could have weapons like a synchotron cannon that needs to reach a certain charge threshold before it can fire, ionizing your ship the entire time, or a laser that increases in damage the longer you keep its beam firing. Or even a gatling gun that simply needs to warmup before it can fire, but from there can shoot as long as you want it to at a fixed rate of damage.

Related Issue Links

#902
#982

These don't go into too much detail about how a charge shot system would actually work, and I think this proposal has a few attributes in it that would enable much more flexibility.

Desired Solution

A few new attributes that are used to allow this kind of behavior
charge rate in charge/frame, to set how quickly the weapon charges when the fire key is held down
charge decay in charge/frame, to set how quickly charge decays if the fire key is released before firing
charging energy/heat/etc in value/frame and similar attributes for the other "energy" and damage types, applied every frame the fire key is held
charge threshold to set the minimum charge needed to fire. Releasing the fire key before this point just causes the charge to decay
charge limit to set the maximum charge the weapon can store
charge release (name TBR) if this attribute is present, the weapon automatically fires when the charge threshold is reached, even if the fire key is not released. Effectively caps charge to the charge threshold for weapons that use it, but also allows for non-single-shot behavior.
firing charge removes this amount of charge when the weapon fires. By default this could be equal to the charge limit, so you'd have to restart charging from 0 every time you fire, but setting this to 0 and using charge release could be used to create a weapon that warms up and then continually fires maybe?
charge lifetime adds this amount multiplied by the charge level to the lifetime of the created projectile
charge velocity adds this amount multiplied by the charge level to the velocity of the created projectile

All damage types set for this weapon are multiplied by the amount of charge the weapon currently has. So, if you gave a weapon a charge limit of 100 and a hull damage of 1, at its full charge the shot it released would deal 100 hull damage. I've kept lifetime and velocity separate from this, with their own attributes, since I think you might want to use lifetime and velocity as baseline values and have the charge attribute add to them.

Of course, we could separate out charge hull damage and charge heat damage and such to all be independent if we wanted to, but that might not be desirable considering how our damage types system is already very repetitive. Of course, now that I'm actually writing this, this might be the best solution when considering things like piercing and penetration count, which would similarly benefit from independent scaling with charge level.

Some non-mechanical attributes
charge sound this sound is played during the charging process
charge sound pitch adjust the pitch of the charge sound by this much every frame - I don't actually understand ES sounds that well so this might be unnecessary if you can play a longer loop as the charge sound, but I'm under the impression that sounds are played every frame so a longer loop might not work well
charge effect spawns this effect at the weapon hardpoint while charging.

Alternative Approaches

One potential problem with this approach is that it's mostly geared towards weapons that you charge up and fire once. With charge release and firing charge you could potentially create weapons that don't follow this model, like a laser that progressively gets more damaging or a gatling gun that takes a bit to spin up before it fires, but I'm not sure if this is the best way to do that

This also might not work well with submunitions, since I don't think there would be a way for a submunition to know the charge level of the weapon that created its parent. Of course, that might be possible to do, but I'm not sure if a different approach would be more flexible for working with submunitions.

Additional Context

I want a synchrotron cannon damnit.

@bene-dictator bene-dictator added the enhancement A suggestion for new content or functionality that requires code changes label Apr 6, 2024
@OcelotWalrus
Copy link
Contributor

OcelotWalrus commented Apr 7, 2024

Actually there's already a way you can do pretty much the same thing, using the lifetime, burst count, burst reload and reload attributes:

outfit "Cromha's Charging Beam Weapon"
    category Weapon
    weapon
        lifetime 1
        "burst count" 6000
        "burst reload" 500
        reload 1

This weapon would be a beam, that can fire every 500 frames, for 6000 frames. You could also change the reload and lifetime attributes, so that it isn't a beam anymore, and more a particle cannon for example:

outfit "Cromha's Charging Particle Weapon"
    category Weapon
    weapon
        lifetime 120
        "burst count" 30
        "burst reload" 500
        reload 10

But it's true that having specific attributes just for that, would be better, but it'd also add more interesting attributes that'd give more possibilities for weapons! Especially for the charging sounds and other stuff like that that're "cosmetic".

@Azure3141
Copy link
Contributor Author

Azure3141 commented Apr 7, 2024

I don't think that would do the same thing. You wouldn't be able to have damage or velocity/lifetime vary with charge rate, nor could you have resource costs apply during the charge time. You also wouldn't be able to have warmup times, as burst reload treats the first firing as though the reload counter has already run down.

@OcelotWalrus
Copy link
Contributor

That wouldn't do the same thing at all. You wouldn't be able to have damage or velocity/lifetime vary with charge rate, nor could you have resource costs apply during the charge time. You also wouldn't be able to have warmup times, as burst reload treats the first firing as though the reload counter has already run down.

I agree.

@xX-Dillinger-Xx
Copy link

I can already think of a weapon to make. An EMP pulse that radiates in all directions, like a blast, from your ship. The charge would drain your energy but deal a massive amount of ion and scrambling damage. The longer you charge the more damage and/or range.

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

No branches or pull requests

4 participants